Supporting different ghost_text highlight when selected#2147
Open
Suryansh-Dey wants to merge 3 commits intohrsh7th:mainfrom
Open
Supporting different ghost_text highlight when selected#2147Suryansh-Dey wants to merge 3 commits intohrsh7th:mainfrom
Suryansh-Dey wants to merge 3 commits intohrsh7th:mainfrom
Conversation
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.
Problem
I had a visual problem in ghost text when using rust-tools, since it does pre-selects sometimes and sometimes not when no preferred completing item is available.
Now with current ghost text view, I can't know if it's the item is from the first item in the table or a pre-selected one:
Consider following images:
not pre-selected
pre-selected
But the key difference is, in first instance, I need to select (Tab) then confirm (hit Enter) to get the ghost to real text while in second instance, I need hit enter stright up! Hitting Tab + Enter give wrong item!
To handle this, I need to keep checking the large completing menu to know if the ghost text item is pre-selected or not.
Hence ghost-text fails to achieve the actual moto i.e. accept completing without moving your eye off from the cursor.
Solution
I have made a slight change to allow to use different highlight group for not pre-selected ghost text (i.e. text due to first item in the menu) and pre-selected ghost text as you can see below
not pre-selected
pre-selected
Config used:
Change
M.experimental.ghost_texti.e. hl_group_selected (can be nil for backward compatibility) that applies on ghost-text when item is selected in completion menu.