-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Color swatches ( 🟩 green 🟥 #ffaaaa ) #12308
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
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.
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
`patchy` is a tool which makes it easy to declaratively manage personal forks by automatically merging pull requests. Check it out here: https://github.com/NikitaRevenco/patchy
889ae97
to
5a0a773
Compare
@the-mikedavis I finally fixed this PR, previously it was very hacky and it would also color the wrap indicator. Now, that bug is gone. it's ready to be reviewed now (I realise I should've put it as a draft earlier) |
Since the handler type didn't have any extra information on it there's no need for a wrapper, we can use the sender directly. This also drops the unnecessary trigger in the completion code.
50ms is too low, it would trigger for every keypress. Instead we want to query for these pretty lazily.
The byte-wise representation should be opaque even in the tests.
I found a glitch: #TableOfContents {
background-color: #e5e7eb;
font-size: 0.875rem; /* This is equivalent to Tailwind's text-sm, needs to change with mobile */
line-height: 1.25rem; /* Tailwind adjusts line-height for better spacing, needs to change with mobile */
} Insert the cursor right in front of the color block and enter insert mode, autocomplete appears, go through the colors, you will get this: |
Hmm this is weird. Likely the positions of the color swatches aren't being updated when doing the auto complete transaction |
sorry for interrupting, but here i've made a tiny language server that sends cc @DoctorRyner |
wow, that is really cool! Thanks for sharing. I like how simple it is, makes it a good starting point for learning how to create your own language server |
thanks for the kind words! i didn't think of making it an example on how to write a language server... which is ironic considering how i struggled because of the bad example code in i guess i will add comments to my code to make it more readable and understandable for someone who tries to write their own langserver! i am also planning to improve the regex situation and probably make some cli arguments so it'll work perfectly in different scenarios |
Wow, this is exactly what the world needed, you are a hero. And we don't deserve you |
https://build.opensuse.org/request/show/1293872 by user alessio.biancalana + anag_factory - Update to version 25.07: Features: * Add a picker which explores directories ([#11285](helix-editor/helix#11285), [d4aed40](helix-editor/helix@d4aed40)) * Allow cycling through multiple LSP Hover responses with `A-n`/`A-p` ([#10122](helix-editor/helix#10122), [2367b20](helix-editor/helix@2367b20)) * Add support for incomplete LSP completions ([5c1f3f8](helix-editor/helix@5c1f3f8)) * Add support for EditorConfig ([#13056](helix-editor/helix#13056), [#13443](helix-editor/helix#13443)) * Add support for LSP document colors ([#12308](helix-editor/helix#12308), [d43de14](https://github.c
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
Closes #1115