microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.21k stars 28.86k forks source link

[scss] selector specificity works wrong with nested selectors #63200

Open Aliaksei-Martsinkevich opened 5 years ago

Aliaksei-Martsinkevich commented 5 years ago

Issue Type: Bug

Css specifity calculator doesn't respect nested selectors or selectors with &.

#id {} /* (1, 0, 0) */

#id div {} /* (1, 0, 1) */
#id {
  div { /* (0, 0, 1) */
  }
}

.block{ /* (0, 1, 0) */
  &__element { /* (0, 0, 0) */
  }
}

Reproduced without any extensions

VS Code version: Code 1.29.0 (5f24c93878bd4bc645a4a17c620e2487b11005f9, 2018-11-12T07:47:15.448Z) OS version: Windows_NT x64 10.0.17134

vscodebot[bot] commented 5 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

rsgranne commented 4 days ago

Any further work on this? It’s still broken & VS Code still doesn’t calculate specificity correctly when I use CSS nesting. Instead, it only sees the current selector & ignores parents & ancestors when calculating specificity.