Home Download Buy Blog Forum Support

Custom theme not working correctly in Sublime

Custom theme not working correctly in Sublime

Postby charlesroper on Thu Jun 16, 2011 12:09 pm

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:

Code: Select all
            <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>
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am

Re: Custom theme not working correctly in Sublime

Postby charlesroper on Thu Jun 16, 2011 12:40 pm

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

Also note that that this same rule works with Haml; i.e.,
Code: Select all
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).
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am

Re: Custom theme not working correctly in Sublime

Postby jps on Thu Jun 16, 2011 1:08 pm

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):

Code: Select all
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)
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Custom theme not working correctly in Sublime

Postby charlesroper on Thu Jun 16, 2011 2:04 pm

Thanks for the quick response, Jon. I removed the source prefix and now all is well.
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 9 guests