TODO comments not working Follow Blackj0221 Created July 30, 2018 08:36 TODO patterns are already defined in Settings, but TODO comments doesn't work in editor.
TODO-Comments not working for me either. Has been a problem for several weeks. Restart doesn't help. I presume you'll want the logs? Here they are anyway https://drive.google.com/file/d/1gSP4Wibkh1jpn0Il5Q89wyJbBOfje6wa/view?usp=sharing
Apologies for the delayed response.
TODO-comments don't work for small files (sub 30 lines of code) or other projects either. The patterns I have stored are all valid regex, I'm pretty sure. Here's a screenshot just in case: https://drive.google.com/file/d/1sp7uXTFo61soPyo9lgcAzZ9UOBKklTjf/view?usp=sharing
Found the problem: the expressions listed above are all in lowercase. Though I thought it would ignore case-sensitivity, as it did before, it doesn't anymore. It does properly detect all lowercase-todo patterns. Is this intended behaviour?
It's in the slashes.
With the text
in a *.js file, the pattern
and the pattern
Patterns with slashes worked "before".
IntelliJ IDEA 2018.3.4 (Ultimate Edition)
Build #IU-183.5429.30, built on January 29, 2019
Treat indented text … selected (but it doesn't make a difference).
Thanks, it did turn out to be the case sensitivity check mark though. For whatever reason it reset to disable case insensitivity over an update (or maybe I changed it and forgot about it, I doubt it though) and enabling it fixed it
Hi Jan, Jan here :-) thx for the response.
Well, then there are multiple problems, because for me, it does not work when my pattern starts with a '/' (see above), whether or not case sensitivity is selected, and it does with the pattern without the slashes.
RegEx familiarity is up-to-speed, that is not the issue. Thank you for your concern.
No, RegEx does match patterns with slashes like that, in general (although one might need to escape the slashes, depending on the implementation). And these patterns did work "earlier" as TODO pattern. They do not work now.
But the issue probably is with an undocumented change you refer to: "that the todo search thing looks through comments".
The intention of having a pattern like
The latter is just cosmetic. In the string
with the current implementation, background and foreground color is applied to " TODO this is my todo" with the pattern
and not to the leading "//".
(1.) was necessary in earlier versions of IDEA. In the current version, it seems the TODO patterns only match in comments, regardless.
That is ok for me, but this change was not clear to me.
What I would like is for the color scheme to be applied to the whole comment block, not only to the text, purely for cosmetic reasons.
Did you try an IDE restart? Did you check it in other file extensions (.js,.html ...)?
You got it right, thanks for the log - they'll totally fine.
Seems like the problem is code-related. Please check if todo comments work in small files & in another project. Do you have the TODO patterns as pictured at the top at File | Settings | Editor | TODO?
What version are you on? Can't reproduce that in 2018.2.4.
There's basically a whole checkbox for case sensitivity, does it do anything at all? Also, please check if the issue persists after caches invalidation.
I can see why that would be a problem, as RegEx won’t match a pattern with slashes like that. Note that the todo search thing looks through comments already, so you don’t have to specify the slashes themselves.
If you’re unfamiliar with RegEx, there are excellent validators online.
just replace first \b in the patterns (for example, \btodo\b ) for (/|\*|\b) construction to support previous behavior.
Any idea why I'm getting nothing in the todo list, the editor seems to recognise the TODO with a different colour
What file is this in?
it's a typescript file in my codebase.
Works here. Are you on PhpStorm 2020.2?
Would it work in another empty ts file? Would it work in another project?
Do you have a TODO filter applied by any chance? See:
Hi I'm on ...
Build #PS-202.7660.42, built on October 16, 2020
Runtime version: 11.0.8+10-b944.34 x86_64
I have no filters setup.
It does work on another project and if I create a brand new ts file it works! It's just existing files for some reason.
Try to backup & remove the .idea folder in this project - check if that helps.
I have just realised what is going on. I am using emotion's 'css' tagged string template function ie
Although the IDE is able to detect the string as CSS and colour code it correctly, including TODO comments, the TODO tool bar doesn't parse them.
Thanks for sharing this! That's most likely caused by JS parser: it would be great if you could report this to WebStorm team. I can see a similar issue on their tracker: https://youtrack.jetbrains.com/issue/WEB-47861. You can comment there describing the problem & ideally attaching the project/files/steps to reproduce it.
thanks have added. The problem there looks like it's a vanilla ts file not an emotion css string.
arrived here because my TODO comments weren't being highlighted but it was because I had enabled Power Save Mode, problem solved after I disabled it
this is how it should NOT be, if you want to highlight your TODO comments