aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
...
* | | fix(treesitter): incremental selection causes beeps when the bell is enabled ↵Dmytro Meleshko2026-06-25
|/ / | | | | | | | | | | | | | | | | | | | | #40414 Problem: The function visual_select() in treesitter/_select.lua is executing `:normal! v<Esc>` to ensure that `gv` later goes back to character Visual mode, but doing so when mode() is already `v` first switches back to the Normal mode, then executes <Esc>, which causes a beep. Solution: Check if the mode() is already `v` and avoid any switching in that case.
* | fix(lsp): skip invalid file watcher globs #40376 #40396Barrett Ruth2026-06-25
| | | | | | | | | | Some servers register `workspace/didChangeWatchedFiles` watchers for URI schemes that cannot be watched locally. Skipping the unsupported glob and keep the rest of the registration batch active.
* | fix(lsp): fire LspNotify didChange autocmds after undo/redo #40404jdrouhard2026-06-25
| | | | | | | | | | | | | | | | | | | | | | Problem: LspNotify autocmds were not being triggered for didChange requests when being used during undo/redo (and possibly other) actions. autocmds are blocked when calling on_lines() callbacks while doing the undo/redo action. Solution: Defer firing the autocmd until after the action is complete. This is closer to what existed before, but now there's a check in the deferred function to only fire the autocmd if the client is still active and the buffer is still attached, if applicable.
* | fix(tty): filter terminal probes by channel #40356Barrett Ruth2026-06-24
|/ | | | | | | | | | | | | | | | | | | | Problem: Terminal probes sent with `nvim_ui_send()` can reach more than one stdout TTY UI. Probes with a known TTY UI owner should not accept `TermResponse`s from unrelated UI channels. Solution: Thread the existing `chan` filter through owned terminal probes. This covers startup/attach background detection, fallback truecolor detection, and `vim.tty.query()` forwarding opts to `vim.tty.request()`. Note: Not every terminal escape path is updated here. I only passed `chan` when the caller already knows which TTY UI owns the probe. For example, this does not include: - (Followup) OSC 52 (system clipboard) detection. It needs to capture the `UIEnter` channel. Adding `{ chan = ... }` only to the nested query would be half a fix. - OSC 52 _paste_ is left global because the provider callback does not have a UI channel (paste is invoked without a ui channel/tty ui object).
* docs: bufadd(), fnameescape() guidance #40378Justin M. Keyes2026-06-23
|
* fix(tui): attribute `TermResponse` to source channel #40330Barrett Ruth2026-06-23
| | | | | | | Problem: Attach-time terminal probes cannot distinguish responses from different attached UIs. Solution: Identify the UI by RPC channel id in `TermResponse` and make `vim.tty.request()` filter responses by channel.
* fix(ui2): message before empty prompt not shownLuuk van Baal2026-06-22
| | | | | Problem: Message before empty input() is not visible. Solution: Route to dialog window with active prompt (hl_id >= 0).
* fix(ui2): clear search_count after clearing the screenLuuk van Baal2026-06-22
| | | | | | | Problem: Clearing the screen doesn't clear the "last" virtual text. Dupe counter virtual text is not increased beyond 1. Solution: Clear "last" virtual text when clearing the screen. Restore assignment lost in a previous commit.
* fix(defaults): detect `'background'`/`'termguicolors'` on UI attach #40175Barrett Ruth2026-06-20
| | | | | | | | Problem: Terminal background and truecolor detection runs only at startup, gated on a UI being attached. A headless server has no UI then, so `'background'` and `'termguicolors'` are never detected and remote UIs ignore the terminal's theme. Solution: Also (re)detect on UIEnter. The most recently attached terminal wins; an explicit user value is preserved.
* fix(health): check more "old" filesJustin M. Keyes2026-06-20
|
* perf(ui2): accumulate message lines #40338luukvbaal2026-06-20
| | | | | | Problem: Writing a message with a large number of newlines (:echo "foo\n"->repeat(1000000)) takes longer than it has to (since c973c7ae). Solution: Accumulate newlines in a single API call when possible.
* fix(lsp): make LspNotify more robust #40332jdrouhard2026-06-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: LspNotify never passed a buffer when executing the autocmds, so buffer-local LspNotify autocmd subscriptions didn't have the correct buf in the event metadata. It was also wrapped in a schedule() so the actual autocmd was delayed until after the event loop. This could result in the wrong buffer receiving the notification if multiple LspNotify autocmds with buffer filters were added. Only the "latest" one would actually receive non-buffer-filtered autocmds, not the matching one. It also caused listeners to receive the notification "out of sync" with when the notification is actually sent. If a buffer is being deleted (which fires a textDocument/didClose notification), the notification is scheduled and fired after the buffer is already gone. Solution: For LSP notifications that pertain to a particular buffer, set it when executing the LspNotify autocmds so the callback functions that are filtered on that buffer will get the correct notifications and the metadata buf field will be correct. Additionally, there is no need to wrap the LspNotify callback in vim.schedule when it can be called inline when the notification to the rpc server is fired. This is tested by removing now-unnecessary autocmds from semantic tokens (InsertEnter and BufWinEnter should no longer be necessary now that requests are fired by LspNotify). Without this fix, simply modifying a buffer doesn't actually trigger LspNotify correctly, and the test for that fails.
* fix(lsp): multiline semantic token processing #40339jdrouhard2026-06-20
| | | | | | | | | | | | | Problem: When multiline semantic token support was introduced, the loop that finds the end line for a particular token didn't sanitize the token length sent back by the LSP server. If the server returned an overflowed length (near uint32 max), neovim would burn cpu and loop for an extremely long time while trying to find the "end line" represented by the massively large token, causing neovim to seemingly hang. Solution: Stop looping once the calculated end_line reaches the actual last line of the buffer. Fixes #36257
* feat(column): per row click handlers for 'statuscolumn' (#40265)luukvbaal2026-06-20
| | | | | | | | | | | | | | Problem: - Current 'statuscolumn' click label caveat is restrictive. - v:virtnum is not unique to a line if it has both above and below virtual lines. - 'statuscolumn' click handler may expect v:virt/lnum to be set. Solution: - Store per-row click definitions for the statuscolumn in a (nested line/virt number) map. - Implement strategy that gives each 'statuscolumn' row a unique v:virtnum. - Set v:virt/lnum when determining which line is clicked.
* refactor(lsp): refactor linked_editing_range to use vim.lsp._capability (#40327)jdrouhard2026-06-19
| | | | | | | Problem: linked_editing_range was still doing most of the capability boilerplate itself. Solution: refactor it to make use of the common Capability framework for handling enabling, disabling, etc.
* fix(:checkhealth): open after current tabpage (#40319)zeertzjq2026-06-19
|
* fix(man.lua): highlight codeblocks #40310J. Adly2026-06-18
| | | | | | | | | | | | Problem: :Man does not syntax highlight codeblocks (injected language). Analysis: init_pager() swapped pcall(parse_ref, ref) return values order, so vim.b.man_sect was set to the manpage name instead of the section number, so C syntax highlighting did not load. Solution: Swap the calls.
* feat(:restart): v:startreason #40186Nathan Zeng2026-06-18
| | | | | | | | Problem: It's clumsy for scripts to handle a "restart", without custom mappings or global vars. Solution: Introduce `v:startreason`
* fix(lsp): allow specifying bufnr + client_id filter when enabling ↵Gregory Anders2026-06-17
| | | | | | | | capabilities #37690 Today there is a constraint that these arguments to the enable filter be mutually exclusive, but I do not know why such a constraint exists (it is perfectly reasonable to want to enable a capabilility for just one buffer and just one client).
* fix(lsp): catch another nil buffer state #40285Steve Huff2026-06-16
|
* fix(lsp): requery empty isIncomplete completion lists #40100glepnir2026-06-15
| | | | | | | | | Problem: an empty `{ isIncomplete = true, items = {} }` ends completion instead of requerying. Solution: keep isIncomplete on empty lists and retrigger on keypress while incomplete. Reset on <C-e> so it doesn't immediately re-query.
* fix(api): keep highlight font through set/get and redraws #40200glepnir2026-06-15
| | | | | | | | | | | | Problem: a font set via nvim_set_hl is lost or corrupted with font-only groups, attribute combining, and update=true, and is dropped on any attr-table rebuild. nvim__inspect_cell also frees the font name while a returned dict still borrows it. Solution: register font-only groups, carry font through hl_combine_attr, inherit it on update, and persist sg_font so a rebuild can restore it. Keep interned font names across a rebuild instead of clearing them. Add the missing font field to get_hl_info. Co-authored-by: Ryan Patterson <cgamesplay@cgamesplay.com>
* fix(autoread): 'autoread' error if file goes missing #40276Justin M. Keyes2026-06-15
| | | | | | | | | | | | | | | Problem: 'autoread' error if file goes missing. E211: File "runtime/lua/nvim/autoread.lua" no longer available vim.schedule callback: /usr/local/share/nvim/runtime/lua/nvim/autoread.lua:146: Vim:E211: File "test/functional/options/autoread_spec.lua" no longer available stack traceback: [C]: in function 'checktime' /usr/local/share/nvim/runtime/lua/nvim/autoread.lua:146: in function </usr/local/share/nvim/runtime/lua/nvim/autoread.lua:138> Solution: Ignore E211 thrown by `:checktime`.
* feat(diagnostic): debounce current-line render #39542Oleh Volynets2026-06-15
| | | | | | | | | | | Problem: vim.diagnostic.Opts.VirtualLines.current_line and vim.diagnostic.Opts.VirtualText.current_line cause redraw on every CursorMoved event that makes the text jump uncomfortably with rapid cursor movement. Solution: `current_line` state is applied only on CursorHold, while still being cleared on CursorMoved making it so that until the cursor has stopped on a line, its diagnostic looks like cursor is not on the line preventing flicker.
* fix(tui): late-arriving OSC11 response triggers OptionSet #40270Justin M. Keyes2026-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: This test is flaky since fff9897ce3f2 : FAILED ...Xtest_xdg_terminal/test/functional/terminal/tui_spec.lua @ 4359: TUI bg color does not trigger OptionSet from automatic background processing Expected values to be equal. Expected: { true, 0 } Actual: { true, 1 } stack traceback: ...Xtest_xdg_terminal/test/functional/terminal/tui_spec.lua:4380: in function <...Xtest_xdg_terminal/test/functional/terminal/tui_spec.lua:4359> `apply_optionset_autocmd_now` does not emit `OptionSet` during startup: void apply_optionset_autocmd_now(...) { // Don't do this while starting up, failure or recursively. if (starting || errmsg != NULL || *get_vim_var_str(VV_OPTION_TYPE) != NUL) { return; } ... } but if OSC 11 response arrives AFTER VimEnter, then `nvim_set_option_value('background',…)` call triggers `OptionSet`. Solution: Use `:noautocmd` when setting 'background'. Per fff9897ce3f2, OSC11 is not intended to trigger OptionSet. fix https://github.com/neovim/neovim/issues/40235
* feat(lsp): clean up semantic token initialization and debounce #40254jdrouhard2026-06-15
| | | | | | | | | | | | | | | | Problem: The refactor to use Capability left around some cruft and semi-broken configuration for debounce. Solution: Clean up now-unnecessary helper methods and simplify deprecated ones to pass through to the non-deprecated ones. `debounce` now defaults to 200 for all buffers but is overridable via the deprecated start() method, which continues to take the max value specified for any client attached to the buffer. If we wish to expose changing the debounce in a non-deprecated way, we will need to consider a "configuration" function, or even a bespoke method to set the debounce time on the main metaclass (or provide options to override for a particular buffer). General configuration of specific LSP features is an as-of-yet unsolved problem.
* vim-patch:9.2.0649: filetype: tf files sometimes incorrectly recognized (#40258)zeertzjq2026-06-15
| | | | | | | | | | | | | | Problem: filetype: tf files sometimes incorrectly recognized (Christian Robinson) Solution: Add support for g;filetype_tf variable to override detection, re-write the filetype detection loop closes: vim/vim#20510 Supported by AI https://github.com/vim/vim/commit/522a39a48962f43dabcd5e568c1ee78799599e94 Co-authored-by: Christian Brabandt <cb@256bit.org>
* feat(events): :mksession SessionWritePre event #39688Igor Lacerda2026-06-14
| | | | | | | Problem: No event triggered just before writing a session file. Solution: Add `SessionWritePre`.
* fix(autoread): handle autocmd errorsJustin M. Keyes2026-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: Any random ftplugin or other autocmd, can throw an error when `:checktime` reloads a buffer. This causes a trace which makes it look like an issue with `autoread.lua`. vim.schedule callback: …/runtime/lua/nvim/autoread.lua:146: FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20] ..script …/runtime/ftplugin/help.lua: Vim(runtime):E5113: Lua chunk: …/runtime/lua/vim/treesitter.lua:216: Index out of bounds stack traceback: [C]: in function 'nvim_buf_get_text' …/runtime/lua/vim/treesitter.lua:216: in function 'get_node_text' …/runtime/lua/vim/treesitter/query.lua:558: in function 'handler' …/runtime/lua/vim/treesitter/query.lua:843: in function '_match_predicates' …/runtime/lua/vim/treesitter/query.lua:1082: in function '(for generator)' …/runtime/ftplugin/help.lua:91: in function 'runnables' …/runtime/ftplugin/help.lua:124: in main chunk [C]: in function 'checktime' …/runtime/lua/nvim/autoread.lua:146: in function <…/runtime/lua/nvim/autoread.lua:138> Solution: Use pcall() and surface the error via nvim_echo.
* feat(autoread): surface autoread activity via 'busy' flagJustin M. Keyes2026-06-14
| | | | | | | | | | | | | | | | Problem: Old 'autoread' only did `:checktime` on focus-change and shell (":!") commands, and only for non-hidden buffers. Since 'autoread' is now driven by OS filewatcher events, buffers are updated much more eagerly. This should be surfaced to the user somehow, either via a carefully placed notification, or a minimal UI indicator. A "notification" would be noisy, unless it is conditional on specific circumstances (e.g. when "many" buffers are updated). Solution: Use the existing 'busy' buffer-local option as a subtle hint about activity.
* Merge #40087 from ofseed/pos-util-follow-upJustin M. Keyes2026-06-14
|\ | | | | feat(pos): create a cursor position by using the current of a window
| * feat(pos)!: match return value of `to_cursor()` with parameters of `cursor()`Yi Ming2026-06-08
| | | | | | | | | | | | | | | | | | | | | | Problem: - `pos.cursor()` receives a table contains `row` and `col` as arguments, but `pos:to_cursor` returns `row` and `col` directly without wrapping them in a table. - `pos.mark()`/`pos:to_mark` can already handle unpacked `row` `col`. Solution: Make `pos:to_cursor()` return a `row` and `col` in a table.
| * feat(pos): create a cursor position by using the current of a windowYi Ming2026-06-08
| | | | | | | | | | | | | | | | | | | | Problem: `vim.pos.cursor(vim.api.nvim_get_current_buf(win), vim.api.nvim_win_get_cursor(win))` is too verbose to create a cursor position of a window, but it is a common use case. Solution: Overload `vim.pos.cursor()`, so that it accepts `win` as an argument when `pos` is omitted.
* | feat(lsp): use LspNotify for semantic tokens #40224jdrouhard2026-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The semantic token module is using its own debounce timer for the buffer on_lines event. If its internal debounce is shorter than the changetracking module's debounce, it's possible for semantic token requests to fire for changed buffers before the textDocument/didChange notification is sent to the server. Solution: Trigger semantic token requests from the LspNotify autocmd when the method is the didChange or didOpen notifications, which enforces a strict happens-before relationship for the sync change notification followed by a semantic token request. Note: There is still an internal debounce mechanism in the semantic token module to handle other debouncing needs specific to its functionality, such as debouncing server refresh notifications and handling WinScrolled events when using range requests.
* | vim-patch:9.2.0624: C-N/C-P cannot be mapped in complete() completion (#40232)glepnir2026-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Keys valid in CTRL-X mode are never mapped while insert completion is active, so <C-N> and <C-P> cannot be remapped for completion started by complete(). Solution: Do not disable mappings in CTRL_X_EVAL mode. In this mode a mapping cannot interfere with selecting the completion method, which is what the no-mapping rule exists for. related: vim/vim#6440 related: vim/vim#16880 closes: vim/vim#20489 https://github.com/vim/vim/commit/076585e6addb5688f123ef3e174fcfee993b7602 Co-authored-by: Thomas M Kehrenberg <tmke8@posteo.net>
* | test(autoread): make "debounce" test actually validJustin M. Keyes2026-06-13
| |
* | test(autoread): cleanupJustin M. Keyes2026-06-13
| | | | | | | | | | | | - Merged into the main "reloads on external change" test. - Reduce duplication. - Wall-clock down from ~4.4s to ~1.4s (dropped 3s debounce test).
* | fix(filetype): `vim.filetype.match` fails if CWD goes missing #40190Evgeni Chasnovski2026-06-13
| | | | | | | | | | | | | | | | Problem: Running `vim.filetype.match()` when current working directory was removed from disk throws a `vim.fs.abspath` assertion error. However, the matching might still be possible without trying to match against full path (like if it is a known extension). Solution: Safely compute absolute path and ignore it if it errors.
* | feat(diagnostic): add virt_lines_overflow option for virtual_lines #40178John Reid2026-06-13
| | | | | | | | | | | | | | Problem: Diagnostic virtual lines are hardcoded with "scroll" for virt_lines_overflow option. Solution: Add a `overflow` option to `virtual_lines` config to support "wrap", "scroll", "trunc", and "auto".
* | feat(autoread): use filewatchers for OS-driven change detection #37971Oleksandr Chekhovskyi2026-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The 'autoread' option only checks for file changes reactively — on FocusGained, :checktime, CmdlineEnter, etc. — by polling timestamps. External changes are not detected until the user interacts with Neovim. Solution: Add a core module (runtime/lua/nvim/autoread.lua) enabled from runtime/plugin/autoread.lua that watches each buffer's file using vim._watch.watch() (libuv fs_event). On change detection it calls :checktime, which invokes the existing buf_check_timestamp() logic for reload/prompt handling. Watchers are managed via autocmds tied to buffer lifecycle events and respect the 'autoread' option (global and buffer-local).
* | perf(lsp): overscan semantic_token range requests #40036Jay Madden2026-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Flickering may occur when paging up/down in big files, as ranges for semantic tokens are requested. This happens with LSP servers like gopls which return "/full" semantic tokens if the file is too big, where we fall back to viewport-range token retrievals. Solution: Broaden the requested ranges to one viewport of "overscan" on each side plus some padding if possible: (viewport_topline - viewport_height)..(viewport_botline + viewport_height)
* | docs: miscJustin M. Keyes2026-06-11
| |
* | fix(lsp): trailing blank line when edit inserts past end of buffer #40133Aaron Tinio2026-06-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: A text edit positioned entirely past the last buffer line, with newText ending in a newline, leaves a stray blank line: the past-the-end path appends the trailing empty fragment produced by vim.split() and does not set has_eol_text_edit, so the end-of-buffer cleanup is skipped. Formatting servers emit such edits whenever formatting moves text to the end of a document. Regression from ec94014cd1 (#20137), which split the past-the-end fast path off the clamp path that sets the flag. Solution: Set has_eol_text_edit in the past-the-end path, like the adjacent path that clamps end_row.
* | fix(lsp): refresh codelens despite pending debounce #40154Tristan Knight2026-06-10
| | | | | | | | | | | | | | | | | | | | | | Problem: When a server sends workspace/codeLens/refresh while an automatic codelens request is already scheduled, Nvim ignores the server refresh. This can leave rendered codelens text stale until another buffer edit triggers a new request. Solution: Cancel the pending automatic request and send the server-requested refresh immediately. This preserves request coalescing while giving explicit server refreshes priority.
* | fix(option): set 'shell…' options based on detected shell #40031tao2026-06-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: * 'shellcmdflag' states that its default value is set according to the value of 'shell', but this behavior is not yet implemented on Windows. The same applies to 'shellpipe', 'shellredir', and 'shellxquote'. * On Windows, Git is often installed in paths containing spaces, and we still do not correctly resolve the sh executable name as described in 'shell'. * On Windows, the default value of 'shellslash' is always `false`, which causes Unix-like shells to interpret `\` in paths returned by some functions as escape charaters. Solution: Use a simple rule table to detect common shells (e.g. `cmd`, `powershell`, shells whose names contain `csh` or `sh`) and apply best-effort defaults, while leaving more complex scenarios to user configuration.
* | docs(lsp): bump protocol/meta to 3.18 #37273Tristan Knight2026-06-10
| | | | | | | | fixes glob spec regression related to "zero or more" vs "one or more" for `*` ref: https://github.com/microsoft/language-server-protocol/issues/2217
* | vim-patch:595d0a7: runtime(doc): wrong {str} length limit in matchfuzzy() ↵zeertzjq2026-06-10
| | | | | | | | | | | | | | | | | | | | | | | | | |