neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 060993e4381d6e22d46917a36c464d6829efb80b
parent f89558848b119048a2656fbf127f4cd85129330b
Author: Justin M. Keyes <justinkz@gmail.com>
Date:   Tue, 16 Dec 2025 00:58:28 -0500

docs: misc, lsp

Diffstat:
Mruntime/doc/lsp.txt | 24++++++++++--------------
Mruntime/doc/news.txt | 9++++-----
Msrc/nvim/cursor.c | 2+-
Msrc/nvim/drawline.c | 2+-
Mtest/functional/ex_cmds/lsp_spec.lua | 24++++++++++++------------
5 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt @@ -117,25 +117,21 @@ To remove or override BUFFER-LOCAL defaults, define a |LspAttach| handler: >lua }) < ============================================================================== -COMMANDS *:lsp* +COMMANDS *:lsp* *lsp-commands* -:lsp enable {name}? *:lsp-enable* - Enables the given lsp clients. If no names are given, all clients - configured with |vim.lsp.config()| with a filetype matching the current - buffer's filetype are enabled. Use |vim.lsp.enable()| for non-interactive - use. +:lsp enable [config_name] *:lsp-enable* + Activates LSP for current and future buffers. See |vim.lsp.enable()|. -:lsp disable {name}? *:lsp-disable* - Disables (and stops) the given lsp clients. If no names are given, - all clients attached to the current buffer are disabled. Use - |vim.lsp.enable()| with `enable=false` for non-interactive use. +:lsp disable [config_name] *:lsp-disable* + Disables (and stops) LSP for current and future buffers. See + |vim.lsp.enable()|. -:lsp restart {client}? *:lsp-restart* - Restarts the given lsp clients. If no client names are given, all active +:lsp restart [client_name] *:lsp-restart* + Restarts LSP clients and servers. If no client names are given, all active clients attached to the current buffer are restarted. -:lsp stop {client}? *:lsp-stop* - Stops the given lsp clients. If no client names are given, all active +:lsp stop [client_name] *:lsp-stop* + Stops LSP clients and servers. If no client names are given, all active clients attached to the current buffer are stopped. Use |Client:stop()| for non-interactive use. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt @@ -241,6 +241,7 @@ HIGHLIGHTS LSP +• |:lsp| can be used to interactively manage LSP clients. • |vim.lsp.ClientConfig| gained `workspace_required`. • You can control the priority of |vim.lsp.Config| `root_markers`. • Support for `textDocument/documentColor`: |lsp-document_color| @@ -280,19 +281,17 @@ LSP • Support for `textDocument/onTypeFormatting`: |lsp-on_type_formatting| https://microsoft.github.io/language-server-protocol/specification/#textDocument_onTypeFormatting • The filter option of |vim.lsp.buf.code_action()| now receives the client ID as an argument. -• |Client:stop()| and |vim.lsp.enable()| accept `force` as an integer, which is - treated as the time to wait before before "stop" escalates to "force-stop". • |vim.lsp.ClientConfig| `exit_timeout` decides the time waited before "stop" escalates to "force-stop" for |vim.lsp.enable()|, |Client:stop()|, and during Nvim shutdown. • `exit_timeout` graduated from "experimental" `flags.exit_timeout` to a top-level field. Defaults to `false`. +• |Client:stop()| accepts `force` as an integer, which is treated as the time + to wait before before stop escalates to force-stop. • Add cmp field to opts of |vim.lsp.completion.enable()| for custom completion ordering. • Support for `workspace/diagnostic/refresh`: https://microsoft.github.io/language-server-protocol/specification/#diagnostic_refresh -- Support for dynamic registration for `textDocument/diagnostic` -• |:lsp| for interactively enabling, disabling, restarting, and stopping lsp - clients. +• Support for dynamic registration for `textDocument/diagnostic` LUA diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c @@ -308,7 +308,7 @@ void check_pos(buf_T *buf, pos_T *pos) } } -/// Make sure curwin->w_cursor.lnum is valid. +/// Make sure win->w_cursor.lnum is valid. void check_cursor_lnum(win_T *win) { buf_T *buf = win->w_buffer; diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c @@ -2934,7 +2934,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b int win_normal_bg = normal_bg; int win_normal_cterm_bg = cterm_normal_bg_color; - // Get window-local Normal background (respects winhighlight) + // Get window-local Normal background (respects 'winhighlight' option). if (bg_attr != 0) { HlAttrs norm_ae = syn_attr2entry(bg_attr); win_normal_bg = norm_ae.rgb_bg_color; diff --git a/test/functional/ex_cmds/lsp_spec.lua b/test/functional/ex_cmds/lsp_spec.lua @@ -22,6 +22,18 @@ describe(':lsp', function() end) end) + it('fails if runtime is missing/broken', function() + clear { + args_rm = { '-u' }, + args = { '-u', 'NONE' }, + env = { VIMRUNTIME = 'non-existent' }, + } + eq( + [[Vim(lsp):Lua: [string "<nvim>"]:0: module 'vim._core.ex_cmd.lsp' not found:]], + vim.split(t.pcall_err(n.command, 'lsp enable dummy'), '\n')[1] + ) + end) + for _, test_with_arguments in ipairs({ true, false }) do local test_message_suffix, lsp_command_suffix if test_with_arguments then @@ -114,16 +126,4 @@ describe(':lsp', function() end) eq(2, cmd_length) end) - - it('fail with no runtime without crashing', function() - clear { - args_rm = { '-u' }, - args = { '-u', 'NONE' }, - env = { VIMRUNTIME = 'non-existent' }, - } - eq( - [[Vim(lsp):Lua: [string "<nvim>"]:0: module 'vim._core.ex_cmd.lsp' not found:]], - vim.split(t.pcall_err(n.command, 'lsp enable dummy'), '\n')[1] - ) - end) end)