-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 swatches ( 🟩 green 🟥 #ffaaaa ) #12308
base: master
Are you sure you want to change the base?
Color swatches ( 🟩 green 🟥 #ffaaaa ) #12308
Conversation
textDocument/documentColor
textDocument/documentColor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of this is good but the decorations need some changes for the first change see my comment for the second problem I am not sure how to solve it but because of how decorations are done being attached to an actual char index when softwrap is at the same char index as the color indicator then the softwrap indicator is highlighted instead see the attached screenshot
something to note here for interested parties the reason that we decided to go with decorations for now is that InlineAnnotations are styled by using theme variables(this is the Highlight newtype in the code which is an index into one of the theme styles) but for this feature we need to be able to give arbitrary styles to the text. I am sure there are other ways this could have been done but this seemed like the least invasive way to achieve this though it does still suffer a bit cause we cant differintiate from if this is the color indicator or the softwrap indicator unless we compare the grapheme. |
23abef8
to
5f59c19
Compare
Not totally sure why but after using your latest commit for some time I noticed that the colors take a long time to update. Or they just don't update at all. For now I've reverted it |
Ah good to know, sorry about that I'll have a better version just have been out all day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some suggestions.
Co-authored-by: TornaxO7 <tornax@proton.me>
0eb1e4e
to
54ff7a5
Compare
efca472
to
d120a35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5b205c6
to
67552f6
Compare
This PR adds a feature where a colorful square appears next to colors
We're building on top of the existing LSP by Helix by adding support for the
textDocument/documentColor
language server protocol method.It's so nice, because we aren't actually hard-coding anything at all. This is not depedant on anything specific like CSS or tailwind, but rather a general implementations that works for any server which implements it. Since Helix already implements most of the LSP, we are building on top of it here.
The advantage here is that we have a lot more flexibility. For example, a popular neovim plugin that adds this functionality is nvchad-colorizer which hard-codes all the values which means if you define custom colors in your config they won't be shown. Here we won't have that problem
Big thank you to @gabydd for showing me how to apply custom
Style
s toInlineAnnotation
:)Most of these changes were based off existing work done by @poliorcetics with the Inlay Hints.
Closes #1115