Chris
Chris

Reputation: 31256

How to generate custom "todo" tags in JetBrains IDE?

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?

Upvotes: 8

Views: 4341

Answers (2)

tammoj
tammoj

Reputation: 948

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

Upvotes: 3

esin88
esin88

Reputation: 3199

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

Upvotes: 18

Related Questions