feat: add separate highlight groups for word under cursor#252
Open
subev wants to merge 1 commit intoRRethy:masterfrom
Open
feat: add separate highlight groups for word under cursor#252subev wants to merge 1 commit intoRRethy:masterfrom
subev wants to merge 1 commit intoRRethy:masterfrom
Conversation
This change adds three new highlight groups for references under the cursor: - IlluminatedWordCursor (Text kind) - IlluminatedWordCursorRead (Read kind) - IlluminatedWordCursorWrite (Write kind) These groups default to linking to their non-cursor counterparts, ensuring backward compatibility. Users can customize these groups to visually distinguish the word under cursor from other references. The implementation: - Detects cursor position for each reference during highlighting - Applies cursor-specific highlight groups when appropriate - Maintains existing behavior when under_cursor config is false - Works with all providers (LSP, treesitter, regex)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds separate highlight groups for references under the cursor, allowing customization of the word under cursor independently from other references.
Motivation
The existing
under_cursorconfiguration option controls whether the word under cursor is highlighted, but does not provide a way to style it differently from other references. This change addresses that limitation by introducing cursor-specific highlight groups.Changes
IlluminatedWordCursor(Text kind)IlluminatedWordCursorRead(Read kind)IlluminatedWordCursorWrite(Write kind)Backward Compatibility
The change is fully backward compatible:
under_cursorconfig behavior is preservedImplementation Details
The implementation modifies
lua/illuminate/highlight.luato:is_under_cursorparameter in the highlighting functions