ColorHelper icon indicating copy to clipboard operation
ColorHelper copied to clipboard

Fix to scanning for SCSS

Open starfishpatkhoo opened this issue 9 months ago • 3 comments

ST Build 4192 Color Helper Version 6.4.1 SASS Module: https://packagecontrol.io/packages/Sass

Sample Code:

$viridian: #3F826D;

If you load this line as a color.scss (SCSS) then Color Helper will not scan it properly. Rename the file to color.sass (Sass) and then it works.

The reason is because the SASS module for SCSS scopes things differently. Here is the correct scoping.

 "color_rules": [
        {
            // Sass (based on: https://packagecontrol.io/packages/Sass)
            "name": "Sass",
            "syntax_files": ["Sass/Syntaxes/Sass", "Sass/Syntaxes/SCSS"],
            "base_scopes": [
                "source.sass",
                "source.scss"
            ],
            "color_class": "css-level-4",
            "scanning": [
                "source.sass meta.property-value.css -comment -string -variable.declaration.sass",
                // "source.scss meta.property-value.css -comment -string -variable.declaration.sass"
                "source.scss meta.declaration.value.scss -comment -string -variable.declaration.sass"
            ]
        },
]

Basically, meta.property-value.css should be meta.declaration.value.scss .. I'm not sure what -comment -string -variable.declaration.sass is supposed to do though. But so far, seems to be fine.

starfishpatkhoo avatar Mar 05 '25 16:03 starfishpatkhoo

This appears to be a recent syntax change as I use SCSS in one of my projects and previews used to work.

facelessuser avatar Mar 05 '25 17:03 facelessuser

I'm going to assume this is a general change needed for both SASS and SCSS. However, instead of removing the old rule, we'll leave it in for people on older versions.

facelessuser avatar Mar 05 '25 18:03 facelessuser

Yeah, that's a good arrangement.. if you feel the rules coexist well, there's no reason to remove the old ones... ^_^

starfishpatkhoo avatar Mar 06 '25 01:03 starfishpatkhoo