Problem:
Some servers don't stop properly.
Calling `:LspStop` _twice_ will induce a force-stop, but that is not easy to
discover: b67eff38fe/runtime/lua/vim/lsp/client.lua (L864-L866)
> By default, it will just request the server to shutdown without force. If
> you request to stop a client which has previously been requested to
> shutdown, it will automatically escalate and force shutdown.
Solution:
Nvim should automatically force-stop after X seconds, but until that is
supported, adding a bang "!" variant is reasonable.
Problem:
:LspStop/:LspRestart support multiple args, which is unlikely to be used
for interactive usage. These commands are intended for interactive
usage, not scripts. Scripts should use the vim.lsp API.
Solution:
It is unlikely that users specify multiple args, so let's drop it to
simplify the code and interface.
Problem:
After the refactoring in e4d1c8b for Neovim 0.11.2 this command now
requires an argument.
Solution:
Restore the previous behaviour where `:LspRestart` defaults to
restarting all active servers.
Problem:
After the refactoring in e4d1c8b for Neovim 0.11.2 these commands now
require an argument.
Solution:
Restore the previous behaviour where `:LspStart` defaults to
enabling all servers matching the filetype of the current buffer, and
`:LspStop` defaults to disabling all servers attached to the current
buffer.
Problem:
`:checkhealth lspconfig` has no benefits vs `:checkhealth vim.lsp`.
Solution:
- on Nvim 0.11+, `:LspInfo` is an alias to `:checkhealth vim.lsp`
instead of `:checkhealth lspconfig`.
- `lua/lspconfig/health.lua` will be removed in a few months.
This reverts commit e118ce58dab72c17216292eef7df4cee3cf60885.
It turns out `util.available_servers` is used more than anticipated, so
we revert the privatization for the time being.
Closes https://github.com/neovim/nvim-lspconfig/issues/3588
## Problems:
- `:LspStop` doesn't support list of client ids or config names.
- `:LspRestart` doesn't support config names although supports list of
client ids
- Command completion uses ids and names, not allowing the user to hit
enter immediately after
finding the desired server
## Solution:
- Unify `LspStop` and `LspRestart` implementation supporting lists of
client ids and
config names
- Command completion only returns config names
- Modify docs
## 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 541f3a2781/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.
Problem:
:LspInfo has its own "inner platlform" of highlights, mappings etc. And
it doesn't integrate with :checkhealth.
Solution:
- Move the lspinfo code to a healthcheck.
- LspInfo features such as highlights, "floating window" presentation,
etc., should be added to :checkhealth in Nvim core, if they are really
needed.
- Define a "q" mapping until Nvim stable has that in :checkhealth.
improve the get_clients_from_cmd_args for better readability and consistency.
- replace unnecessary dictionary-based approaches with array-based ones.
- use the '#' to improve code readability.
- use the '#' for an empty check.
As documented in README.md(after 5a871409199d585b52b69952532e3fb435e64566),
nvim-lspconfig now supports version 0.8 or later.
Update code to perform this version check.
Co-authored-by: Daiki Noda <sys9kdr@noreply.github.com>
* feat: improve LspInfo
* feat: update README for highlight
* fix: wrong typo
* fix: ci failed
* fix: remove unnecessary block
* fix: stylua format
* fix: set default border to none
* fix: update the doc
* fix: define names in if statement
* fix: use default_options to set border
* fix: use available servers list
* fix: fixup
* fix: format by stylua
* fix: use bufdelete event
* fix: format
* fix: add tips
* fix: stylua format
* fix: use wrap
* fix: add 122 to luacheck ignore
* fix: reset the default options
* fix: merge master
* fix: remove unecessary code
* feat: update the highlight group
* feat: update doc for highlight
* fix: remove highlig from README
* fix: remae highlight group in doc