microsoft / vscode-css-languageservice

CSS, LESS & SCSS language service extracted from VSCode to be reused, e.g in the Monaco editor.
MIT License
316 stars 176 forks source link

✋ Ignore missing standard properties in contexts with vendor-specific pseudo-elements #303

Closed babakks closed 1 year ago

babakks commented 1 year ago

Fixes microsoft/vscode#164350

@aeschli Sorry that I'm not deeply familiar with CSS language/syntax and its features.

What's done in this PR is that when vendor-specific pseudo-element selectors (e.g., ::-webkit-slider-thumb) are encountered, we'd then avoid emitting linter errors/warnings about missing standard properties.

Take the cases below as examples (also included as test cases). Previously, the linter would ask to also include the standard appearance property. Now, the first two cases are fine.

/* Simple case (fine) */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
}

/* Nested rule sets (fine) */
input[type="range"]::-webkit-slider-thumb {
  color: black;
  & selector {
    -webkit-appearance: none;
  }
}

/* Prefix `-moz-` which is not in the context (error) */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  -moz-appearance: none;
}