summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/plugin
AgeCommit message (Collapse)AuthorFiles
2026-04-24fix(lsp): handle self-mapped methods in supports_method #39383nightlyTristan Knight1
Problem: The LSP client incorrectly checks for server capabilities when determining support for self-mapped methods (e.g., 'shutdown'), which do not have corresponding capabilities in the server's response. This leads to false negatives when checking if such methods are supported. This was handled correctly for dynamic registrations, but not for static. Methods such as 'shutdown', do not have a related server capability and should be assumed to be supported. Solution: Update the `supports_method` logic to always return true for self-mapped methods.
2026-04-24feat(tui): restore 'ttyfast' to control tty requests #38699Kyle1
Problem: When running nvim on a remote machine over SSH, if there is high ping, then bg detection may not complete in time. This results in a warning every time nvim is started. #38648 Solution: Restore 'ttyfast' option and allow it to control whether or not bg detection is performed. Because this is during startup and before any user config or commands, we use the environment variable `NVIM_NOTTYFAST` to allow disabling `ttyfast` during initialization.
2026-04-24test: curbuf initialized in describe-block #39365glepnir1
Problem: curbuf was initialized at describe-block load time before any Nvim session existed. Solution: Replace with 0 directly at call sites.
2026-04-24fix(lsp): more info in error msg, deduplicate test #39359Justin M. Keyes1
2026-04-23fix(lsp): handle null id in JSON-RPC responses #38340atusy1
Problem: LSP spec allows response message to have a null request-id. This may happen when for example client sends unparseable request. https://github.com/microsoft/language-server-protocol/issues/196 Solution: Guard the server response branches against id=vim.NIL (json null), and handle error responses with null id by logging a warning and dispatching on error. Problem: CI (ubuntu asan, ubuntu tsan, windows) reports `uv_loop_close() hang?` from the two new null-id response tests. The leaked handle is the server-side accepted TCP socket created inside `server:listen` callback. The tests closed only the listener but not the accepted socket, so libuv could not finish shutting down the loop and each test session took ~2s extra to exit. Solution: Hoist the accepted socket to the outer `exec_lua` scope and close it at teardown before closing the listener. The close runs synchronously inside `exec_lua`, so the loop has time to dispose the handle before the session exits. * test(lsp): close accepted socket on read-loop exit/error Match the precedent in the handler test ("handler can return false as response") and the shared `_create_tcp_server` helper in `test/functional/plugin/lsp/testutil.lua`: close the accepted socket from inside the `create_read_loop` exit/error callbacks. The teardown close added in the previous commit remains as belt-and-suspenders, so the socket is disposed whether the server goes away first or the client does.
2026-04-23fix(pack): only use tags that strictly comply with semver spec #39342Evgeni Chasnovski1
Problem: Using `version=vim.version.range(...)` in plugin specification is meant to use semver-like tags. Whether a tag is semver-like was decided by a plain `vim.version.parse` which is not strict by default. This allowed treating tags like `nvim-0.6` (which is usually reserved for the latest revision compatible with Nvim<=0.6 version) like semver tags and resulted in confusing behavior (preferring `nvim-0.6` tag over `v0.2.2`, for example). Solution: Use `vim.version.range(x, { strict = true })` to decide if the tag name is semver-like or not. This allows tags like both `v1.2.3` and `1.2.3` while being consistent in what Nvim thinks is a semver string. This is technically not a breaking change since it was documented that only tags like `v<major>.<minor>.<patch>` will be recognized as semver.
2026-04-23fix(lsp): callHierarchy/outgoingCalls ranges are relative to caller, not ↵Ashley Hauck1
callee #39336 Problem: The fromRanges field of the result of callHierarchy/outgoingCalls is documented as being relative to the caller. Using vim.lsp.buf.outgoing_calls() opened the qflist with an entry with the callee's filename, but the caller's line number. Solution: Open the qflist with the callers file (the bufnr from the request), rather than the callees (the uri from the resulting CallHierarchyItem)
2026-04-23fix(lsp): filter code_action diagnostics to the cursor #38988Barrett Ruth1
Problem: Cursor-position `vim.lsp.buf.code_action()` requests include all diagnostics on the current line, so unrelated same-line diagnostics affect the returned actions. Solution: Filter same-line diagnostics to the cursor position for cursor-position requests.
2026-04-22ci: drop cirrus #39321Justin M. Keyes1
Problem: cirrus will shutdown soon, and we are running out of minutes anyway, which causes ci failures. Solution: Drop cirrus config.
2026-04-22fix(pack): GIT_DIR/GIT_WORK_TREE env vars may interfere #39279fleesk1
Problem: With GIT_DIR/GIT_WORK_TREE set, the LSP on the vim.pack.update() confirmation buffer does not show the correct git log on hover. Solution: Temporarily remove the git vars from the environment.
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes3
2026-04-18fix(lsp): show CompletionItem.detail in info popup #38904glepnir1
Problem: completionItem/resolve response's `detail` field is silently dropped. Only `documentation` is shown in the popup. Solution: Prepend `detail` as a fenced code block before `documentation` in the info popup, skipping if documentation already contains it.
2026-04-18docs: misc #39045Justin M. Keyes1
2026-04-18fix(lsp): skip codelens refresh redraw for deleted buffer #39193Jaehwang Jung1
Problem: After on_refresh() sends a textDocument/codeLens request, the buffer may be deleted before the response arrives. The response callback then tries to redraw that deleted buffer and raises Invalid buffer id error. Solution: Check buffer validity before redrawing. AI-assisted: Codex Co-authored-by: Yi Ming <ofseed@foxmail.com>
2026-04-17test(lsp): extract buf/util parts from lsp_spec.lua #39149Yi Ming4
Problem: `test/functional/plugin/lsp_spec.lua` had grown into a large catch-all file that mixed core LSP client lifecycle coverage, `vim.lsp.buf.*` behavior, and `vim.lsp.util.*` behavior in one place. Solution: Split the large tests into more focused test files without changing test coverage or intended behavior. After this change, `lsp_spec.lua` is more focused on core LSP client/config/dynamic-registration behavior.
2026-04-16test(pack): increase retry timeout for startup test #39125Evgeni Chasnovski1
Problem: Unreliable test on Windows which sometimes fails with too many failed retries. Solution: Increase timeout in hopes that it will be enough to make it pass more frequently. This should not affect fast and already working platforms.
2026-04-15fix(lsp): set 'winfixbuf' in open_floating_preview() window #39058Raizento1
Problem: The window opened by `vim.lsp.util.open_floating_preview()` allows its buffer to be switched. Presumably that only happens by accident and is disorienting. Solution: Set 'winfixbuf' in the open_floating_preview() window.
2026-04-15refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes2
2026-04-15feat(lsp): highlight foldtext via treesitter #38789Yi Ming1
Problem: To support `collapsedText`, which allows the LSP server to determine the content of the foldtext, we provided `vim.lsp.foldtext()`. However, such content does not have highlighting. Solution Treat the filetype of `collapsedText` as the filetype of the corresponding buffer and use tree-sitter to highlight it.
2026-04-14test(pack): use n.rmdir() to delete directories #39046Evgeni Chasnovski1
Problem: using `vim.fs.rm(dir_path, { force = true, recursive = true })` can result in an error on Windows if the process has a handle to it. Solution: Use `n.rmdir()` helper in cases when its possible side effects (like changing working directory) does not matter.
2026-04-14docs: lsp, options, api #38980Justin M. Keyes1
docs: lsp, options - revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b74 Close #38991 Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-13feat(completion): completeopt=preselect, LSP CompletionItem.preselect #36613glepnir1
Problem: LSP CompletionItem.preselect is not supported. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionClientCapabilities Solution: - Add "preselect" field to complete-items and "preselect" flag to 'completeopt'. - Set preselectSupport=true in LSP client capabilities.
2026-04-12fix(lsp): show_document can't position cursor past EOL in insert-mode #38566Lars Debor1
Problem: vim.lsp.util.show_document insert mode is unable to set the cursor after the target character position if the target character is at end of line. Solution: Move cursor after the target character (in append position) in this case.
2026-04-12fix(lsp): send didOpen on save to all clients+groups #37454Emilv21
Problem: _get_and_set_name edits the name for the whole group, thus only one client per group gets the didOpen message. Solution: move the logic to _changetracking and loop over every client per group.
2026-04-08fix(lsp): apply_text_edits causes unwanted BufDelete events #38778glepnir1
Problem: Since 2f6d1d3c887a87d9402137425b418dd12a904aac, `apply_text_edits` unconditionally sets `buflisted=true`, causing spurious BufDelete events if plugins restore the original 'buflisted' state on unlisted buffers: https://github.com/neovim/neovim/blob/65ef6cec1cb766334c59d3255595dfe523b11020/src/nvim/option.c#L2159-L2169 Solution: - Don't set 'buflisted' in `apply_text_edits`. Set it more narrowly, in `apply_workspace_edit` where the semantics requires affected buffers to be visible to the user. - Also skip setting 'buflisted' if it would not be changed, to avoid redundant `OptionSet` events.
2026-04-08fix(diagnostics)!: restore `is_pull` namespace argument #38698Maria Solano1
Problem: The current LSP diagnostic implementation can't differ between a pull diagnostic with no identifier and a set of diagnostics provided via push diagnostics. "Anonymous pull providers" are expected by the protocol https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticOptions , depending on how the capability was registered: - Dynamic registrations have an identifier. - Static registrations will not. Solution: Restore the `is_pull` argument removed in https://github.com/neovim/neovim/pull/37938, keeping the identifier of pull diagnostic collections.
2026-04-08fix(health): misleading warnings re filetypes registered w/ ↵Barrett Ruth1
vim.filetype.add() #38867 Problem: `:checkhealth vim.lsp` validates configured filetypes against `getcompletion('', 'filetype')`. This only reflects runtime support files. This causes false warnings in `:checkhealth vim.lsp` for configured filetypes that are known to the Lua filetype registry, including values added with `vim.filetype.add()` and built-in registry-only filetypes. Solution: Build the healthcheck's known-filetype set from both `getcompletion('', 'filetype')` and `vim.filetype.inspect()`.
2026-03-30feat(lsp): respect 'switchbuf' for jump commands, drop `reuse_win` #38510Yi Ming1
Problem: LSP jump operations such as `buf.definition`/`buf.type_definition` do not follow the 'switchbuf' option. Instead their behavior is controlled by `vim.lsp.LocationOpts.reuse_win`. When `reuse_win=true`, the effect is very similar to `set switchbuf=useopen`. Note that functions like `buf.definition` open the quickfix window when there are multiple results, and jumping between quickfix entries already follows 'switchbuf', so unifying the behavior is more intuitive. Solution: Follow the 'switchbuf' option and drop `reuse_win`. We can achieve this behavior by using :cfirst when the quickfix list has only one item, rather than customizing the jump logic as before.
2026-03-29fix(lsp): highlight snippet preview when server can't completionItem/resolve ↵Marcus Caisey1
(#38534) Problem: The snippet preview is not being highlighted by treesitter for completion items from servers which don't support `completionItem/resolve` (like gopls). This was broken by #38428. Solution: Call `update_popup_window` after updating the completion item with the snippet preview. I've added assertions to the `selecting an item triggers completionItem/resolve + (snippet) preview` test case which covers the snippet preview being shown since no tests failed when I removed the `nvim__complete_set` call which actually populates the preview on this codepath.
2026-03-29feat: extend vim.Pos, vim.Range #36397Luis Calle1
Problem: Using nested `vim.Pos` objects to represent each `vim.Range` object requires 3 tables for each `vim.Range`, which may be undesirable in performance critical code. Using key-value tables performs worse than using array-like tables (lists). Solution: Use array-like indices for the internal fields of both `vim.Pos` and `vim.Range` objects. Use a metatable to allow users to access them like if they were key-value tables. --- Problem: The `vim.Pos` conversion interface for `extmark` indexing does not take into account the difference in how a position on top of a newline is represented in `vim.Pos` and `extmark`. - `vim.Pos`: for a newline at the end of row `n`, `row` takes the value `n + 1` and `col` takes the value `0`. - `extmark`: for a newline at the end of for `n`, `row` takes the value `n` and `col` takes the value `#row_text`. Solution: Handle this in the `extmark` interface. --- Problem: Not all `to_xxx` interfaces have wrapping objects like `to_lsp`. Solution: Return unwrapped values in `to_xxx` interfaces where it makes sense. Accept unwrapped values in "from" interfaces where it makes sense. --- Problem: `start` and `end` positions have different semantics, so they can't be compared. `vim.Range` relies on comparing the `end` and `start` of two ranges to decide which one is greater, which doesn't work as expected because this of the different semantics. For example, for the ranges: local a = { start = { row = 0, col = 22, }, end_ = { row = 0, col = 24, }, } local b = { start = { row = 0, col = 17, }, end_ = { row = 0, col = 22, }, } in this code: local foo, bar = "foo", "bar" -- |---||-| -- b a The range `b` is smaller than the range `a`, but the current implementation compares `b._end` (`col = 22`) and `a.start` (`col = 22`) and concludes that, since `b.col` is not smaller than `a.col`, `b` should be greater than `a`. Solution: - Use a `to_inclusive_pos` to normalize end positions inside of `vim.Range` whenever a comparison between a start and an end position is necessary.
2026-03-29test: fix s390x failuresJustin M. Keyes2
Problem: failures in s390x CI. Solution: - runtime/lua/man.lua: parse_path() can return nil but 3 callers didn't handle it. - skip some tests on s390x. TODO: - TODO: why "build/bin/xxd is not executable" on s390x? - TODO: other failures, not addressed (see below). OTHER FAILURES: FAILED test/functional/treesitter/fold_spec.lua @ 87: treesitter foldexpr recomputes fold levels after lines are added/removed test/functional/treesitter/fold_spec.lua:95: Expected objects to be the same. Passed in: (table: 0x4013c18940) { [1] = '0' [2] = '0' [3] = '0' *[4] = '0' [5] = '0' ... Expected: (table: 0x4005acf900) { [1] = '0' [2] = '0' [3] = '>1' *[4] = '1' [5] = '1' ... stack traceback: (tail call): ? test/functional/treesitter/fold_spec.lua:95: in function <test/functional/treesitter/fold_spec.lua:87> FAILED test/functional/treesitter/select_spec.lua @ 52: treesitter incremental-selection works test/functional/treesitter/select_spec.lua:63: Expected objects to be the same. Passed in: (string) 'bar(2)' Expected: (string) 'foo(1)' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:63: in function <test/functional/treesitter/select_spec.lua:52> FAILED test/functional/treesitter/select_spec.lua @ 69: treesitter incremental-selection repeat test/functional/treesitter/select_spec.lua:82: Expected objects to be the same. Passed in: (string) '2' Expected: (string) '4' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:82: in function <test/functional/treesitter/select_spec.lua:69> FAILED test/functional/treesitter/select_spec.lua @ 98: treesitter incremental-selection history test/functional/treesitter/select_spec.lua:111: Expected objects to be the same. Passed in: (string) 'bar(2)' Expected: (string) 'foo(1)' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:111: in function <test/functional/treesitter/select_spec.lua:98> FAILED test/functional/treesitter/select_spec.lua @ 186: treesitter incremental-selection with injections works test/functional/treesitter/select_spec.lua:201: Expected objects to be the same. Passed in: (string) 'lua' Expected: (string) 'foo' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:201: in function <test/functional/treesitter/select_spec.lua:186> FAILED test/functional/treesitter/select_spec.lua @ 216: treesitter incremental-selection with injections ignores overlapping nodes test/functional/treesitter/select_spec.lua:231: Expected objects to be the same. Passed in: (string) ' )' Expected: (string) ' foo(' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:231: in function <test/functional/treesitter/select_spec.lua:216> FAILED test/functional/treesitter/select_spec.lua @ 307: treesitter incremental-selection with injections handles disjointed trees test/functional/treesitter/select_spec.lua:337: Expected objects to be the same. Passed in: (string) 'int' Expected: (string) '1}' stack traceback: (tail call): ? test/functional/treesitter/select_spec.lua:337: in function <test/functional/treesitter/select_spec.lua:307> ERROR test/functional/treesitter/parser_spec.lua @ 562: treesitter parser API can run async parses with string parsers test/functional/treesitter/parser_spec.lua:565: attempt to index a nil value stack traceback: test/functional/testnvim/exec_lua.lua:124: in function <test/functional/testnvim/exec_lua.lua:105> (tail call): ? (tail call): ? test/functional/treesitter/parser_spec.lua:563: in function <test/functional/treesitter/parser_spec.lua:562> FAILED test/functional/core/job_spec.lua @ 1157: jobs jobstop() kills entire process tree #6530 test/functional/core/job_spec.lua:1244: retry() attempts: 94 test/functional/core/job_spec.lua:1246: Expected objects to be the same. Passed in: (table: 0x401dd74b30) { [name] = 'sleep <defunct>' [pid] = 33579 [ppid] = 1 } Expected: (userdata) 'vim.NIL' stack traceback: test/testutil.lua:89: in function 'retry' test/functional/core/job_spec.lua:1244: in function <test/functional/core/job_spec.lua:1157>
2026-03-27fix(pack): set `source` in progress report #38511Evgeni Chasnovski1
Problem: Progress reports via `nvim_echo()` gained an ability to set `source` and `vim.pack` doesn't currently set one. Solution: Set `source` to 'vim.pack'. Ideally, the title then can be something else more informative (like "update", "download", etc.), but it is used when showing progress messages. So it has to be "vim.pack" in this case.
2026-03-24fix(pack): add trailing newline to lockfile #38469Justin Mayhew1
Problem: JSON files should end with a trailing newline so that Unix tools work as expected, Git doesn't report "No newline at end of file" and to avoid noise in diffs from editors and other tools adding the missing newline. Solution: Add trailing newline.
2026-03-24test(lsp): get_configs resolves only necessary configsJustin M. Keyes1
2026-03-23fix(lsp): completion word includes leading space from label #38435glepnir1
Problem: clangd prepends a space/bullet indicator to label. With labelDetailsSupport enabled, the signature moves to labelDetails, making label shorter. This flips the length comparison in get_completion_word, causing it to use item.label directly and insert the indicator into the buffer. Solution: only prefer filterText over label when label starts with non-keyword character in get_completion_word fallback branch.
2026-03-23fix(lsp): snippet preview blocked completionItem/resolve request #38428glepnir1
Problem: Generating snippet preview in get_doc() populated the documentation field before resolve, so the resolve request was never sent. Solution: Move snippet preview logic into on_completechanged and the resolve callback so it no longer blocks the resolve request.
2026-03-23fix(runtime)!: move "tohtml" to pack/dist/opt/ #34557Justin M. Keyes1
Problem: The "tohtml" plugin is loaded by default. Solution: - Move it to `pack/dist/opt/nvim.tohtml/`, it is an "opt-in" plugin now. - Document guidelines. - Also revert the `plugin/` locations of `spellfile.lua` and `net.lua`. That idea was not worth the trouble, it will be too much re-education for too little gain.
2026-03-22revert: "feat(lsp): add `buftypes` field to `vim.lsp.Config`" #38421Maria Solano1
revert: "feat(lsp): add `buftypes` field to `vim.lsp.Config` (#38380)" This reverts commit cfcdbcf638b5957213b3c1a55d5d1b5659a2fb3e.
2026-03-21feat(lsp): add `buftypes` field to `vim.lsp.Config` (#38380)Barrett Ruth1
Problem: `vim.lsp.enable()` skips buffers with `buftype` set, even when `filetype` matches. Solution: Add `buftypes` field to `vim.lsp.Config`.
2026-03-21feat(lsp): support CompletionItem.labelDetails #38403glepnir1
Problem: CompletionItem.labelDetails is ignored, losing function signatures and module info in the completion menu. Solution: Append labelDetails.detail to abbr and use labelDetails.description for menu with fallback to item.detail. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemLabelDetails
2026-03-19refactor(lsp): replace _provider_value_get with _provider_foreachtris2032
Introduce _provider_foreach to iterate over all matching provider capabilities for a given LSP method, handling both static and dynamic registrations. Update diagnostic logic and tests to use the new iteration approach, simplifying capability access and improving consistency across features.
2026-03-19feat(lsp): vim.lsp.get_configs() #37237Olivia Kinnear1
Problem: No way to iterate configs. Users need to reach for `vim.lsp.config._configs`, an internal interface. Solution: Provide vim.lsp.get_configs(). Also indirectly improves :lsp enable/disable completion by discarding invalid configs from completion.
2026-03-18feat(lsp): migrate `document_color` to capability framework (#38344)Maria Solano1
* feat(lsp): migrate `document_color` to capability framework * feat(lsp): use `vim.Range` in `document_color` module
2026-03-18fix(lsp): redraw codelens after request completed #38352Yi Ming1
Problem: When code lens is enabled, `on_attach` is executed, but it does not trigger a redraw. Another event, eg, moving the cursor, is required to trigger a redraw and execute the decoration provider's `on_win`. Solution: Trigger a `redraw` after each request is completed.
2026-03-17fix(lsp): respect documentation markup kind in completion preview #38338glepnir1
Problem: Completion preview always assumes plain text, ignoring LSP documentation "kind". Solution: Pass markup kind from completion item to info window, or fallback to PlainText.
2026-03-14fix(lsp): handle non-string documentation in completion items #38291glepnir1
Problem: `get_doc` throws error with "attempt to get length of a userdata value" when `item.documentation` is truthy but not a string (e.g. vim.NIL from a JSON null). Solution: Check `type(item.documentation)` before taking its length.
2026-03-13fix(completion): wrong CompleteDone reason for auto-inserted sole match #38280glepnir1
Problem: #38169 used compl_used_match to determine the CompleteDone reason, but this fires too broadly, it also changes the reason to "accept" when the popup was shown and the user dismissed it with <Esc> or <Space>, breaking snippet completion with autocomplete. Solution: Instead of checking compl_used_match in, check whether the pum was never shown (compl_match_array == NULL) in ins_compl_stop(). When a match was inserted but the pum never displayed, set the completed word so CompleteDone fires with reason "accept". This keeps the "discard" reason intact when the user dismisses a visible pum without confirming.
2026-03-12docs: use "ev" convention in event-handlersJustin M. Keyes2
Problem: In autocmd examples, using "args" as the event-object name is vague and may be confused with a user-command. Solution: Use "ev" as the conventional event-object name.
2026-03-11fix(lsp): ensure augroup before querying autocmds #38254glepnir1
2026-03-11docs: api, messages, lsp, trustJustin M. Keyes1
gen_vimdoc.lua: In prepare for the upcoming release, comment-out the "Experimental" warning for prerelease features.