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

[scss] Error when parsing container queries with interpolation #197744

Closed
lauslim12 opened this issue Nov 8, 2023 · 3 comments · Fixed by microsoft/vscode-css-languageservice#371
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling verified Verification succeeded
Milestone

Comments

@lauslim12
Copy link

Does this issue occur when all extensions are disabled?: Yes.

  • VS Code Version: 1.84.1
  • OS Version: MacOS Sonoma 14.1

Steps to Reproduce:

I think this is potentially an issue with Visual Studio Code's CSS Language Service. Please let me know if I'm supposed to make the issue there instead of here!

As described in #170589 (comment), it seems that the CSS Language Service is unable to parse container queries in SCSS files. It works very well with vanilla CSS and Less, but it's unable to do the same with SCSS files.

For additional context, I have provided a minimum reproducible example in this repository.

I hope the example helps to clear things up a bit more clearly! Thank you so much for your help!

@aeschli
Copy link
Contributor

aeschli commented Nov 8, 2023

$minWidth: 400px;
@container (min-width: #{$minWidth}) {
  .scss-interpolation {
    background-color: deepskyblue;
    line-height: 10cqh;
  }
}

@aeschli aeschli changed the title [scss] Error when parsing Container Queries [scss] Error when parsing container queries with interpolation Nov 8, 2023
@aeschli aeschli self-assigned this Nov 8, 2023
@aeschli aeschli added css-less-scss Issues and items concerning CSS,Less,SCSS styling bug Issue identified by VS Code Team member as probable bug labels Nov 8, 2023
@aeschli aeschli added this to the Backlog milestone Nov 8, 2023
@ataylor32
Copy link

ataylor32 commented Nov 8, 2023

I tried out the example repository provided by @lauslim12 using VS Code 1.84.1 and it looks like the problem is always present, not just with interpolation. Have a look at this:

.scss-text {
  color: yellow;
  font-size: 3cqw;
}

The semicolon right after 3cqw has a squiggly red underline. Hovering over that semicolon shows the error message:

expression expected scss(css-expressionexpected)

@hnm938
Copy link

hnm938 commented Nov 11, 2023

I tried out the example repository provided by @lauslim12 using VS Code 1.84.1 and it looks like the problem is always present, not just with interpolation. Have a look at this:

.scss-text {
  color: yellow;
  font-size: 3cqw;
}

The semicolon right after 3cqw has a squiggly red underline. Hovering over that semicolon shows the error message:

expression expected scss(css-expressionexpected)

I had this problem as well, I'm pretty sure it's a problem with either vscode or node sass. Either way I found a simple work-around to get rid of the errors since they are really annoying and prevent code collapsing.

Just add this to your vscode settings json (.vscode/settings.json) "scss.validate": false

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants