diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 6 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 7 | ||||
-rw-r--r-- | runtime/doc/news.txt | 15 | ||||
-rw-r--r-- | runtime/doc/remote.txt | 4 | ||||
-rw-r--r-- | runtime/doc/ui.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/codelens.lua | 24 |
6 files changed, 57 insertions, 1 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 3cd4578750..26679f0330 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3471,6 +3471,12 @@ nvim_ui_pum_set_height({height}) *nvim_ui_pum_set_height()* Parameters: ~ • {height} Popupmenu height, must be greater than zero. +nvim_ui_set_focus({gained}) *nvim_ui_set_focus()* + Tells the nvim server if focus was gained or lost by the GUI. + + Attributes: ~ + |RPC| only + nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()* TODO: Documentation diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index b101740b03..705d7675e5 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1278,6 +1278,13 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config}) ============================================================================== Lua module: vim.lsp.codelens *lsp-codelens* +clear({client_id}, {bufnr}) *vim.lsp.codelens.clear()* + Clear the lenses + + Parameters: ~ + • {client_id} (number|nil) filter by client_id. All clients if nil + • {bufnr} (number|nil) filter by buffer. All buffers if nil + display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()* Display the lenses using virtual text diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index d6f6464f78..1a242e9128 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -39,6 +39,8 @@ NEW FEATURES *news-features* The following new APIs or features were added. +• Added a |vim.lsp.codelens.clear()| function to clear codelenses. + • |vim.inspect_pos()|, |vim.show_pos()| and |:Inspect| allow a user to get or show items at a given buffer postion. Currently this includes treesitter captures, semantic tokens, syntax groups and extmarks. @@ -101,6 +103,11 @@ The following new APIs or features were added. See https://github.com/neovim/neovim/pull/14537. +• |--remote-ui| option was added to connect to a remote instance and display + in it in a |TUI| in the local terminal. This can be used run a headless nvim + instance in the background and display its UI on demand, which previously + only was possible usiing a external UI implementation. + ============================================================================== CHANGED FEATURES *news-changes* @@ -109,6 +116,14 @@ The following changes to existing APIs or features add new behavior. • 'exrc' now supports `.nvim.lua` file. • 'exrc' is no longer marked deprecated. +• The |TUI| is changed to run in a separate process (previously, a separate + thread was used). This is not supposed to be a visible change to the user, + but might be the cause of subtle changes of behavior and bugs. + + Previously, the TUI could be disabled as a build time feature (+tui/-tui), + resulting in a nvim binary which only could be run headless or embedded + in an external process. As of this version, TUI is always avalibale. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 0c1e3438de..4610088ab0 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -52,6 +52,10 @@ The following command line arguments are available: *--remote-expr* --remote-expr {expr} Evaluate {expr} in server and print the result on stdout. + *--remote-ui* + --remote-ui Display the UI of the server in the terminal. + Fully interactive: keyboard and mouse input + are forwarded to the server. *--server* --server {addr} Connect to the named pipe or socket at the given address for executing remote commands. diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index 1cffe1f902..a2ae9f22ce 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -56,6 +56,8 @@ with these (optional) keys: - `stdin_fd` Read buffer from `fd` as if it was a stdin pipe This option can only used by |--embed| ui, see |ui-startup-stdin|. + `stdin_tty` Tells if `stdin` is a `tty` or not. + `stdout_tty` Tells if `stdout` is a `tty` or not. Specifying an unknown option is an error; UIs can check the |api-metadata| `ui_options` key for supported options. diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 71b6bfae30..17489ed84d 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -108,13 +108,36 @@ function M.run() end end +---@private +local function resolve_bufnr(bufnr) + return bufnr == 0 and api.nvim_get_current_buf() or bufnr +end + +--- Clear the lenses +--- +---@param client_id number|nil filter by client_id. All clients if nil +---@param bufnr number|nil filter by buffer. All buffers if nil +function M.clear(client_id, bufnr) + local buffers = bufnr and { resolve_bufnr(bufnr) } or vim.tbl_keys(lens_cache_by_buf) + for _, iter_bufnr in pairs(buffers) do + local client_ids = client_id and { client_id } or vim.tbl_keys(namespaces) + for _, iter_client_id in pairs(client_ids) do + local ns = namespaces[iter_client_id] + lens_cache_by_buf[iter_bufnr][iter_client_id] = {} + api.nvim_buf_clear_namespace(iter_bufnr, ns, 0, -1) + end + end +end + --- Display the lenses using virtual text --- ---@param lenses table of lenses to display (`CodeLens[] | null`) ---@param bufnr number ---@param client_id number function M.display(lenses, bufnr, client_id) + local ns = namespaces[client_id] if not lenses or not next(lenses) then + api.nvim_buf_clear_namespace(bufnr, ns, 0, -1) return end local lenses_by_lnum = {} @@ -126,7 +149,6 @@ function M.display(lenses, bufnr, client_id) end table.insert(line_lenses, lens) end - local ns = namespaces[client_id] local num_lines = api.nvim_buf_line_count(bufnr) for i = 0, num_lines do local line_lenses = lenses_by_lnum[i] or {} |