Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(LspStop): correctly stop servers and notify user #3378
## Problem The current `LspStop` behavior is confusing and wrong: **Server name:** - If the server with the given `server_name` is **not attached**: - No notification is shown, and **all** LSP servers are stopped. - If the server with the given `server_name` is **attached**: - **Incorrectly** closes all LSP servers. - If no servers are attached: - `server_name` is notified as missing. **Server ID:** - If the server with the given `server_id` is **not attached**: - Uses `get_managed_clients()` function https://github.com/neovim/nvim-lspconfig/blob/541f3a2781de481bb84883889e4d9f0904250a56/plugin/lspconfig.lua#L45-L47 Which doesn't return all servers (e.g., `null-ls`), so it doesn't close all LSP clients. - If the server with the given `server_id` is **attached**: - The correct LSP server is stopped (including `null-ls`). **No arguments:** - If servers are **attached**: - Stops all servers. - If no servers are attached: - **Incorrectly** notifies the user with: `config "" not found`. ## Solution **Server name:** - If the server with the given `server_name` is **not attached**: - Notify the user, but **do not close** any servers. - If the server with the given `server_name` is **attached**: - Close the specified server. **Server ID:** - If the server with the given `server_id` is **not attached**: - Notify the user, but **do not close** any servers. - If the server with the given `server_id` is **attached**: - Close the specified server. **No arguments:** - If servers are **attached**: - Stops all servers. - If no servers are attached: - No-op.
- Loading branch information