Sublime Forum

TODO Syntax highlighting


Hi there!

I was wondering how I would go about modifying a sublime-syntax in order to highlight TODO, FIXME, HACK and/or NOTE like the Atom editor.

See the images for details!


Sublime Text:

I know there’s the SublimeLinter-Annotations plugin for the linter (they talk about that here), but having them turn up as linter warnings or errors isn’t ideal. Atom’s got it down well.

Any ideas on what I’d have to do?
I would think it would be editing each sublime-syntax file, one by one. Not sure if there’s any way to do it across all languages at once though…

1 Like


have you considered using instead?

because maintaining your own copy of the syntaxes is a lot of unnecessary work

this one seems to have slipped through though:



This is why I’m asking the question - I don’t want to maintain a copy of each syntax! haha

I had considered that package, but that creates markers in the Sublime View - which isn’t ideal (by my standards anyway).
I was looking for something lighter, like inside a syntax or similar, which has the added bonus of colouring the text (whereas markers can only create outlines, underlines, or filled rects, etc).

Good find in that syntax though! haha - if only they had that for each of the syntaxes…

Is there a way to run another syntax over all syntaxes? Maybe I could create a mini-syntax of sorts in order to do it globally.



you could write a plugin to automatically update the syntax definitions, but I’m not sure that would be any less work… there’s no way to do a second pass with another syntax.

having it as part of the syntax definition (and scoping the whole line in a meta scope in addition to the TODO etc.) would allow users to choose to put those comments in the symbol list for easier navigation


#5 might work instead

1 Like


@rppn all good options, but unfortunately I simply wanted them to be syntax highlighted - nothing more, nor less.

@kingkeith I may go with building a plugin to update them, although I may not as well! Depends on how much this gets to me.

Appreciate the effort from you all though! :+1:



Depending upon the time you have on hand, you could submit PRs to:

The Scope Naming guide however does not explicitely list any scopes for TODOs, though. Until Jon and Will have decided on those, a plugin might be best indeed.



@rppn I would start doing that, so I could contribute, however the only thing that stops me is I think that Jon and @wbond don’t want this in Sublime Text at the moment (judging by @wbond’s comment here).

Otherwise I’m more than keen to submit some PRs.



What I wouldn’t want is a drive-by addition to a single syntax for a user’s preferred style of todo.

I would be open to consider a standardization of “todo” scoping if we can come up with:

  • A list of either common conventions or standards for the default syntaxes
  • A standardized scope name that color schemes can target

The first bullet it going to be the main bit of work. We don’t need to have 100% coverage of default syntaxes, but it would make sense to me that we try to cover most of the popular languages like:

  • JavaScript
  • C/C++
  • PHP
  • Ruby
  • Python
  • C#
  • Java
  • Go
  • Rust
  • Scala
  • TCL
  • D

For each of these, we should probably collect links documenting the common conventions (todo:, @todo, XXX, etc).

Then finally we need to come up with scope name specialization for comments to apply to the marker and the text.



Bad option from my point of view. It might always be a tricky and buggy thing to keep those hacked files sync with their ancestors - this is what I’ve learned from struggling with patched color schemes files of SublimeLinter or patched themes by A File Icon.

This is no solution but a hack, only!



@wbond I believe that most of these “TODO” comments began in different IDEs, but there are some specifications (like PEP which has standardised rules for such comments).

Here’s the result of a small search:




From what I can tell though, most IDEs offer a default selection, and then have a configurable pattern in which the user can add / remove their own tags as desired (hence my thoughts for a mini-syntax or overlay-syntax, etc).

I’m not entirely sure if a “standard” exists, but from these I’m sure we can gather together a list of common conventions since it seems to be widely used.

I think this is definitely important, and as @kingkeith said:

As for what it should be, here I really don’t know. Some ideas:

  • As linked before, TODO comments have crept into sublime-syntaxes in the past, and they’ve used comment.line.todo.
  • Atom marks them as type.class.todo.


Did this go anywhere? What’s the best way to highlight TODO et al run ST4?



Have you tried this ?



Cool! I’ll try that. I was a bit worried with all the previous suggestions as they seem like abandoned plugins.



I just tried installing that add-on again and still seems broken in ST4. How are ppl colouring their TODOs in ST4? It seems trivial in all other editors.



Still works here on ST4



Cool, how did you run Colored Comments: Generate Color Scheme when it doesn’t exist in the Command Palette as per instructions? It’s completely broken for me and the GitHub repo seems neglected.



There is also this plugin (works with ST4):

1 Like