microsoft / vscode-css-languageservice

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

Add aspect-ratio as default valid property #317

Closed karlhorky closed 1 year ago

karlhorky commented 1 year ago

Hi, thanks for this repo 🙌 (and all of the other packages and projects that make up the Microsoft developer tooling ecosystem). Really amazing.

A quick PR to avoid the problem that aspect-ratio is not recognized as a valid property via typescript-styled-plugin and vscode-styled-components:

Screenshot 2022-11-21 at 14 05 28

Coming over from:

aspect-ratio docs: https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio

cc @mjbvz @aeschli

karlhorky commented 1 year ago

Or should this be updated over in microsoft/vscode-custom-data/web-data, eg here?

https://github.com/microsoft/vscode-custom-data/blob/main/web-data/css/css-schema.xml

Seems like this file is being used to generate data for...something here:

https://github.com/microsoft/vscode-custom-data/blob/fce2045d6f693c12bf0848ec3602fc433f70d7da/web-data/css/generateData.js#L327-L369

cc @addiment

addiment commented 1 year ago

I'm no expert here (I hardly understand VS Code's architecture, I just happened to have a similar-ish problem once) but I think(?) that vscode-custom-data is the right place. This is with React, so maybe it's a little different, but I think you're on the right track.

aeschli commented 1 year ago

Yes, the update has to happen in https://github.com/microsoft/vscode-custom-data. In fact the latest version (@vscode/web-custom-data@0.4.4)there has aspect-ratio, so all we need it to adopt it..

(Run npm run update-data)

karlhorky commented 1 year ago

In fact the latest version (@vscode/web-custom-data@0.4.4)there has aspect-ratio, so all we need it to adopt it..

Oh that's great! So this npm run update-data needs to be run in microsoft/vscode-css-languageservice, and then the result committed 👍

aeschli commented 1 year ago

https://github.com/microsoft/vscode-css-languageservice/pull/319 updated all dependencies, including vscode-custom-data

karlhorky commented 1 year ago

Amazing, thanks so much @aeschli ! 🙌

karlhorky commented 1 year ago

Copying part of my comment in styled-components/typescript-styled-plugin over here for visibility:

Seems like this is actually fixed in the normal release version of styled-components.vscode-styled-components@1.7.5 already, when using VS Code 1.74.0 (the error + warning below is actually a real typo, just to test that the error checking is working):

Screenshot 2022-12-09 at 18 06 40
karlhorky commented 1 year ago

Ran into the problem with a different CSS property just now - accent-color doesn't appear to work, in either the normal styled-components.vscode-styled-components@1.7.5 Release version or the styled-components.vscode-styled-components@1.7.6 Pre-Release version (see below).

Maybe the property is too new and not yet in the vscode-css-languageservice data?

The error message is "Unknown property: 'accent-color".

Screenshot 2022-12-14 at 16 39 17 Screenshot 2022-12-14 at 16 38 50