Skip to content
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

Semantic token's names with unusual characters do not have corresponding highlighting groups #4392

Closed
Iamnotagenius opened this issue Nov 24, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Iamnotagenius
Copy link
Contributor

Result from CocInfo

## versions

vim version: NVIM v0.8.1
node version: v19.1.0
coc.nvim version: 0.0.82-0bbf935e 2022-11-24 23:17:31 +0800
coc.nvim directory: /home/iamnotagenius/Sources/coc.nvim
term: alacritty
platform: linux

## Log of coc.nvim

2022-11-25T00:36:57.138 INFO (pid:511984) [configurations] - Add folder configuration from cwd: /home/iamnotagenius/Sources/coc.nvim/.vim/coc-settings.json
2022-11-25T00:36:57.523 INFO (pid:511984) [extension:coc-git] - Looking for git in: git
2022-11-25T00:36:57.561 INFO (pid:511984) [extension:coc-discord-rpc] - coc-discord-rpc is activated!
2022-11-25T00:36:57.571 INFO (pid:511984) [plugin] - coc.nvim initialized with node: v19.1.0 after 477
2022-11-25T00:36:57.575 INFO (pid:511984) [services] - LanguageClient csharp state change: stopped => starting
2022-11-25T00:36:57.584 INFO (pid:511984) [language-client-index] - Language server "languageserver.csharp" started with 512011
2022-11-25T00:36:57.776 INFO (pid:511984) [extension:coc-discord-rpc] - Connected to Discord Gateway
2022-11-25T00:37:03.092 INFO (pid:511984) [services] - LanguageClient csharp state change: starting => running
2022-11-25T00:37:03.095 INFO (pid:511984) [services] - service languageserver.csharp started
2022-11-25T00:37:08.392 INFO (pid:511984) [attach] - Request action: commandList [ 'sem', 'CocCommand sem', 14 ]
2022-11-25T00:37:09.371 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.checkCurrent' ]
2022-11-25T00:37:26.543 INFO (pid:511984) [attach] - Request action: commandList [ 'semanticTokens.i', 'CocCommand semanticTokens.i', 27 ]
2022-11-25T00:37:27.003 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:30.493 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:33.603 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:36.624 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:39.894 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:46.655 INFO (pid:511984) [attach] - receive notification: runCommand [ 'semanticTokens.inspect' ]
2022-11-25T00:37:51.645 INFO (pid:511984) [attach] - receive notification: showInfo []

Describe the bug

First I have to say this is a bug related to a specific language server, omnisharp-roslyn in my case. This language server provides tokens with names containing spaces and dashes, so when I run :CocCommand semanticTokens.inspect on class name, the type of token is not just 'class', but 'class name'. Another example for this is 'throw' keyword has a type 'keyword - control'. Tokens with these types does not have highlighting group attached to them.
Other token types without invalid characters are working as expected.

In case this is needed, here is output of :echo coc#util#semantic_hlgroups():

['CocSemNamespace', 'CocSemVariable', 'CocSemProperty', 'CocSemParameter', 'CocSemTypeParameter', 'CocSemNumber', 'CocSemFunction', 'CocSemKeyword', 'CocSemEvent', 'CocSemMo
difier', 'CocSemMacro', 'CocSemDeprecated', 'CocSemClass', 'CocSemDecorator', 'CocSemOperator', 'CocSemStruct', 'CocSemRegexp', 'CocSemMethod', 'CocSemComment', 'CocSemEnum'
, 'CocSemInterface', 'CocSemType', 'CocSemEnumMember', 'CocSemBoolean', 'CocSemString', 'CocSemIdentifier']

My lsp config:

"languageserver": {
    "csharp": {
        "command": "omnisharp",
        "args": ["-lsp", "-e", "utf-8"],
        "filetypes": ["cs"]
    }
}

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=/path/to/coc.nvim
    filetype plugin indent on
    syntax on
    set hidden
  • Start (neo)vim with command: vim -u mini.vim SomeClass.cs

  • Type :CocCommand semanticTokens.checkCurrent
    Vim would complain about invalid characters:
    E5248: Invalid character in group name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants