Skip to content
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 only displays color squares for hex variables #166197

Closed
allan2 opened this issue Nov 12, 2022 · 2 comments
Closed

Color completion only displays color squares for hex variables #166197

allan2 opened this issue Nov 12, 2022 · 2 comments
Assignees

Comments

@allan2
Copy link

allan2 commented Nov 12, 2022

This issue has appeared before in #63062 and #68269.

When defining variables, color squares appear for all variables sources (hex, RGB, RGBA, string).
When using color completion, only hex gets color squares in the autocomplete option.

mixed-var
hex-only

@GauravB159
Copy link
Contributor

I have been checking this out and have found a couple issues. Part of this can be fixed in microsoft/vscode-css-languageservice

image

File: cssCompletion.ts

This function only tests for built-in colors and hex values. Adding another part to it that checks for color functions fixes the two color functions.

Making this change fixed $rgb and $rgba.

However, another fix needs to be made for $string and also a possible variable called $hwb that uses the hwb color function.

image

File: suggestWidgetRenderer.ts

This function only adds the preview color for elements that have rgb, hsl, or hex codes. It ignores all other values. I am pushing a potential fix that adds an extra condition when the Completion Item Kind is color and the color cannot be extracted using Regex. This would handle cases such as the internal color issue because the CSS Extension can easily determine if the color is an internal color but the main code cannot.

@aeschli
Copy link
Contributor

aeschli commented Dec 5, 2022

Marking this as dup of microsoft/vscode-css-languageservice#314

@aeschli aeschli closed this as completed Dec 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants