Skip to content

Show inline previews for LSP document colors #32816

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

Merged
merged 26 commits into from
Jun 17, 2025
Merged

Conversation

SomeoneToIgnore
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore commented Jun 16, 2025

colors.mov

Closes #4678

Also adds the code to support textDocument/colorPresentation counterpart that serves as a resolve mechanism for the document colors.
The resolve itself is not run though, and the editor does not accommodate color presentations in the editor yet — until a well described use case is provided.

Use lsp_document_colors editor settings to alter the presentation and turn the feature off.

Release Notes:

  • Start showing inline previews for LSP document colors

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jun 16, 2025
@domi413
Copy link

domi413 commented Jun 16, 2025

Hey, what do you think about using black or white as foreground color when the background option is enabled.

example:
image

@SomeoneToIgnore
Copy link
Contributor Author

I think of skipping this entirely, as for this we have to chunk the text differently, based on these LSP data mixins — that is quite a task on its own.

@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) June 17, 2025 13:31
@SomeoneToIgnore SomeoneToIgnore merged commit f469575 into main Jun 17, 2025
21 checks passed
@SomeoneToIgnore SomeoneToIgnore deleted the kb/document-colors branch June 17, 2025 13:46
@ai
Copy link
Contributor

ai commented Jun 17, 2025

Do we support oklch() here? Maybe we will need another issue to add support of modern color formats.

@SomeoneToIgnore
Copy link
Contributor Author

This is an initial version with RGBA support only for now, as the only thing that protocol defines.

@ai
Copy link
Contributor

ai commented Jun 17, 2025

I added an discussion about oklch() support #32874

@ancashoria
Copy link

Can't wait for this to land. Thank you for implementing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show inline previews for rgb hex color strings (LSP textDocument/documentColor)
5 participants