-
-
Notifications
You must be signed in to change notification settings - Fork 956
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
Cannot distinguish between semantic token types and modifiers with the same name #4659
Comments
So that's basically removing the rule 2 Line 3330 in edcc376
To me, removing this support and always requiring a token type in hlgroups sound reasonable, since token type is more primary while modifiers are secondary and kinda optional. But not sure how many ones are relying on this feature. |
We should keep this,
|
Sorry I don't get it. What do you mean by "don't limit default groups must have the highlight exist"? Making default groups non-existent?
If there are multiple highlights, we still need to define priorities yeah? We cannot apply all colors to a single token. My basic expectation is:
Thus my suggestion is to either remove rule 2, or swap the priority of rule 2&3. |
In current implementation, coc.nvim defined default groups in vim file as you see (CocSemKeyword/CocSemFunction etc). After LS returns tokens, coc.nvim creates hi group with rules 1/2/3, then checks the group exists in highlightGroups or not, only use it as found in default groups, otherwise, no hi group returns for the token. Removing this limit, a hi group can be created even if not defined, user can define the missing group. •
New rules:
|
CocSem + type CocSem + modifier CocSem + modifier + type The highlight group didn't need to be defined first related #4659
My issue is not about user customization. Sending all groups instead of one does NOT help here. It's only causing more unnecessary computation and updates.
This sill collides then type==modifier. I only want to define for type=macro, NOT modifier=macro. What should I write? |
@oxalica sorry but I was completely forcing my attention on the default hi groups limitation, and totally ignored the priority issue you already pointed out. I checked nvim-lsp's rules, how about this?
The My preview fix removed the limitation to allow to create hi groups, one or multiple signs for one token. Yes, this may bring more updating. |
CocSem + Type + type CocSem + Mod + modifier CocSem + TypeMod + type + modifier The highlight group didn't need to be defined first related #4659
This should work. 👍 Just that it breaks users' current configurations. If coc.nvim allows such a breaking change, it's okay to me. |
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
This bring some flicking on
step 4 is the issue: there will still be new added highlights even the document is not modified, this makes the flicking. Checking on the diffHighlights logic. |
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
What's the status of this issue? I saw 9ae8651 is in |
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
@oxalica #4667 brought flicking issue #4659 (comment), maybe this is not a good solution or needs more improvement. sorry for the slow response. |
I don't really think it's blocking hlgroup renaming. For this particular issue, I just want I guess the flicking issue is about 0cb6074#diff-610be46d48af22f1bc73dff66ee66e288671c57f1130353bc88d3fc65379eadbR241 which add multiple highlights on the same token. Will it work if we keep the old code ( |
I have a new thought:
back to your code, struct goes to #4667 has updated, in my tests, no more flicking. I'm digging vscode source to find how vscode handle this... |
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
This comment was marked as outdated.
This comment was marked as outdated.
Thanks for the update.
I personally think
What I want is |
|
No. I DO NOT want the |
@oxalica fixed |
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659
* feat(semanticTokens)!: token highlight groups CocSemType + type CocSemMod + modifier CocSemTypeMod + type + modifier The highlight group didn't need to be defined first related #4659 * feat(semanticTokens)!: token highlight groups CocSemType + type CocSemTypeMod + type + modifier * fix(highlight): check hlexists for vim * feat(semanticTokens): rm modifiers in checkCurrent modifiers are added to one token type, we can't list them directly * feat(semanticTokens): follow tree-sitter's hi name nvim-treesitter/nvim-treesitter#5895 nvim-treesitter/nvim-treesitter@1ae9b0e * feat(highlight): coc_highlight_maximum_count 200
Result from CocInfo
Describe the bug
See: rust-lang/rust-analyzer#14795 (comment)
rust-analyzer recently added a
macro
modifier to all tokens inside macro invocations, which cause them to be all displayed as the same color of the macro itself, becauseCocSemMacro
is defined by default. But this name is originally for token typemacro
, not modifiermacro
.Reproduce the bug
Install coc-rust-analyzer and a recent rust-analyzer like 2023-05-22 or later
Create a rust library project with the following content in
lib.rs
CocSemMacro
highlighting. But should be colored asCocSemKeyword
andCocSemStruct
.Output of
CocCommand semanticTokens.inspect
on thepub
token inside macro invocation.The text was updated successfully, but these errors were encountered: