summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/lsp/inline_completion.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes1
2026-04-06feat(vim.pos)!: require `buf` param on vim.pos, vim.range #38665Luis Calle1
Problem: `buf` is optional even though its needed to perform conversions and the ordering of `(buf, row, col)` is not consistent. Solution: make `buf` mandatory on `vim.range` and `vim.pos` and enforce the `buf, row, col` ordering
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-27docs(lsp): add `init_options` to Copilot example #38502Maria Solano1
Problem: When following this example from our docs the Copilot LSP won't attach. Solution: Add `init_options` as done by [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/1a6d69206749a646ef28bfb39460610b14baff40/lsp/copilot.lua#L112-L121).
2026-03-20fix(lsp): unify LSP error logging prefixes #38354Yi Ming1
Problem The format of LSP log messages is inconsistent; some include underscores, while others are not logged at all. Solution Standardize log recording and unify the log message prefixes with the module names.
2026-03-09fix(lsp): stop and close timer when `Capability` is destroyedYi Ming1
2025-12-26feat(lsp): on_accept can return item to customize behavior #37092Yi Ming1
Problem: `on_accept` is a bit cumbersome to customize. Solution: * Before: users had to override the entire `on_accept` logic for their changes to be applied. * Now: users can modify the item and return it to apply the modified changes, or return `nil` to fully customize how the changes are applied.
2025-11-09fix(lsp): don't overlay insertion-style inline completions (#36477)Riley Bruins1
* feat(lua): `Range:is_empty()` to check vim.range emptiness * fix(lsp): don't overlay insertion-style inline completions **Problem:** Some servers commonly respond with an empty inline completion range which acts as a position where text should be inserted. However, the inline completion module assumes that all responses with a range are deletions + insertions that thus require an `overlay` display style. This causes an incorrect preview, because the virtual text should have the `inline` display style (to reflect that this is purely an insertion). **Solution:** Only use `overlay` for non-empty replacement ranges.
2025-11-09fix(lsp): ignore inline completions after leaving insert mode (#36476)Riley Bruins1
**Problem:** When quickly entering and leaving insert mode, sometimes inline completion requests are returned and handled in normal mode. This causes an extmark to be set, which will not get cleared until the next time entering & leaving insert mode. **Solution:** Return early in the inline completion handler if we have left insert mode.
2025-11-04fix(lsp): fix window to set cursor for inline completion (#36444)Folke Lemaitre1
2025-10-25fix(lsp): ensure bufnr is passed for buffer-local requests (#36325)skewb1k1
Problem: Some LSP method handlers were making requests without specifying a bufnr, defaulting to 0 (current). This works in most cases but fails when client attaches to background buffers, causing assertions in handlers to fail. Solution: Ensure bufnr is passed to Client.request for buffer-local methods.
2025-10-04fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano1
2025-10-02fix(lsp): inlineCompletion: ignore out-of-range items #35990Yi Ming1
2025-10-01fix(lsp): scope inline_completion autocmds to buffer (#35965)v1nh1shungry1
Problem: Autocmds in inline_completion Completor are not scoped to specific buffers. When multiple buffers have inline completion enabled, events (InsertEnter, CursorMovedI, TextChangedP, InsertLeave) in any buffer trigger callbacks for all Completor instances, causing incorrect behavior across buffers. Solution: Add `buffer = bufnr` parameter to nvim_create_autocmd() calls to make them buffer-local. Each Completor instance now only responds to events in its own buffer.
2025-09-15fix(lsp): avoid automatic request after leaving insert mode (#35767)zeertzjq1
This also fixes the following warning in tests with ASAN or TSAN: -------- Running tests from test/functional/plugin/lsp/inline_completion_spec.lua RUN T4604 vim.lsp.inline_completion enable() requests or abort when entered/left insert mode: 225.00 ms OK RUN T4605 vim.lsp.inline_completion get() applies the current candidate: 212.00 ms OK nvim took 2013 milliseconds to exit after last test This indicates a likely problem with the test even if it passed! RUN T4606 vim.lsp.inline_completion get() accepts on_accept callback: 212.00 ms OK RUN T4607 vim.lsp.inline_completion select() selects the next candidate: 220.00 ms OK -------- 4 tests from test/functional/plugin/lsp/inline_completion_spec.lua (3437.00 ms total) -------- Running tests from test/functional/plugin/lsp/linked_editing_range_spec.lua nvim took 2011 milliseconds to exit after last test This indicates a likely problem with the test even if it passed!
2025-09-06docs(lsp): tweak `inline_completion.get` code snippet #35657Maria José Solano1
`replace_keycodes` is true if `expr` is set, and "Accept" is a better term to describe the keymap.
2025-09-03docs: lsp, miscJustin M. Keyes1
- Problem: It's not clear for new plugin developers that `:help` uses a help-tags file for searching the docs, generated by `:helptags`. - Solution: Hint to the |:helptags| docs for regenerating the tags file for their freshly written documentation. Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-09-01feat(lsp): vim.lsp.inline_completion on_accept #35507Yi Ming1
2025-08-28refactor(lua): consistent use of local aliasesChristian Clason1
2025-08-27fix(lsp): update completion items on `TextChangedP`Yi Ming1
2025-08-27fix(lsp): update on `CursorHoldI` cause users unable to `select()`Yi Ming1
2025-08-27fix(lsp): `opts.wrap` always `true`Yi Ming1
2025-08-25feat(lsp): support `textDocument/inlineCompletion`Yi Ming1