Home Download Buy Blog Forum Support

CSS Syntax Highlighting

CSS Syntax Highlighting

Postby dom111 on Fri Jul 01, 2011 1:06 pm

Hi there,

I just thought I'd check up on something before raising a bug (see if it's something related to my theme, rather than the system) but I don't think the CSS syntax highlighting is working quite right.

I'm using the Twilight theme and the ids and classes aren't being highlighted the way I expect them to be.

http://i.imgur.com/wkJaD.png (Comparison is TextMate... Sorry that it always comes down to comparing this to another editor, I do appreciate Sublime on it's own merits!)

I just wondered if this is something I've changed (and broken) or the expected behaviour...

Thanks!

Dom
dom111
 
Posts: 12
Joined: Wed Jun 08, 2011 9:13 am
Location: UK

Re: CSS Syntax Highlighting

Postby guillermooo on Fri Jul 01, 2011 2:48 pm

Have you compared the scopes too? If you're using the same color scheme and the same tmLanguage file, I'd say you'd have to see the same result.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: CSS Syntax Highlighting

Postby senzo on Fri Jul 01, 2011 2:51 pm

This definitions are working for me in ST:

<dict>
<key>name</key>
<string>CSS: .class</string>
<key>scope</key>
<string>entity.other.attribute-name.class.css</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#152b70</string>
</dict>
</dict>

<dict>
<key>name</key>
<string>CSS: #id</string>
<key>scope</key>
<string>entity.other.attribute-name.id.css</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#3c2896</string>
</dict>
</dict>
senzo
 
Posts: 106
Joined: Tue May 24, 2011 9:17 am

Re: CSS Syntax Highlighting

Postby dom111 on Fri Jul 01, 2011 4:02 pm

Thanks for your comments!

I've got it working now, but I had to modify the Twilight.tmTheme. I also stumbled upon this post when I searched for the scope name and the changes appear to be differences in the weighting of the selectors. If anyone is interested I changed the following lines in Twilight.tmTheme:

Code: Select all
Line 350: <string>source.css meta.selector.css entity.other.attribute-name.tag.pseudo-class.css</string>
Line 361: <string>source.css meta.selector.css entity.other.attribute-name.id.css</string>
Line 372: <string>source.css meta.selector.css entity.other.attribute-name.class.css</string>


to make the scope selectors more specific (at least, I assume that's what I did..!)

Thanks for the pointers!
dom111
 
Posts: 12
Joined: Wed Jun 08, 2011 9:13 am
Location: UK


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 10 guests