prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.07k stars 303 forks source link

No semantic highlight with pylsp #1530

Closed kalium222 closed 4 months ago

kalium222 commented 6 months ago

Hello, I got some problem when working with python environment. Here is how I config relative plugins:

Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'  

" register clangd
if executable('clangd')
    au User lsp_setup call lsp#register_server({
    \ 'name': 'clangd',
    \ 'cmd': {server_info->['clangd', '-background-index']},
    \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
    \ })
endif

" register pylsp
if executable('pylsp')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pylsp',
        \ 'cmd': {server_info->['pylsp']},
        \ 'allowlist': ['python'],
        \ })
endif   

" enable sementic highlighting
let g:lsp_semantic_enabled = 1

And I get pylsp by running pip install "python-lsp-server[all]", which should be OK from here.

And here is a comparison with semantic highlight for cpp with clangd.

kalium222 commented 6 months ago

Screenshot from 2024-01-27 01-18-14

kalium222 commented 6 months ago

How to solve this? Thanks.

prabirshrestha commented 6 months ago

You would want to look at the logs and see if it is enabled or not. Instructions in readme. Feel free to share the logs if you are still having issues.

kalium222 commented 5 months ago

The non-verbose log of these two files were similar, so i will show you the verbose version. They are quite long. In the log for python, the researching result for "semantic" is two, which is much less than that in log for cpp. [Uploading py_v.log…]()

kalium222 commented 5 months ago

In comparison, it is log for cpp file: cpp_v.log

kalium222 commented 4 months ago

in fact i find that the output of :LspSemanticTokenModifer is []. Doesn't pylsp support for semantic tokens?