vim-lsp-settings icon indicating copy to clipboard operation
vim-lsp-settings copied to clipboard

Automatically starts the pylsp in Python install

Open ShayHill opened this issue 2 years ago • 5 comments

The plugin starts python310/Scripts/pylsp, which prevents the LSP I installed with :LspInstall from running. I have to :LspStopServer pylsp to use pyright. Python 3.10,7 Vim 9.0.

ShayHill avatar Sep 11 '22 03:09 ShayHill

Do you want to start pylsp and pyright both? Then

let g:lsp_settings_filetype_python = ['pylsp', 'pyright']

mattn avatar Sep 11 '22 06:09 mattn

Thank you, but I don’t want to start pylsp at all. It starts automatically when I have vim-lsp-settings installed (as a git submodule in vimfiles/pack/plugins/start if that matters).

Sent from my iPhone

On Sep 11, 2022, at 01:13, mattn @.***> wrote:



Do you want to start pylsp and pyright both? Then

let g:lsp_settings_filetype_python = ['pylsp', 'pyright']

— Reply to this email directly, view it on GitHubhttps://github.com/mattn/vim-lsp-settings/issues/617#issuecomment-1242895623, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAKIE3JHRMFJK2TNMNSCVLV5VZ7FANCNFSM6AAAAAAQJTAP5A. You are receiving this because you authored the thread.Message ID: @.***>

ShayHill avatar Sep 11 '22 11:09 ShayHill

  • blank vimrc
  • two plugins: vim-lsp and vim-lsp-settings
  • nothing in ~\AppData\Local\vim-lsp-settings\servers
  • fresh Python 3.10.6 install

Start GVim, open a Python file, pylsp is running

:PlsInstall pyright-langserver

Vimrc =

if executable('pyright')
    "" pip install python-language-server
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyright',
        \ 'cmd': {server_info->['pyright-langserver', '--stdio']},
        \ 'allowlist': ['python'],
        \ })
endif

Restart GVim, open a Python file, both pylsp and pyright-langserver are running.

ShayHill avatar Sep 11 '22 13:09 ShayHill

Then, just set

let g:lsp_settings_filetype_python = ['pyright']

mattn avatar Sep 11 '22 14:09 mattn

Thank you very much.

Sent from my iPhone

On Sep 11, 2022, at 09:05, mattn @.***> wrote:



Then, just set

let g:lsp_settings_filetype_python = ['pyright']

— Reply to this email directly, view it on GitHubhttps://github.com/mattn/vim-lsp-settings/issues/617#issuecomment-1242972322, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAKIE5DFQEXAGMB3F7EH5DV5XRIZANCNFSM6AAAAAAQJTAP5A. You are receiving this because you authored the thread.Message ID: @.***>

ShayHill avatar Sep 11 '22 19:09 ShayHill

Then, just set

let g:lsp_settings_filetype_python = ['pyright']

should be 'pyright-langserver' instead of 'pyright' in the braces?

yurikoif avatar Nov 24 '22 08:11 yurikoif

should be 'pyright-langserver' instead of 'pyright' in the braces?

Yes, that is the better method. Empty vimrc except let g:lsp_settings_filetype_python = ['pyright-langserver'] will result in the Please do :LspInstallServer ... prompt and tidy installation in g:lsp_settings_servers_dir

To summarize:

let g:lsp_settings_filetype_python = ['pyright-langserver'] plus any mappings or display settings you want will be enough to get vim-lsp running nicely with pyright.

ShayHill avatar Dec 06 '22 16:12 ShayHill