Sublime Forum

Custom theme not working correctly in Sublime

#1

I have a custom theme (called Dobdark) that I used in E. I’ve transferred it over to Sublime and have just noticed that several scope selectors aren’t being picked up by Sublime. Here’s a side-by-side comparison:

http://i.imgur.com/NTCco.png

Where the colours appear to be missing in Sublime the scopes are the same in both apps, it’s just the scope selectors in the theme don’t appear to be working in Sublime. For example, the following works in E, but not in Sublime:

<dict> <key>name</key> <string>§ css tag-name</string> <key>scope</key> <string>entity.name.tag.css, entity.name.tag.haml, meta.property-list.css entity.name.tag.reference.css, source.scss entity.name.tag.reference.css</string> <key>settings</key> <dict> <key>foreground</key> <string>#FB9933</string> </dict> </dict>

0 Likes

Bracket matching no longer works
#2

Note, if I add a bit more specificity in there, it appears to start working. So I change entity.name.tag.css to source.css entity.name.tag.css and it works.

Also note that that this same rule works with Haml; i.e., entity.name.tag.haml is being correctly recognised by Sublime and coloured accordingly. E.g. : (http://i.imgur.com/RAIzq.png) (article, section, header and h1 are being selected and coloured).

0 Likes

#3

Thanks for the report - in this case, it’s because Sublime Text ranks scope selectors in a slightly different way to TextMate.

There are two rules in question (named “Meta.tag.inline” and “css tag-name” in the .tmTheme), with the selectors (relevant part only):

A) source entity.name.tag
B) entity.name.tag.css

Against the scope “source.css meta.selector.css entity.name.tag.css”, TextMate will rank B higher, while Sublime Text will rank A higher.

I’d like to fix this, but it’s not high on the priority list - I’m not aware of it having caused any other issues. In the mean time, you should be able to work around it by tweaking the selectors in question (perhaps by getting rid of the source prefix on the first one, or adding a source.css prefix to the second one)

0 Likes

#4

Thanks for the quick response, Jon. I removed the source prefix and now all is well.

0 Likes