aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin
Commit message (Collapse)AuthorAge
* fix(lsp): ignore completion items without LSP metadata #42401Volodymyr Chernetskyi3 days
| | | | | | | | | | | | Problem: Accepting an item from another completion source raises an error when its user_data.nvim table does not contain LSP metadata. Solution: Retrieve and guard the nested LSP metadata before accessing its fields. Cover acceptance of a foreign completion item without LSP metadata. AI-assisted
* fix(lsp): keep label fallback for empty snippet insertText #42402Volodymyr Chernetskyi3 days
| | | | | | | | | | | | Problem: An empty snippet insertText falls back to the label during selection, but acceptance clears that label and expands an empty string. Solution: Require nonempty insertText before expanding a snippet without textEdit. Extend the omnifunc acceptance fixture with an empty snippet insertion. AI-assisted
* fix(lsp): preserve explicit completion edit ranges #42399Volodymyr Chernetskyi3 days
| | | | | | | | | | | | Problem: A completion list default edit range can replace the explicit range of an InsertReplaceEdit, filtering out valid items or changing their replacement. Solution: Only synthesize a default text edit when the completion item has none. Extend the existing itemDefaults test for explicit edits with both range variants. AI-assisted
* fix(lsp): prefer textEdit for snippet completion text #42400Volodymyr Chernetskyi3 days
| | | | | | | | | | | | Problem: Snippet completion words and previews prefer insertText even when textEdit is present, although the actual expansion uses textEdit.newText. Solution: Use the text edit before the fallback insertion text in both selectors. Extend the existing precedence test to check the snippet word and preview. AI-assisted
* fix(health): run provider probes only once #42391Volodymyr Chernetskyi4 days
| | | | | | | | | | | | | Problem: Provider checks start and wait for a job, then execute the same command again to obtain its output. The returned output can disagree with the first process's exit status, and the second execution has no timeout. Solution: Return the first job's captured output. Bind the output callbacks to their state and preserve line breaks between callback data entries. Cover invocation count, multiline stdout, and merged stderr. AI-assisted
* test: simplify functional test expectationsLewis Russell2026-10-05
| | | | | | | | | | | | Problem: Repeated default fields and field-by-field assertions obscure the values that each functional test is meant to check. Solution: Add eq_partial() to check selected record fields while preserving list length and order. Use local helpers to fill fixed expected defaults where tests need full equality. Keep explicit absence checks and test-specific values at the call sites. AI-assisted
* feat(lsp): support client_id in vim.lsp.completion.get() #42189glepnir2026-10-03
| | | | | | | | | Problem: vim.lsp.completion.get() always asks every client that has completion enabled in the buffer, so a mapping cannot ask just some of them. Solution: Add a "client_id" option that limits the request to the given client, or clients if it is a list.
* fix(pack): ignore inherited GIT_INDEX_FILE #42114Jake Wang2026-09-30
| | | | | | | | | | | | Problem: An inherited Git index can leave a plugin checkout empty or prevent updates. Solution: Clear GIT_INDEX_FILE for plugin Git commands. Verify installs and updates preserve the caller environment and index. AI-assisted Signed-off-by: Jake Wang <jakezwang@users.noreply.github.com>
* Merge pull request #42134 from lewis6991/emmyluaLewis Russell2026-09-30
|\ | | | | fix(lua): enable param-type-mismatch diagnostic
| * fix(lua): enable param-type-mismatch diagnosticLewis Russell2026-09-28
| | | | | | | | | | | | | | | | | | Problem: Argument type mismatches are excluded from EmmyLua checks. Solution: Correct runtime annotations and calls, document local checker workarounds, and enable the diagnostic. AI-assisted
| * fix(editorconfig): handle root separately from propertiesLewis Russell2026-09-28
| | | | | | | | | | | | | | | | | | Problem: A child root=false masks a parent root=true during merging. Solution: Return the search boundary separately from string properties. Exclude root from property callbacks and b:editorconfig. AI-assisted
* | fix(lsp): preserve completion state on buffer reload #42135Barrett Ruth2026-09-29
| | | | | | | | | | | | | | | | | | | | | | Problem: After an LSP client restart, the completion reload callback can use an old client ID: autoread: :checktime failed for buffer 17: Vim:Lua callback: ...ed-95df8c0/share/nvim/runtime/lua/vim/lsp/completion.lua:1315: invalid client ID Solution: Use the completion augroup for `BufUnload` cleanup.
* | feat(treesitter): add get_captures() for positions and rangesLewis Russell2026-09-28
|/ | | | | | | | | | | | | | | | | Problem: get_captures_at_pos() only returns captures at one position. It cannot query a whole line or range. It can also miss captures from injected languages outside the visible area. Solution: Add vim.treesitter.get_captures() with a required start and an optional exclusive stop. Accept row numbers or {row, col} positions. Without a stop, query one position or a whole line. Parse the requested range and return capture coordinates. Deprecate get_captures_at_pos() with a compatibility wrapper and migrate its internal callers. Keep get_captures_at_cursor() for capture names at a window's cursor. AI-assisted
* vim-patch:9.2.1114: Visual selection is not highlighted at the cursor ↵Takumi Katase2026-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | position #42105 vim-patch:9.2.1114: Visual selection is not highlighted at the cursor position Problem: In a terminal the character under the cursor is normally not shown as part of the visual selection. Solution: Don't set "noinvcur" in win_line() (Shane Harper). The problem did not occur in the GUI, only in a terminal. The name "noinvcur" ("don't invert the cursor") was misleading: the variable did not affect the cursor, but whether the character under the cursor could be displayed as part of the visual selection. The "noinvcur" handling may have been meant to help during a visual selection when Visual is shown in reverse video and the terminal draws the cursor by inverting the character under it, as otherwise the character under the cursor would not look highlighted like the rest of the selection. But Vim cannot know in general how a terminal draws the cursor, and when either the cursor is not drawn by inverting the character under it or Visual is not shown in reverse video, the handling just left a character of the visual selection unhighlighted. closes: vim/vim#21317 https://github.com/vim/vim/commit/d10aab4ba6602f8f2f2576d2d62ceb63869db6fb Co-authored-by: Shane Harper <shane@shaneharper.net> AI-assisted
* perf(lua): share compatible file watchersLewis Russell2026-09-24
| | | | | | | | | | | | | | | | | | Problem: LSP servers can register identical file watchers before removing old registrations. Each registration creates another watcher tree, making setup and teardown expensive in large workspaces. Solution: Move glob compilation into vim._watch and accept rules for multiple roots alongside existing single-path and LPeg inputs. Share compatible backends until their last subscription is cancelled. Ref: #23291 AI-assisted
* fix(lsp): silently ignore unknown folding range kinds (#41964)Maria Solano2026-09-18
|
* fix(lua): add missing param annotations (#41911)Lewis Russell2026-09-15
|
* feat(dir): open entries in splits with a, o mappings #41834Barrett Ruth2026-09-11
|
* test(health): avoid async report completion flake #41859Barrett Ruth2026-09-11
| | | | | | | | | Problem: :checkhealth yields between reports, so n.expect() can inspect the buffer before the final report is appended. Solution: Wait for the report buffer to become nomodifiable before asserting its contents.
* fix(lsp): snippet is not expanded when resolve races the user #41774glepnir2026-09-11
| | | | | | | | | | | Problem: on_complete_done() defers clear_word() and the snippet expansion until completionItem/resolve answers, and drops both when 'changedtick' moved meanwhile. Typing right after accepting leaves the plain word in the buffer. Solution: Expand before requesting, and anchor the resolved edits with an extmark instead of gating them on 'changedtick'.
* feat(lsp): support timeout_ms for async formatting #41850Barrett Ruth2026-09-11
| | | | | | | | | Problem: `vim.lsp.buf.format()` does not support a timeout for asynchronous requests. Solution: Honor an explicit timeouts per client so formatting can continue. Do not permit a default value for async format requests.
* feat(health): async healthchecks #41673Barrett Ruth2026-09-11
| | | | | | | | | Problem: :checkhealth blocks as healthchecks perform slow work. Solution: Partially fix it: run Lua healthchecks in vim.async tasks and await vim.health subprocesses. Existing synchronous checks still block until they leverage the new apis.
* fix(lsp): stale client when rpc.connect fails #41792stenja2026-09-09
| | | | | | | | | | | | | | | | Problem: When vim.lsp.rpc.connect is used for an LSP and the connection fails (due to ECONNREFUSED, for example), the LSP client is left uninitialized. Subsequent calls to vim.lsp.start will reuse the uninitialized client, but no new connection will be attempted. Solution: When vim.lsp.rpc.connect encounters a connection error, terminate the client. This allows the user to do something in response to the failed connection in the on_exit callback, and also makes it so subsequent attempts to start the LSP will try to establish a new connection rather than using the previous uninitialized client. Co-authored-by: Jason Stenftenagel <jasonstenftenagel@gmail.com>
* feat(lsp): support `workspace/foldingRange/refresh` #41780Volodymyr Chernetskyi2026-09-09
| | | | | | | | | | | Problem: Servers cannot request refreshing stale LSP folding ranges after a project-wide change. Solution: Advertise `workspace.foldingRange.refreshSupport` and re-request folding ranges for active buffers when handling `workspace/foldingRange/refresh`. AI-assisted
* fix(lsp): newlines in the completion word from insertText #41801glepnir2026-09-09
| | | | | | | | Problem: A textEdit is cut to its first line but an insertText is not, so its newlines reach the |complete-items| word. Solution: Cut it the same way.
* feat(watch): add on_error callbackLewis Russell2026-09-09
| | | | | | | | | | | | | | Problem: Watcher failures are reported inconsistently, and callers cannot detect when a watcher is no longer usable. Solution: Route startup and event failures and unexpected inotifywait exits through an optional on_error callback. Log to nvim-watch.log by default. Ignore disappearing child directories and exits caused by cancellation. Let LSP log failures and notify once per message, using INFO for missing roots and ERROR otherwise, without interrupting registration. AI-assisted
* fix(lsp): completion dynamicRegistration breaks capability readers #41771glepnir2026-09-08
| | | | | | | | | | Problem: A server that supports dynamic registration must not also declare completionProvider at initialize, so server_capabilities.completionProvider is nil for anything reading it directly. Solution: Do not advertise it by default. A client that follows a registration can declare it itself.
* fix(lsp): semantic tokens ignore 'fileformat' when sizing line endings #41733Volodymyr Chernetskyi2026-09-07
| | | | | | | | | | | | | | | | | | | | Problem: The eol_offset used to decode multiline semantic tokens is computed as vim.bo.fileformat[bufnr] == 'dos' and 2 or 1 which indexes the option value rather than the buffer, so it is never "dos" and the offset is always 1. A token that crosses a line boundary in a 'fileformat' of "dos" is then decoded one code unit short per line ending, and the highlight extends past the end of the token. Solution: Read the option with the buffer-scoped form, vim.bo[bufnr].fileformat. The existing multiline test covers both formats now. Its token length of 82 counts the line endings it spans, so the same token reaches four characters less far once the buffer is "dos". AI-assisted
* build: replace LuaLS with EmmyLuaLewis Russell2026-09-07
| | | | | | | | | | | | | | | Problem: LuaLS struggles with the generics used in Nvim's runtime, requiring broad diagnostic suppressions. Indexing is also slow. Solution: Use EmmyLua for type checks in the build and CI. It offers more sophisticated type checking, substantially better support for generics, and much better flow analysis. Correct the affected annotations. Use `@internal`, supported directly by EmmyLua, instead of `@nodoc` for shared internal declarations, and support it in the help parser. AI-assisted
* feat(lsp): support dynamic registration of completionProvider #41748glepnir2026-09-07
| | | | | | | | Problem: dynamicRegistration is declared false, and completionProvider is read from server_capabilities only. Solution: Declare it, and prefer registerOptions per field.
* fix(msgpack): strptime() fails east of UTC+12 #41743Volodymyr Chernetskyi2026-09-07
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: msgpack#strptime() finds a timestamp by bisecting strftime() output, and brackets the search with the extreme UTC offsets. The lower bound subtracts 12 hours, but -12:00 is the westernmost offset, which produces the *largest* timestamp for a given local time. The easternmost offset is +14:00, so in any zone east of UTC+12 the search can start above the target and the function throws: internal-start-string:Internal error: start > string With TZ=GMT-14, four of the five timestamps in msgpack_spec.lua fail, as do three tests in shada_spec.lua, which reaches the same function through shada#strings_to_sd(). Solution: Subtract 14 hours instead. The upper bound is already generous enough at +14, and widening a bisection bracket downwards cannot change the result in zones that worked before. The test disables the python3 provider, because msgpack#strptime() only uses the Vimscript implementation changed here when no provider answers, and otherwise hands the work to datetime.strptime(). AI-assisted
* refactor(optwin): use current window as fallbackaltermo2026-09-07
|
* fix(lsp): separate adjacent nested folding ranges #41428wrvsrx2026-08-31
| | | | | | | | | Problem: Folding range markers are overwritten while ranges are evaluated. A range ending on a row can hide another range starting there, and multiple nested ranges ending together emit only the innermost ending level. Solution: Track starts and the number of ends per row before emitting markers. Prefer starts on shared boundary rows and use the outermost level when nested ranges end together. AI-assisted
* fix(lsp): blank line before Content-Length breaks header parsing #41524Yanze Li2026-08-29
| | | | | | | | | | | | | | Problem: A blank line before the Content-Length header makes header parsing fail with "Content-Length not found in header". An LF in the 'name' state falls through to the 'invalid' state, which only return to 'name' at the *next* LF. That LF terminates the next line, so the line with Content-Length is swallowed. The same issue happens when a junk line is a partial match of the header name (e.g. "Cont\nContent-Length: ..."). Solution: When seeing an LF in the 'name' state, reset the cursor and stay in 'name' rather than entering 'invalid'.
* fix(man): don't grow a highlight into the previous line #41490Stefan VanBuren2026-08-26
| | | | | | | | | | | | | Problem: With these two lines (`\b` marking a backspace): f\bfoo xb\bb line 1's bold run ends at byte 1 and line 2's begins at byte 1, so line 1 renders "fo" in bold rather than "f", and line 2's "b" is not bold at all. Solution: Only grow a highlight group that is on the current row.
* test: fix wrong order of args to eq(), neq() #41499zeertzjq2026-08-26
|
* revert: "fix(lsp): do not expand $VAR in tagfunc filenames" #41489Justin M. Keyes2026-08-25
| | | revert c5cb0350a6dc578e6ca73eefdd58159e1e039cbf
* fix(lsp): advance inline completion range over matching input #41434Étienne Robert2026-08-24
| | | | | | | | | | | | | | | Problem: `Completor:accept()` applies the item against the range the server answered with. Characters typed after the request but before accepting lie inside neither that range nor the replacement, so they are left behind by the insertion: typing `a` after `foob` and accepting `foobar` within the 200 ms debounce yields `foobara`. Solution: Grow the item's range over the characters typed since the request, so that `accept()` replaces them. Only while the candidate still matches, decided by the longest common prefix `show()` already computes, so input that contradicts it is left alone. Snippet items are unaffected, since `accept()` ignores the range for them.
* fix(lsp): clamp inline completion range to the line on accept #41435Étienne Robert2026-08-24
| | | | | | | | | | | | | | | | | | Problem: `Completor:accept()` hands the item's range straight to `nvim_buf_set_text()`. That range is resolved when the response arrives, so text deleted before accepting (backspacing within the 200 ms debounce) leaves the range end past what is left of the line, and the accept aborts with `Invalid 'end_col': out of range`. 18d6436 fixed the same staleness in `Completor:show()`, which drops an item once its range *start* falls outside the buffer. That guard does not cover the range end, and `accept()` was never given one, so this is a hole left by that fix rather than a regression of it. Solution: Clamp the end of the range to the end of the line before writing. The start needs no clamp: `show()` dropped the item one event loop tick earlier if it had gone out of range.
* fix(lsp): completion overwrites text before the word boundary #41463glepnir2026-08-24
| | | | | | | | | Problem: One item with an edit range before the word boundary changes the start column for all items. For tsserver `str.`, completing `str.char` can become `strcharAt` and break filtering. Solution: Prepend the missing text and filter on it.
* fix(lsp): do not expand $VAR in tagfunc filenames #41398Shubh2026-08-23
| | | | | | | | Problem: CTRL-] via lsp tagfunc passes URI paths through :tag, which expands \$VAR, so files like people_.\$personId.tsx fail with E429. Solution: fnameescape() the filename in tag items so \$ is treated as literal.
* fix(man): allow :Man to open by absolute path #41401Shubh2026-08-23
| | | | | | | | Problem: man -w echoes any existent file back unchanged. :Man rejected all such paths, so :Man /usr/share/man/man1/bash.1 failed even for real man pages. Solution: Accept an echoed path when it looks like a man page (.../man1/foo.1).
* fix(lsp): empty filterText/sortText/insertText not treated as unset #41421glepnir2026-08-22
| | | | | | | | | Problem: Empty string is falsy, so the spec's label fallback applies, but there only checks for nil. An empty filterText drops the item, an empty sortText sorts it first, and an empty insertText leaves the word empty. Solution: Treat empty string as unset.
* fix(zip): missed "password:" prompt if output trails it #41364Justin M. Keyes2026-08-18
| | | | | | | | | | | | | | Problem: Flaky test: RUN T1158 nvim.zip reports an incorrect archive password: 11092.84 ms FAIL The prompt is detected only if the pty output *ends* with "password: ", but a read may return the prompt plus following bytes. Solution: - Match anywhere in the output since the last password was sent. The buffer is cleared before each send, so won't match stale text. - Assert on the reported message, so a failure shows what was reported.
* feat(lsp): fallback to textDocument/formatting from vim.lsp.formatexpr #40079Marcus Caisey2026-08-18
| | | | | | | | | | | | | | | | Problem: With the addition of the `:help al` text object, you can now easily format the whole buffer with `gqal`. However, `vim.lsp.formatexpr` only uses `textDocument/rangeFormatting` which some language servers (like gopls) don't support. Solution: - Fall back to `textDocument/formatting` if the whole buffer is being formatted and the server doesn't support `textDocument/rangeFormatting`. - In theory, these two methods should return the same response if the whole buffer is being formatted, but I preserved the existing behaviour of prioritising `textDocument/rangeFormatting` in case that does not hold (i.e. LS bug). - Also: `vim.lsp.formatexpr` had no tests at all, so actually add tests for it.
* test(dir_spec): fix failures with PUC LuaBarrett Ruth2026-08-15
|
* feat(dir): user can sort/filter listings, DirReadPost event #41138Barrett Ruth2026-08-14
| | | | | | | | | | | | Problem: Directory listing entries cannot be customized (filtered, reordered). Listings are read by a BufReadCmd, which suppresses BufReadPost, so they are the only buffers with no post-read event to hook. Solution: Introduce a post-render User autocmd `DirReadPost`, marking the dir buffer writable for the duration and before the cursor is placed, so handlers can sort or filter it with ordinary commands. Document common recipes
* Merge #41075 from echasnovski/pack-packspec-part1Justin M. Keyes2026-08-13
|\
| * feat(pack): add support for sourcing manifest scriptsEvgeni Chasnovski2026-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: No way for plugins to define hooks that would be executed during plugin lifecycle. Like after install/update or before update/delete. Solution: Automatically source scripts defined in plugin manifest file (if any) after triggering corresponding `PackChanged{,Pre}` events. During sourcing make some termporary adjustments: - Current directory is set to plugin's root to simplify execution of CLI calls like `make build`. - Plugin's path is ensured to be inside 'runtimepath' to allow using `require('plugin-module')` inside manifest scripts. The reason to execute after triggering event is so that there is a possibility for users to execute code both before the script (exactly on event) and after the script (more-or-less via `vim.schedule` called on the event).
| * feat(pack): introduce plugin manifest supportEvgeni Chasnovski2026-07-31
| | | | | | | | | | | | | | | | | | Problem: There is no agreed way for plugins to provide extra information about themselves. Like required Neovim version, install/update/delete hooks, and dependencies. Solution: Introduce basic concept of plugin manifest file `pkg.json` based on https://packspec.org/.