summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/plugin/lsp
AgeCommit message (Collapse)AuthorFiles
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-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-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
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 Ming3
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-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. Keyes1
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-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-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-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-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-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_foreachtris2031
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-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. Keyes1
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.
2026-03-11feat(lsp): do completionItem/resolve if completeopt=popup #32820glepnir1
Problem: No completionItem/resolve handler. Solution: If completeopt=popup is set, invoke completionItem/resolve when a completion item is selected. Show resolved documentation in popup next to the completion menu.
2026-03-10feat(lsp): show snippet preview if completeopt=popup #32553glepnir1
Problem: LSP completion does not show snippet preview. Solution: Show snippet preview if 'completeopt' includes popup.
2026-03-10fix(lsp): do not clear the codelens on the last line #38226Yi Ming1
Problem The logic that clears codelenses beyond the buffer also removes the codelenses on the last line. Solution Do not clear the codelens on the last line.
2026-03-08fix(lsp): ensure the codelens on the first line is visibleYi Ming1
2026-03-08fix(lsp): adjust codelens position based on the server-provided rangeYi Ming1
2026-03-04fix(lsp): ignore stale codelens resolve responses (#38153)Lewis Russell1
2026-02-28feat(lsp): show color preview in completion items #32138glepnir1
Problem: Color completion items display as plain text without visual preview Solution: Parse RGB/hex colors from documentation and render with colored symbol ■
2026-02-26fix(lps): separate namespaces for pull/push diagnostics #37938Riccardo Mazzarini1
Problem: Regression from b99cdd0: Pull diagnostics (from `textDocument/diagnostic`) and push diagnostics (from `textDocument/publishDiagnostics`) use the same namespace, which is a problem when using language servers that publish two different sets of diagnostics on push vs pull, like rust-analyzer (see https://github.com/rust-lang/rust-analyzer/issues/18709#issuecomment-2551394047). Solution: Rename `is_pull` to `pull_id` which accepts a pull namespace instead of just a boolean.
2026-02-26test: remove remaining use of feed_command() in terminal/ (#38069)zeertzjq1
Also deduplicate screen lines in some other tests.
2026-02-25test(lsp): flaky lsp/semantic_tokens_spec #38063zeertzjq1
The wait added in #37853 doesn't seem to do anything as request is sent immediately on InsertLeave, and the number 4 also seems wrong. Instead, the actual cause for the flakiness that the feed() (and hence the buffer change) may arrive before the scheduled initialization of capabilities, causing there be only only one textDocument/semanticTokens/full request instead of two.
2026-02-24refactor(test): lsp completion spec cleanup #38041glepnir1
Problem: retry/feed/tbl_map patterns duplicated everywhere, detach check was a false negative Solution: extract wait_for_pum/extract_word_abbr/word_sorter helpers, fix assert_cleanup_after_detach with positive+negative pum confirmation
2026-02-24refactor(test): avoid deprecated functions #37017glepnir1
Problem: Tests are using some deprecated functions. Solution: Replace with command, pcall_err, etc.
2026-02-22fix(lsp): vim.lsp.completion clean up triggers on client detach (#38009)glepnir1
Problem: LspDetach didn't clean up stale client refs in triggers table. Solution: create LspDetach autocmd and call disable_completion.
2026-02-19test(lsp): fix fake LSP server timeout not working (#37970)zeertzjq1
Problem: Fake LSP server does not timeout or respond to SIGTERM as it does not run the event loop. Solution: Instead of io.read(), use stdioopen()'s on_stdin callback to accumulate input and use vim.wait() to wait for input. Also, in the test suite, don't stop a session when it's not running, as calling uv.stop() outside uv.run() will instead cause the next uv.run() to stop immediately, which cancels the next RPC request.
2026-02-18test(lsp): add entire-line completion word case (#37927)Bartłomiej Maryńczak1
Problem: Multiword completion items used to be cut at a first word. Solution: Add a test that ensures this does not regress in the future
2026-02-15test(lsp): wait up to 1 second to read messagesWayne Young1
2026-02-14refactor(lsp): centralize provider capability resolution #37221Tristan Knight1
- Refactor LSP client to use unified provider-based capability lookup for diagnostics and other features. - Introduce `_provider_value_get` to abstract capability retrieval, supporting both static and dynamic registrations. - Update diagnostic handling and protocol mappings to leverage provider-centric logic.
2026-02-09fix(lsp): error on omnifunc completion (#37790)phanium1
Problem: After eaacdc9, complete with emmylua_ls error with: runtime/lua/vim/lsp/completion.lua:586: attempt to get length of field 'items' (a nil value) Solution: Result can be CompletionItem[] according the spec: > If a `CompletionItem[]` is provided, it is interpreted to be complete, > so it is the same as `{ isIncomplete: false, items }`
2026-02-08fix(lsp): ignore empty response on trigger completion #37663Tomasz N1
Problem: Empty response affects server start boundary computed before. Solution: Ignore empty responses. This is mostly micro-optimization that avoids extending existing results with empty responses.
2026-02-08test(lsp/diagnostic): clearing diagnostics #37759GenchoXD1
Problem: Diagnostic lifecycle invariants (clearing on empty publish and buffer deletion) were previously implicit and not directly covered by functional tests, allowing regressions to go unnoticed. Solution: Add functional regression tests asserting that diagnostics are cleared when an LSP server publishes an empty diagnostic set and when the associated buffer is deleted. Assertions are scoped to the client diagnostic namespace and use public diagnostic APIs only.
2026-02-08feat(lsp): display codelens as virtual lines, not virtual text #36469Mike J McGuirk1
Problem: Code lenses currently display as virtual text on the same line and after the relevant item. While the spec does not say how lenses should be rendered, above the line is most typical. For longer lines, lenses rendered as virtual text can run off the side of the screen. Solution: Display lenses as virtual lines above the text. Closes https://github.com/neovim/neovim/issues/33923 Co-authored-by: Yi Ming <ofseed@foxmail.com>
2026-02-05test(lsp): retry "on_type_formatting enables formatting on type" #37711Justin M. Keyes1
FAILED test/functional/plugin/lsp/on_type_formatting_spec.lua @ 59: vim.lsp.on_type_formatting enables formatting on type test/functional\plugin\lsp\on_type_formatting_spec.lua:65: retry() attempts: 1 test/functional\plugin\lsp\on_type_formatting_spec.lua:66: Expected objects to be the same. Passed in: (table: 0x01772f47b6d8) { [1] = 'int main() {' *[2] = ' int hi = 5' [3] = '}' } Expected: (table: 0x017731aad3a8) { [1] = 'int main() {' *[2] = ' int hi = 5;' [3] = '}' } stack traceback: test\testutil.lua:89: in function 'retry' test/functional\plugin\lsp\on_type_formatting_spec.lua:65: in function <test/functional\plugin\lsp\on_type_formatting_spec.lua:59>