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] Syntax Error when !important as arguments of Method #57

Closed
liuderchi opened this issue Dec 14, 2017 · 2 comments
Closed

[SCSS] Syntax Error when !important as arguments of Method #57

liuderchi opened this issue Dec 14, 2017 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@liuderchi
Copy link

VSCode underlines error at !important syntax when it's argument of method if:

@function get-mixin-important-var($important) {
  @return if($important, !important, null);
//                      ~~~ Error: expression expected
}
@mixin heading($important: false) {
  $i: get-mixin-important-var($important);
  font-family: "arial" $i;
}

.heading {
  @include heading(true);
}

However this snippet is valid when pasted to SASS Online Editor (https://www.sassmeister.com/) with option

  • Sass compiler: v3.3.14
  • Syntax: SCSS

And it's compiled to valid CSS:

.heading {
  font-family: "arial" !important;
}
@octref
Copy link
Contributor

octref commented Jan 17, 2018

@aeschli !important is not an expression according to CSS spec. Wondering what would be the correct way to support it? I'm thinking about special casing for the if() function to allow more than just expression in its args.

@aeschli
Copy link
Contributor

aeschli commented Jan 18, 2018

@octref Looks like the SCSS parser accept it as a term, even if it results in invalid CSS.
https://github.com/Microsoft/vscode-css-languageservice/blob/0825c4593166ca6aa2b01f9a8817c142d845ca61/src/parser/scssParser.ts#L155 is the place it needs to go.
Hope that doesn't cause issues with the regular usages of !important. We should make sure the SCSS parser tests also contain some of these.

@octref octref added the feature-request Request for new features or functionality label Jan 24, 2018
aeschli added a commit that referenced this issue Jan 24, 2018
Handle !important as a term in scss. Fix #57
@aeschli aeschli added this to the January 2018 milestone Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants