You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, the linting rule checks for a # at the beginning of a SimpleSelector node. , this is a false positive because in this case the first (and only) descendent of the first identifier in the SimpleSelector is an Interpolation.
I would think that the linter could check for this and not add the Marker if the # is coming from an Interpolation. This is what I've done on my fork and have had success running some new tests to check this.
As I'm not sure that the structure of the node tree will always be consistent with what I saw, so I did this by checking for an Interpolation at the first child of each node down the tree, rather than assuming that if an Interpolation node exists, it would always be the nth grandchild of the SimpleSelector.
However, if you're saying that this is rather a problem with the parser, rather than the linter, then I'm not really sure how to tackle this. I'd like to make a PR for this so please let me know what strategy you'd like to take for this.
Also, while looking through this I discovered that the SimpleSelector is checked as a whole as an ID selector, that is to say, only the first component of the SimpleSelector is checked for ID's
#id {} // This will raise a warning about an id selectordiv#id {} // This will not raise a warning, as the id selector isn't at the front
Thanks @aNickzz for looking at this. Yes, I think you got this right, the linter check for # is too simple.
Instead of looking for a interpolation, what about looking for a IdentifierSelector node inside the SimpleSelector?
That would then fix the second point (no warning on div#id {}) as well.
Activity
[-]SCSS Linter update for variables in #{}[/-][+][scss] linter update for variables in #{}[/+]octref commentedon Oct 22, 2019
Seems already fixed.
OldStarchy commentedon Oct 23, 2019
Running the latest build of insiders and this is definitely still happening
Version: 1.40.0-insider (user setup)
Commit: c58aaab
Date: 2019-10-22T05:27:32.053Z
Electron: 6.0.12
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362
octref commentedon Oct 23, 2019
@aNickzz I can't repro from the original piece. Please open a new issue with reproducible steps.
roblourens commentedon Oct 29, 2019
I also see this, I suggest that we reopen this and close the new issue to keep the history
5 remaining items
OldStarchy commentedon Mar 3, 2020
Are you sure this should be labelled with
feature-requestinstead of abug? Maybe it would get a bit more attention with the correct label.OldStarchy commentedon Nov 11, 2020
For my own reference, here's the source for this rule: https://github.com/microsoft/vscode-css-languageservice/blob/716292720c09f444167fd5528bcd4e6d1c6cc5db/src/services/lint.ts#L251
aeschli commentedon Nov 11, 2020
It's a bug in the parser.
OldStarchy commentedon Nov 25, 2020
So, the linting rule checks for a
#at the beginning of a SimpleSelector node. , this is a false positive because in this case the first (and only) descendent of the first identifier in the SimpleSelector is an Interpolation.I would think that the linter could check for this and not add the Marker if the
#is coming from an Interpolation. This is what I've done on my fork and have had success running some new tests to check this.As I'm not sure that the structure of the node tree will always be consistent with what I saw, so I did this by checking for an Interpolation at the first child of each node down the tree, rather than assuming that if an Interpolation node exists, it would always be the nth grandchild of the SimpleSelector.
However, if you're saying that this is rather a problem with the parser, rather than the linter, then I'm not really sure how to tackle this. I'd like to make a PR for this so please let me know what strategy you'd like to take for this.
Also, while looking through this I discovered that the SimpleSelector is checked as a whole as an ID selector, that is to say, only the first component of the SimpleSelector is checked for ID's
Though that should be in its own issue I guess.
aeschli commentedon Nov 25, 2020
Thanks @aNickzz for looking at this. Yes, I think you got this right, the linter check for
#is too simple.Instead of looking for a interpolation, what about looking for a IdentifierSelector node inside the SimpleSelector?
That would then fix the second point (no warning on
div#id {}) as well.