-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Color completion non hex #166220
base: main
Are you sure you want to change the base?
Color completion non hex #166220
Conversation
It's risky to take the value provided by an extension and set it to CSS. It could be used to inject custom css into VS Code. |
@aeschli I figured so. I thought adding a separate type in CompletionItemKind might be a good way, something like NativeColor that is set when one of that list of colors is true, but that too would be set by the extension and would have the same problem as well. What do you mean by adding a Edit: Do you mean the extension should pass a hash color value always that it used to display the preview? So the extensions themselves are responsible for parsing their color string. |
This would be new API. I wanted to bring it up for discussion with @jrieken. |
Ah interesting! Let me know if I can help in any way when that comes around then, I suppose. |
I don't think it is ideal to assume it is a renderable color when something has completion kind With custom properties, :root {
--a: rgb(var(--red-channel) 0 127);
--b: color-mix(var(--one), var(--two));
--c: rgb(from var(--a) calc(r / 2) g b);
} These are all color values and should/could have completion kind |
Partial fix for #166197 in conjunction with (Add PR ID for CSS Extension here)
The current code cannot parse
hwb
color function, or native color strings and does not render the color preview in completion. I have added an extra condition that simply takes the fact that the extension determined it was a color and renders it directly. It works forhwb
and native colors now as long as the CSS Extension PR is merged.