prabirshrestha / vim-lsp

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

LspStopServer: Stop all and stop specific #1491

Closed ilya-bobyr closed 1 year ago

ilya-bobyr commented 1 year ago

It is convenient to be able to stop all LSP servers, regardless of the currently active buffer.

Also, it seems confusing that when a server name is specified, it is only stopped if it is also one handling the current buffer type. I would imagine it is quite rare to have more than one server handing a specific buffer type. And if one explicitly specified a name, it seems reasonable to stop this particular server, regardless of the currently active buffer.

prabirshrestha commented 1 year ago

could you fix the lint issue?

ilya-bobyr commented 1 year ago

could you fix the lint issue?

What is the issue? The CI seems to show all checks as successful:

All checks have passed 18 successful checks


Update. Ah, sorry, I can see it now - in the review view.

ilya-bobyr commented 1 year ago

Vim documentation says that default values for arguments are fair game. And I am actually using this code for a few weeks now. It works correctly. :LspStopServer works both with and without an argument.

I can change lsp#ui#vim#stop_server(stop_all, name = '') to lsp#ui#vim#stop_server(stop_all, ...) and then use a:0, a:1 or a:000 to deal with the optional name. But as an optional name is what I want and as Vim script supports it, this would be a workaround just to avoid the linter parser limitation.

Do you want to make this change?

prabirshrestha commented 1 year ago

We should make the change. Not sure if older versions of vim will have issues. Some devs use the one that ships with OS and they are not fan of updating to latest version. Specially for those using LTS versions that barely update vim.

ilya-bobyr commented 1 year ago

Rebased, addressed two linter issues, and added quotes around server names. Here is a complete diff: https://github.com/prabirshrestha/vim-lsp/compare/0b0db777524f127f965768286623407f7ada5992..6e35c234a44e4d32ea578adb1fdcf3f05b784c5c

@prabirshrestha Please, take a look.

prabirshrestha commented 1 year ago

Merged. Thanks!