Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested scss is fails to parse correctly. #46

Open
jmurphy-dev opened this issue Apr 21, 2022 · 5 comments
Open

Nested scss is fails to parse correctly. #46

jmurphy-dev opened this issue Apr 21, 2022 · 5 comments
Labels
bug Something isn't working syntax Something related with syntax

Comments

@jmurphy-dev
Copy link

It seems like this subsyntax fails to match for nested scss.

<subsyntax name="scss">
	<cut-off>
		<expression>(?=&lt;/(?i:style)\b)</expression>
	</cut-off>
</subsyntax>						

here is an example from a .sass file of nested selectors highlighting correctly

Screen Shot 2022-04-21 at 11 56 40 AM

here is the most basic pathological example in a .vue file:
Screen Shot 2022-04-21 at 11 59 35 AM

I tried changing the subsyntax to a subscopes but either I dont know how to correctly make changes to installed plugins or this doesn't fix the problem.

<subscopes repeat="true">
        <include syntax="scss" />
</subscopes>
@tommasongr
Copy link
Owner

Hi there!

Oh gosh! Thanks for the catch!
I looked at it and it was worst than you initially find out... Apparently all the not standard syntaxes both for css and javascript were ignored all together. It was a matter of the order in which the alternative scopes were specified in the syntax. I'm so
sorry for this... I usually stick to the standard css and js and I have never come across this.

CleanShot 2022-04-21 at 21 58 29@2x

I'll push the fix ASAP

@tommasongr tommasongr added bug Something isn't working syntax Something related with syntax labels Apr 21, 2022
@jmurphy-dev
Copy link
Author

Thanks man, I use the tool everyday, really nice work.

@tommasongr
Copy link
Owner

Just pushed v5.4 with the fix! Let me know if it works

By the way stay tuned for a major update in the coming days. I'm looking at leaving Vetur for the new Volar language server.

@jmurphy-dev
Copy link
Author

@tommasongr Thanks, nested class selectors are working properly now, however it looks like there is still some issues parsing at-rules.

Here is a test snippet.

.icon-grid {
  @media (max-width: calc(#{$lg} - 1px)) {
    grid-template-columns: 1fr;
  }
  .grid-item {

    @media (max-width: calc(#{$lg} - 1px)) {
      padding-bottom: 5.7rem;
    }
    h4 {
      @media (max-width: calc(#{$lg} - 1px)) {
        padding: 2rem 0 0.6rem;
      }
    }

    img {
      @media (max-width: calc(#{$lg} - 1px)) {
        height: 7.5rem;
      }
    }
  }
}

in a .vue file:

Screen Shot 2022-04-22 at 11 14 11 AM

in a .scss file:

Screen Shot 2022-04-22 at 11 14 59 AM

Let me know if I can provide any additional information.

@tommasongr tommasongr reopened this Apr 25, 2022
@chriscalo
Copy link

chriscalo commented Apr 8, 2024

I've noticed that <style lang="scss"> blocks seem to parse as CSS. Meaning, as long as you use CSS syntax, everything syntax highlights correctly, but as soon as you use SCSS-specific syntax, everything breaks.

CleanShot 2024-04-07 at 21 17 46@2x

Another clue is that if you use the keyboard shortcut to add a comment (Cmd /), it uses CSS comments (/* */) instead of SCSS comments (//).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working syntax Something related with syntax
Projects
None yet
Development

No branches or pull requests

3 participants