neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.76k stars 2.09k forks source link

Slow responce from the pyls #271

Closed nacknime-official closed 4 years ago

nacknime-official commented 4 years ago

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/share/nvim"Run :checkhealth for more info

- nvim-lsp version(commit hash): 94cce74
- `:checkhealth` result

health#nvim_lsp#check

Checking language server protocol configuration

health#nvim#check

Configuration

Performance

Remote Plugins

terminal

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Python virtualenv

Ruby provider (optional)

Node.js provider (optional)

Perl provider (optional)

How to reproduce the problem from neovim startup

With the minimal nvim config

call plug#begin('~/.vim/plugged') 
    Plug 'neovim/nvim-lsp'
call plug#end()
lua require'nvim_lsp'.pyls.setup{}
au Filetype python setl omnifunc=v:lua.vim.lsp.omnifunc

set completeopt=menuone,noinsert,noselect
let g:python3_host_prog = '/usr/bin/python3'

I press <C-x><C-o> to call the completion menu after await message. to get message's methods (not only in aiogram, different modules needs to wait different time)

Actual behaviour

Suggestions shows very slow comparing with Coc.nvim + Coc-python, Jedi is enabled Nvim-lsp slow_completion_nvim Coc.nvim + Coc-python slow_completion_nvim_coc

Expected behaviour

Faster responce like in coc.nvim + coc-python

I don't know this issue of nvim-lsp or pyls, but coc.nvim works through jedi or pyls and works faster than nvim-lsp, correct me if I'm wrong

mjlbach commented 4 years ago

Just to clarify, VScode does not use palantir's python language server, but rather a custom implementation on top of jedi. I've also noticed slow completions from pyls when using vim-lsp/LanguageClient-neovim. You should try using mspyls (the Microsoft Python Language Server), which I added to nvim-lsp, and is much faster.

nacknime-official commented 4 years ago

Just to clarify, VScode does not use palantir's python language server, but rather a custom implementation on top of jedi. I've also noticed slow completions from pyls when using vim-lsp/LanguageClient-neovim. You should try using mspyls (the Microsoft Python Language Server), which I added to nvim-lsp, and is much faster.

I haven't say that I compared with VSCode, I compared with coc.nvim, these things are different.

What about pyls_ms - that's laggy, buggy and eats too much CPU since open a python file.

mjlbach commented 4 years ago

I haven't say that I compared with VSCode, I compared with coc.nvim, these things are different.

coc-python is a fork of VSCode's python plugin.

What about pyls_ms - that's laggy, buggy and eats too much CPU since open a python file.

pyls_ms is the same language server that coc-python uses when you disable jedi in coc-settings.json. It's significantly faster in my experience for most projects.

nacknime-official commented 4 years ago

I haven't say that I compared with VSCode, I compared with coc.nvim, these things are different.

coc-python is a fork of VSCode's python plugin.

What about pyls_ms - that's laggy, buggy and eats too much CPU since open a python file.

pyls_ms is the same language server that coc-python uses when you disable jedi in coc-settings.json. It's significantly faster in my experience for most projects.

yes, it's faster, but we're talking about pyls now. On my screencasts you can see that jedi in coc.nvim (I didn't disable jedi in the coc config file) is much faster than in nvim-lsp

mjlbach commented 4 years ago

You can't compare the speed of pyls in nvim-lsp, to the speed of pyls in coc-python, because coc-python does not use pyls. Pyls is the speed bottleneck, not the nvim lsp implementation. To confirm, you can try LanguageClient-neovim and vimls, they will both have the same delay.

What you're really asking for is a feature request, to make a new language server using the jedi implementation of vscode (which coc-python forked/wraps), and then to provide support for that in nvim-lsp. Microsoft isn't really developing that anymore in favor of the new C# based mspyls, which we already deliver.

fsouza commented 4 years ago

@nacknime-official as mentioned by @mjlbach, coc-python doesn't use pyls, it uses jedi directly. If you want to compare the speed, you can configure coc.nvim to use pyls by uninstalling coc-python and following these instructions: https://github.com/neoclide/coc.nvim/wiki/Language-servers#python (spoiler alert: it'll be as slow, because pyls is the problem here).

This should be an issue in python-language-server's issue tracker.

nacknime-official commented 4 years ago

Oh, I'm so sorry, I thought coc-python uses pyls. Thanks for you all, I'm closing this issue.

Shougo commented 4 years ago

If nvim-lsp supports https://github.com/pappasam/jedi-language-server, it may solve the problem instead.

fsouza commented 4 years ago

Oh interesting, sent #284.