Ycm build-in in Jedi doesn't support diagnostics. I tried some ways, like YCM's LSP and Syntastics, but various problems appear when using other plugins.
For ycm, lsp, and pyright, it works well except hover. When I toggle on semantic completion and select words, a docstring displays in a popup with no problem. Only hover( <plug>(YCMHover) )
vimrc
...
let g:ycm_language_server += [
\ {
\ 'name': 'pyright',
\ 'filetypes': [ 'python' ],
\ 'cmdline': [ 'node', substitute(system('which pyright-langserver'), '\n', '', ''), '--stdio' ],
\ },
\ ]
...
global_extra_conf.py
def Settings(**kwargs):
return {
"ls": {
"python": {
"analysis": {
"useLibraryCodeForTypes": True,
"typeCheckingMode": "basic", # ["off", "basic", "strict"]
"logLevel": "Infomation",
},
"pythonPath": "/home/jizhou/venv/bin/python",
}
}
}
For ycm lsp and jedi-language-server, hover doesn't work too. But it can't solve virtualenv. global_extra_conf.py
def Settings(**kwargs):
return {
"ls": {
"diagnostic": {"enable": True},
"hover": {"enable": True},
"workspace": {
"environmentPath": "~/venv/bin/python"
},
}
}
For syntastics with pylint, syntastics plugin works well but performance and function problem usually appear. It can't check on insert mode exist. And if turn on check on open, it will slow down vim's starting up.
My question is:
Is there any way to make ycm not only complete the modules of the virtual environment, but also quickly check for errors like lsp without reducing the performance of vim, and at the same time ensure the normal operation of the hover function?
At present, my solution is checking with syntastic with flake8 in virtualenv and completing with built-in Jedi. Note that a Python linter must be available in virtualenv, which means the package globally installed by pacman is invalid.
My view of syntastic is:
Moreover, I found that syntastic will report an error when close a split buffer. I forked and fixed this bug by add a
silent, which can be install by