Skip to content

Color Highlighting for variables? #164

Open

Description

@danyeah

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

Activity

  1. mrmartineau commented on Mar 25, 2014

    @mrmartineau
    Contributor

    +1

  2. curtisj44 commented on Apr 9, 2014

    @curtisj44

    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>
  3. sp00n commented on Jul 3, 2014

    @sp00n

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions