TheRealSyler / vscode-sass-indented

Sass indented syntax support for VSCode
https://marketplace.visualstudio.com/items?itemName=Syler.sass-indented
Other
43 stars 9 forks source link

Two line comments in a .sass file #75

Closed babakfp closed 2 years ago

babakfp commented 3 years ago

Hi As you see, those two lines are considered as a comment. In the vscode, the second line isn't highlighted as a comment. It is shown as a normal text.

// This comment won't be included in the CSS.
  This is also commented out.
$something: something

From the SASS comments documentation, you can see how a comment can be written in a .sass file.

To Reproduce

  1. Create a .sass file. For example index.sass
  2. Write the code below:
    // This comment won't be included in the CSS.
    This is also commented out.

    Don't forget the tab for the second line.

Expected behavior Both lines considered as a comment and highlighted as a comment. like how you see the Github is highlighted it.

// This comment won't be included in the CSS.
  This is also commented out.
$something: something

Screenshots Capture

// This comment won't be included in the CSS.
  This is also commented out.
TheRealSyler commented 3 years ago

sorry that i didn't respond earlier, i will look into it, it might take a long time though.

babakfp commented 3 years ago

No worries. Thanks a lot.

RobertSandiford commented 2 years ago

I don't think is a very important issue - it's pretty weird syntax to begin with.

But I had a look at it to see if I could solve it

"begin": "\\",
"pattern": [
    {
        "begin": "(?<=//)",
        "end": "^(?!  |    |        |\t))",
        "patterns: [
            { "include": "#comment-tag" }
        ]
    }
],
"end": "(?<=(^(?!  |    |        |\t)))",

Begin with // Then create a sub-pattern Subpattern look-behinds to find the //, and start matching. Maybe this could just be . ? Subpattern continues until it finds a line not starting with indentation (2, 4, 8 spaces or tab) Main pattern does a lookbehind for the same thing. Perhaps this can just be . ?

Maybe issue here is getting the right indentation levels. Was thinking about capturing the indentation before the // and store it, I don't know if we can do this? Maybe it would also need a config where the indentation used is specified.

Seems like limitations could make it difficult.

Just posting in case anyone is interested in thinking about the problem