SCSS.tmbundle icon indicating copy to clipboard operation
SCSS.tmbundle copied to clipboard

Color Highlighting for variables?

Open danyeah opened this issue 11 years ago • 3 comments

Is it possible to add color highlighting for $variables highlight Its kind of hard to read when you have multiple variables.

danyeah avatar Jan 03 '14 10:01 danyeah

+1

mrmartineau avatar Mar 25 '14 10:03 mrmartineau

It looks like variables are scoped as source.scss variable. And when a variable is used in the value of a variable (eg: $color-text: $grey) the scope is source.scss variable.scss variable.scss.

Could it be that the theme you're using doesn't include a definition for that second scope? Something like this:

<dict>
    <key>name</key>
    <string>Scss - variable</string>
    <key>scope</key>
    <string>source.scss variable</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#ff0</string> <!-- yellow -->
    </dict>
</dict>
<dict>
    <key>name</key>
    <string>Scss - variable in value of variable</string>
    <key>scope</key>
    <string>source.scss variable.scss variable.scss</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#f00</string> <!-- red -->
    </dict>
</dict>

curtisj44 avatar Apr 09 '14 19:04 curtisj44

I've noticed the same, and none of the default themes featured the variable color highlightning. I've then added both of the entries above to the theme, but only one of them is working. They both work individually, but if both are present, source.scss variable.scss variable.scss always takes precedence, no matter in which order they're in the file.

// Edit Correction: the two different colors actually do work, but only if they're not within an actual style definition. So $color: $blue; works, but .blue { $color: $blue; } will be displayed in the same color (which is still better than no syntax highlighting at all).

sp00n avatar Jul 03 '14 22:07 sp00n