Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetbrains IDE: How to generate custom "todo" tags?

I have figured out how to download and install new color schemes.

It is after I did this that I noticed that IntelliJ will still color the following line yellow:

// ToDo: implement

Further, this coloration is independent of the color schemes I download. So, I now surmise that it is colored that way due to some logic specific to the Intellij.

I also use Pycharm and CLion, and suspect it would be the same situation across all three.


Here is the question: how do I access these settings/xml/logic and specify that I want say, 5 types of comment tags with colors A, B, C, D, E, such that I can call them by saying stuff like:

// T-A: File read in (t would be type)

// T-B: transform data

// T-C: linear section

// T-B: transform again

// T-D: parallel section

// T-E: MPI update

// T-B: array read in

// T-A: File read out

// etc. 

So that I can basically color code the regions of a project, rather than just use the "ToDo" line?

like image 237
Chris Avatar asked Dec 18 '22 07:12

Chris


2 Answers

You can go to Preferences | Editor | TODO. And there you can add / remove / edit your own patterns and filters, including color scheme:

enter image description here

After that, in your TODO window there's a Filter button with option to Edit filters, so you can easily find all places in your code with your custom patterns.

enter image description here

like image 94
esin88 Avatar answered Dec 22 '22 17:12

esin88


The problem was already answered quite well but I would like to add the usage of non-word tags like ???.

This requires to adopt the regex boundary character from \b (word boundary) to \B (non-word boundary). This leads to the final pattern \B\?\?\?\B.* to match:

code // ??? comment
code // ???: comment

This was not directly asked but may helps other with the same problem as I met...

See also https://www.jetbrains.com/help/idea/regular-expression-syntax-reference.html

like image 20
tammoj Avatar answered Dec 22 '22 17:12

tammoj