8

In my settings, I have the TODO bound to highlight in yellow, yet in the actual code it does not highlight. Here is a screenshot of my settings: Editor -> TODO

Does anyone know how to fix this?

EDIT: I even tried re-installing Pycharm and I still have the issue.

EDIT 2: In the TODO Window, it is saying "0 TODO items found in 0 files". I believe this means it is looking in the wrong files to check for TODO items. However, when I try to find TODO items in "this file" it still doesn't work. Does anyone know why this is?

nernac
  • 175
  • 2
  • 9
  • Are you preceding TODO with a comment symbol? It should be: # TODO: *your text here* – ktv6 May 08 '20 at 11:58
  • Yes I am writing it exactly like that. – nernac May 08 '20 at 12:08
  • Does highlighting work correctly if you tick "USE color scheme defult colors"? Also are todo objects displayed in a TODO tool window? – ktv6 May 08 '20 at 12:18
  • I have tried ticking the default scheme and it still doesn't work, also the TODO items don't show up in the TODO tool window. It says: "Found 0 TODO items in 0 files" – nernac May 08 '20 at 12:34
  • You have Case Sensitive option ticked in your TODO settings but your regexp is lowercase. Try using # todo (with lowercase) or untick the Case Sensitive option and see if it works – ktv6 May 08 '20 at 12:41
  • I tried # todo and it didn't work, then tried un-ticking Case Sensitive option and it still doesn't work. :( – nernac May 08 '20 at 13:56
  • Not sure here but I think it's matching what you set (it looks like you've set the foreground color to grey and that's what is showing). Try setting the background color in the dialog box to blue or something and see what that does. – Ben May 08 '20 at 15:03
  • OK, I might be wrong on the foreground color but I still think it's worth setting a background color to see what data does. – Ben May 08 '20 at 15:07
  • I tried adding a background colour, still nothing. It's not showing the TODO items in the TODO window, meaning it's not detecting them at all. I believe the problem is it's looking in the wrong files, since it says "0 TODO items found in 0 files" But I don't know where it's looking. – nernac May 09 '20 at 11:52
  • Could you make a screenshot with your project structure and code sample please? – user2235698 May 09 '20 at 20:05

5 Answers5

6

Go to Preferences (or Settings), Project Structure, and make sure the folder with your files is not in the "Excluded" tab's list.

Click the folder you want to include and click on the "Sources" tab. Click Apply, then OK!

It should work.

theBrownCoder
  • 76
  • 1
  • 2
2

I recently updated PyCharm Professional and my TODOs no longer worked. I went into settings and changed the alert icon, then saved, and retyped them and they worked. I imagine for my case, there was a delay in the new version picking them up. Might just need to retype them to get them working again, though the reboot should have addressed this.

Not sure if your pattern is causing this, but mine is set up like so, with two separate patterns:

\btodo\b.*
\bfixme\b.*

Neither is case sensitive, BTW...

Perhaps try some other patterns to see if you can get those to work.

nicorellius
  • 3,715
  • 4
  • 48
  • 79
1

I think the problem for me was the same as explained by @theBrownCoder but I couldn't find the project structure settings.

Apart from not showing TODO's another symptom was impossibility to go to function definitions defined in other files and inability to rename python files with the error: "Selected element is used from non-project files. These usages won't be renamed."

Googling for this the solution that worked for me was to delete the .idea folder (make sure to back it up just in case, you will lose the configurations).

dullday
  • 121
  • 4
0

I had the exact same problem, and the solution suggested by theBrownCoder worked perfectly.

For those who cannot find which menu theBrownCoder is referring to, go to File > Settings > Project: "Title of Project" > Project Structure.

It is in the dropdown of Project in Settings where you can also select your Python interpreter.

Caroline
  • 21
  • 3
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32179832) – toki Jul 11 '22 at 05:59
0

It might be the file type. Right click, Override File Type.

I had this issue with a text file and it's copy, only the first one would use #TODO

Crowell
  • 35
  • 5