Pycharm里面的TODO功能有什么作用

Pycharm里面的TODO功能有什么作用,第1张

明智的做法是:

在bug旁边写一个“#todo: computer will explode while running the program for 24+ hours”,然后继续写代码。

为了防止你今后忘掉这个bug,pycharm会在3个地方提示你:

<img src="https://pic1.zhimg.com/de3b59e9b056e6b2b441507bc7bff4ac_b.png" data-rawwidth="968" data-rawheight="553" class="origin_image zh-lightbox-thumb" width="968" data-original="https://pic1.zhimg.com/de3b59e9b056e6b2b441507bc7bff4ac_r.png">

另外,在多人协作的项目中,todo还可以用来区分“谁要去修复这个bug”。PyCharm官方文档介绍如下:

create several filters, which you will use to show the TODO items, say, for each of the developers, and not for your good self. For this purpose, in the Filters section, click , and specify the filter names, for example, For John, For Bob, and not for me. Associate these filters with the patterns:

<img src="https://pic3.zhimg.com/cece7b8eea2ba4335de15f40fbed118e_b.png" data-rawwidth="503" data-rawheight="309" class="origin_image zh-lightbox-thumb" width="503" data-original="https://pic3.zhimg.com/cece7b8eea2ba4335de15f40fbed118e_r.png">

Now, in the source code, create TODO items: in the line of code, where you want to add a note, press Ctrl+Slash, or Ctrl+Shift+Slash, and type TODO that matches one of the patterns, followed by some meaningful description:

<img src="https://pic3.zhimg.com/8a6ed87701d7a2df5791d60bfd071006_b.png" data-rawwidth="297" data-rawheight="269" class="content_image" width="297">

Eclipse下可以添加类似于TODO, FIXME, XXX 这类的自定义任务标签

在IntelliJ下也可以如此:

preference ->Editor ->TODO

发现已有两个标签:

\btodo\b.* ---- 对应TODO

\bfixme\b.* ---- 对应FIXME

加号可以添加自定义的TODO标签,如:

\bxxx\b.* ---- 对应XXX

有三个图标可选择,自己随意选择。

要查看TODO标签,在软件下方的『TODO』窗口中,点击漏斗按钮可以筛选标签。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/7872620.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-10
下一篇2023-04-10

发表评论

登录后才能评论

评论列表(0条)

    保存