Sublime Forum

Extending Built-in Syntax Definitions? (for colour schemes)

#1

I feel like this has a simple answer, but I’m having no luck finding it.

I’m developing in python, and I’d like to add something simple: if a comment starts with TODO or -, give the line a background colour.

Ideally I’d like this across all/most other languages too - I do some web dev, so in js and php. But

Do I really have to duplicate/edit the built in python package, add a syntax scope, etc.? Or is there an easier way via packages?

0 Likes

#2

You could try installing SublimeLinter and SublimeLinter-annotations via Package Control.

1 Like

#3

I had SublimeLinter anyway, I added SublimeLinter-annotations but it’s not what I want - colour scheme control over the messages.

I want to be able to see TODOs and whatnot in the minimap on the right. I can’t find what colour scheme scope the annotations package gives, beyond the linter’s standard warning.

0 Likes

#4

You can configure the styles that the marks of the annotation plugin should uses. Here’s an example where I set “errors” to use an orange and “warnings” to use a blue color and the outline style:

The outline style is drawn on the minimap, but it may be hard to notice. fill doesn’t change anything, either. If there was an option to make the highlight span the entire line with the message instead of just the keyword, this might do what you want. There’s no such feature currently, but you can easily request it in an issue and refer to this thread:

0 Likes

#5

This is closer, thanks for showing me how to find the scope for the colour scheme. However, the scope only applies to the word “TODO” - I really want the whole line, so I can see lines across the minimap!

I’ll start an issue on the package, but I’m open to any other suggestions.

0 Likes