-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Allow contributions of custom CSS properties to CSS extension #47775
Comments
@aeschli Actually today we already have a config |
Isn't this setting ignores all properties? For instance, this will pass: body {
teapot: yes;
} |
@usernamehw My worry is that we are offering too much surface area for linting settings, when all we offer is a subset of https://github.com/CSSLint/csslint and now we are forking with some more options... When we have MDN data for properties it'll actually solve all three existing "unknown properties" issues:
|
Then this issue is not really needed. |
Yea looking for @aeschli’s input |
@octref yes, you can use "less.lint.unknownProperties" to turn off all validation warnings. |
@aeschli The MDN data contains experimental properties such as I suggest that we pull in the MDN data, see if that addresses people's complaint
If the need arises we can always add that. But I think if someone is using a property not known on MDN (as compared to now known on our outdated css-schema), it's fair we output a warning. |
Would it be possible to fix the type in the title of this issue? As it is, it doesn't show up in a search for "unknown property". It would help those of us searching for this exact issue know it is being worked on. Thanks! |
@shockthetoast Done, thanks! |
This is no longer an issue — using latest data from MDN so we don't have "unknown properties" any more. |
Hi, I'm searching for a way to add custom properties to css.lint, since in our project (Apache Royale) we have custom properties related only to our project, since I'm using VSCode, I'd love to have some way to add custom properties and even create some extension for it. Thanks for any advice on this. |
I also think we should have this for custom properties. |
Great, I think so, since CSS is open its capabilities and used in many new ways that can't be controlled. I expect that we can remove the css lint error configuring in some way a config file. Even add this config file to extensions like AS3 & MXML Extension that already manages Apache Royale projects so we can catch error typing this kind of custom css properties. Thanks! |
I think this'd be where the custom properties would be injected?: https://github.com/Microsoft/vscode-css-languageservice/blob/5d43b341a3b149bcabc3e178ada73ef0b876f2f3/src/services/languageFacts.ts#L777 |
So I've gotten a decent way through making this work, but I can't figure out the correct way to pass the custom property configuration into the place it's needed. I see this line elsewhere in the The docs say to use I suppose it's also important to note that I added the configuration to the Any guidance on how I should pass the user's configuration into |
Hi connor, thanks for working on this. Just to understand the progress. Are you implementing some kind of property file where we can add the custom css properties we want to be recognized by vscode lint, and get rid of lint errors? (event get code-intelligence for those custom properties defined in that property file? Thanks! |
@carlosrovira Right now it's a WIP so it's hard-coded until I can figure out how to pass the configuration into it, but it looks like this: Currently the description isn't able to be customized, it's just set as "Custom property", but that can probably be changed relatively easily if you'd really like to be able to do that. The properties would be defined in a VS Code {
"css.customProperties": [
"custom-property-name",
"another-custom-property",
"custom-property-three"
]
} |
@connorshea It would be better start working after discussing with me or @aeschli. I don't think we'll go with that approach (more likely going with the direction of the Markdown Extension API https://code.visualstudio.com/docs/extensionAPI/api-markdown), specify a JSON format and add contribution points. This issue is only for adding a setting to make VS Code not complain about unknown properties. |
Hi @octref, Thanks. |
Fair enough, that's my bad :)
A setting to make VS Code not complain about unknown properties already exists as you mentioned above ( Also, just to clarify, a "CSS Extension API" would be preferable because it would allow extensions to add CSS properties, or am I missing other reasons? |
Oops, the title tricked me, updated.
As compared to saving everything in the project config, I think putting all the custom CSS property definitions in a JSON and allow a setting/contribution to refer to it would be better. This keeps clutter away from workspace config and allows others to auto-generate the JSON file. |
@octref I'm not against allowing users to define sets of properties in a separate file, but IMO a simple user setting is a good start/ The css language service doesn't deal with files anyways, it's just a library, also to be used in Monaco. All validation configuration comes in through config objects, so @Connormiha The validation happens here: Here you would say, only report error of not a known property or not in the list. |
I expect the AS3 & MXML(http://as3mxml.com/) extension could add a file so we have our custom properties manages directly by the extension that provide all the language support. Thanks |
I added a new setting that allows specifying 'valid' properties that are not verified. |
FYI: #64164 |
The motivation is that today, css Language Service would suggest that you have invalid properties.
microsoft/vscode-css-languageservice#68
Although by adopting MDN data we should solve the problem, however if new properties come up CSS LS can still fall behind.
We should provide a config
[css/less/scss].validate.acceptedProperties
or something similar that stops CSS LS from complaining about "unknown property".The text was updated successfully, but these errors were encountered: