Servers Python

Adam Labbe edited this page Jun 25, 2018 · 6 revisions

python-language-server

A Python 2.7 and 3.4+ implementation of the Language Server Protocol.

Installing server

pip install python-language-server

Once the python-language-server is installed, you can either:

  1. Install vim-lsp-python OR
  2. Register the python-language-server yourself in your .vimrc

Installing vim-lsp-python

If you'd like the vim-lsp-python plugin to register the python-language-server for you, install the vim-lsp-python plugin:

" After vim-lsp, etc
Plug 'ryanolsonx/vim-lsp-python'

Registering in .vimrc

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

Workspace Configuration

python-language-server has several settings that can be tweaked through the workspace configuration. For example, enabling pydocstyle (which is disabled by default):

if executable('pyls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyls',
        \ 'cmd': {server_info->['pyls']},
        \ 'whitelist': ['python'],
        \ 'workspace_config': {'pyls': {'plugins': {'pydocstyle': {'enabled': v:true}}}}
        \ })
endif

The full set of options that can be manipulated can be found in package.json.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.