aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
Commit message (Collapse)AuthorAge
* 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(lua): enable unnecessary-assert diagnosticLewis Russell2026-09-28
| | | | AI-assisted
* fix(lua): enable assignment type checking in runtime codeLewis Russell2026-09-25
| | | | | | | | | | | Enable EmmyLua's assign-type-mismatch diagnostic after correcting the runtime annotations and assignments it flags. Correct option, tuple, and return types, and use separate locals when a value changes representation. Add guards and narrow casts where needed so the runtime passes the stricter check. Regenerate the affected docs. AI-assisted
* fix(lua): enable nil-safety diagnostics in runtime codeLewis Russell2026-09-25
| | | | | | | | | | | | Enable EmmyLua's need-check-nil diagnostic and resolve nullable values through more precise types, explicit invariants, and guards for missing runtime state. Keep analyzer-specific workarounds local and update the affected API documentation. Exclude the bundled re.lua from analysis so its nil-check warnings do not fail CI. AI-assisted
* fix(lua): add missing param annotations (#41911)Lewis Russell2026-09-15
|
* 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.
* build: enable more EmmyLua checksLewis Russell2026-09-09
| | | | | | | | | | Enable checks for unused code, deprecated calls, return types, and annotations. Fix the warnings and replace the deprecated highlight function. Keep exceptions where old APIs are still needed or the checker gets it wrong. AI-assisted
* build: enable more EmmyLua checksLewis Russell2026-09-08
| | | | | | | | | | | | | | | | - call-non-callable - missing-fields - redefined-label - redefined-local - undefined-field - unreachable-code Promote redefined-local and unreachable-code to warnings. Fix DOS line-ending handling for multiline semantic tokens, and support intersection types in the help parser. 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
* fix(lsp): respect range in linewise visual mode #41636Volodymyr Chernetskyi2026-09-02
| | | | | | | | Problem: An explicitly passed `range` to `vim.lsp.buf.format()` in linewise visual mode is silently replaced by the selection. Solution: Parenthesise the mode check.
* refactor: combine all visual_selection funcionsaltermo2026-08-01
|
* fix(lsp): support -1 column in format range #40570Barrett Ruth2026-07-05
| | | | | | | | | | Problem: `vim.lsp.buf.format()` accepts ranges using nvim indexing, where an end column of -1 means end of line. LSP ranges cannot use that, which is confusing for things like range formatting. Solution: Resolve -1 end columns to the line length before converting the range to LSP positions.
* docs: pos argument in vim.lsp.ListOpts should be optional #40550nikolightsaber2026-07-02
| | | | | | | | Problem: the pos argument in ListOps for lsp is an optional parameter, but the lua_ls typing system doesn't reflect that Solution: let pos be optional Co-authored-by: nikolightsaber <nikolightsaber@gmail.com>
* 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.
* docs(lsp): document on_list deduplication #39941Puneet Dixit2026-05-27
| | | | | | | | | | Problem: Deduplicating LSP locations in the default handler changes list behavior for every user, while some configurations may intentionally return matching locations from multiple clients. Solution: Document how users can deduplicate locations in an on_list handler with vim.list.unique(). Co-authored-by: Deepak kudi <deepakkudi23@adsl-172-10-9-116.dsl.sndg02.sbcglobal.net> Co-authored-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
* refactor: introduce nvim_on internally #39883Justin M. Keyes2026-05-20
| | | | | | | | | Problem: `nvim_create_autocmd` is too verbose and its `callback` requires extra "nesting". Solution: Introduce `nvim_on`. Start using it internally. Then we can get a feel for how it should look before making it public.
* feat(ui): vim.ui.input(opts.scope) #39570Evgeni Chasnovski2026-05-17
| | | | | | | | | | | | | | | Problem: There is no way for a `vim.ui.input` caller to indicate for which scope the input is. As in "This input is for something at cursor scope". This information can be useful for `vim.ui.input` implementation to tweak its behavior and presentation: - Show different floating window depending on the scope. For example: - Near cursor for "cursor" scope. - At line start for "line" scope. - In window corner for "buffer" and "window" scopes. - In whole editor corner for "tabpage", "editor", "project" scopes. - Navigate through history only for inputs with the same scope. Solution: Document new `opts.scope` for `vim.ui.input`. Use it in the codebase.
* refactor(lsp): remove some private utility functionsYi Ming2026-05-16
| | | | | | | | | Problem: `make_position_params`/`get_line_byte_from_position`/`make_line_range_params` are private functions and their functionality can be replaced by `vim.pos` now. Solution: Remove them, use `vim.pos` instead.
* docs: dev, lsp, indent-guides #39756Justin M. Keyes2026-05-14
| | | | | | | - document "indent guides" https://github.com/neovim/neovim/issues/39726 - document guidance for "subcommands" https://github.com/neovim/neovim/issues/32263#issuecomment-4436002808 Co-authored-by: glepnir <glephunter@gmail.com> Co-authored-by: Noa Levi <275430404+lphuc2250gma@users.noreply.github.com>
* Merge #39730 from ofseed/lsp-remove-deprecatedJustin M. Keyes2026-05-11
|\
| * refactor!: remove deprecated APIsYi Ming2026-05-11
| |
* | feat(lsp): pass arbitrary positions to vim.lsp.buf #39446Yi Ming2026-05-10
|/ | | | | | | Problem: Currently, it only supports sending requests using the current cursor position as a parameter. Solution: Support sending requests using arbitrary positions.
* docs: misc, rename "tabpage"Justin M. Keyes2026-05-07
| | | | | | Co-authored-by: michael-grunder <michael.grunder@gmail.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev> Co-authored-by: Felipe Matarazzo <felipemps@protonmail.com>
* feat(lua)!: vim.isnil, vim.nonnil, deprecate vim.F #39495Olivia Kinnear2026-05-06
|
* docs: lsp.CodeActionContext, nested `@inlinedoc`Justin M. Keyes2026-04-26
| | | | | - fix https://github.com/neovim/neovim/issues/39208 - fix generation of neste `@inlinedoc` classes
* fix(lsp): filter code_action diagnostics to the cursor #38988Barrett Ruth2026-04-23
| | | | | | | 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.
* docs(lsp): description for `on_list` example #39230Maria Solano2026-04-19
|
* refactor(lsp): provide a default list handler example #39005Yi Ming2026-04-16
| | | | | | | | | | | | | | Problem: Difficult for us to provide default handlers for functions like `vim.lsp.buf.definition`. When users wanted to fine-tune the default behavior, they don't know how. Solution: - Document an example providing `on_list` boilerplate to make it easier for users to modify and override. - Also, considering that the parameters of the previous `on_list`(`vim.lsp.ListOpts.OnList`) are compatible with the parameters of `setqflist`, remove that custom type in favor of passing `vim.fn.setqflist.what`.
* fix(lsp): check stale context in hover/signature callback #38724glepnir2026-04-11
| | | | | | | Problem: hover/signature callback lacked consistency checks, so slow LSP servers could open a float after the cursor had already moved away. Solution: guard the callback with buf validity, buf version, and cursor position checks before opening the float. Also fix table capacity calculation.
* refactor(lsp): share code by `get_locations` #38902Yi Ming2026-04-09
| | | | | | | | | | | Problem: `vim.lsp.buf.definition`/`vim.lsp.buf.declaration` use the same underlying code via `get_locations`, whereas `vim.lsp.buf.reference` does not. This is because `buf.reference` does not perform a jump when there is only one item. Solution: In #38510, I simplified the jump logic using `:cfirst`, so they can now share code more easily. Additionally, this PR enables `buf.definition` to display the corresponding qflist name.
* fix(diagnostics)!: restore `is_pull` namespace argument #38698Maria Solano2026-04-08
| | | | | | | | | | | | | | | | 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.
* refactor(lsp): remove implicit rpc error tostring #38707Yi Ming2026-04-02
| | | | | | | | | | | | | | | | | | Problem: LSP error responses implicitly rely on a custom `__tostring` function (`vim.lsp.rpc.format_rpc_error`) for formatting. This causes errors that are not created via `vim.lsp.rpc.error` to behave inconsistently with those that are. Furthermore, we usually use `log.error` to print these errors, which uses `vim.inspect` under the hood, so the custom `__tostring` provides little benefit. This increases the difficulty of refactoring the code, as it tightly couples RPC error handling with the LSP. Solution: Convert every potential `__tostring` call to an explicit one. Since we don't describe this behavior in the documentation, this should not be a breaking change.
* feat(lsp): respect 'switchbuf' for jump commands, drop `reuse_win` #38510Yi Ming2026-03-30
| | | | | | | | | | | | | | | | | | 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.
* fix(lsp): get_namespace signature (#38449)Tristan Knight2026-03-23
| | | | | | Problem: Since the change to `pull_id` in #37938 we used the deprecated signature internally Solution: Don't
* feat(lua): replace `buffer` with `buf` in vim.keymap.set/del #38360skewb1k2026-03-21
| | | | | | The `buffer` option remains functional but is now undocumented. Providing both will raise an error. Since providing `buf` was disallowed before, there is no code that will break due to using `buffer` alongside `buf`.
* fix(lsp/diagnostic): use diagnostic provider identifier for code actions #38401Sergei Slipchenko2026-03-21
| | | | | | | | | | | | | | | Problem: f9b2189b287a14478546da72b7ecdfd3afe981c7 started using namespaces for pull diagnostics that look like this `<id>:<identifier>`. `vim.lsp.buf.codeaction` passes `true` instead of an identifier to `vim.lsp.diagnostic.get_namespace`, resulting in a namespace that looks like `<id>:nil`. The end result is that none of the diagnostics are passed to `textDocument/codeAction` request. Because of that server might not send any code actions back. For example, eslint lsp responds with an empty list of actions if it receives no diagnostics. Solution: use `_provider_foreach` to collect diagnostics from all `identifiers` and use that identifier to get a namespace instead of `true`.
* fix(lsp): improve diagnostics handling and commentstris2032026-03-19
| | | | | | | | - Add TODO comments for aggregating diagnostics from all pull namespaces and for clearing diagnostics when an empty array is received, referencing the LSP specification. - Update diagnostics refresh logic to safely access previousResultId, preventing potential nil errors.
* fix(lsp): call `on_list` before reading `loclist` #37645Maria Solano2026-02-01
| | | | | | | Problem: `on_list` is supposed to replace the default list-handler. With the current order of these `if` statements `on_list` won't be called if `loclist` is true. Solution: Change the order of the relevant blocks.
* feat(lsp): highlighting the symbol being renamed (#37390)Yi Ming2026-01-23
|
* docs: misc (#37281)zeertzjq2026-01-12
| | | | | | | Close #37289 Close #37348 Co-authored-by: Marc Jakobi <marc@jakobi.dev> Co-authored-by: Anton Kesy <anton@kesy.de>
* docs: misc (#37280)zeertzjq2026-01-07
| | | | | | | | | | | | | | | | | | | | Close #36806 Close #36812 Close #37003 Close #37016 Close #37038 Close #37039 Close #37157 Close #37185 Close #37213 Co-authored-by: saroj_r <sarojregmi.official@gmail.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev> Co-authored-by: Igor <igorlfs@ufmg.br> Co-authored-by: Justin Roberts <JustinEdwardLeo@gmail.com> Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com> Co-authored-by: Aymen Hafeez <49293546+aymenhafeez@users.noreply.github.com> Co-authored-by: Peter Cardenas <16930781+PeterCardenas@users.noreply.github.com> Co-authored-by: DrNayak2306 <dhruvgnk.work@gmail.com>
* feat(lsp): incremental-selection operator-pending mode #36575Branden Call2025-11-24
| | | | | | | | | | Problem: LSP incremental selection provides default visual-mode keymaps for `an` and `in`. Operator-pending mode is not supported, so `dan` and `can` do not apply the operation. Solution: Modify selection_range() to be synchronous. Add operator-pending mappings.
* fix(lsp): reuse_win prioritizes windows/tabs currently displayed #36486Toby She2025-11-12
| | | | | | | | Problem: reuse_win will always jump to the first window containing the target buffer rather even if the buffer is displayed in the current window/tab Solution: check to see if the buffer is already displayed in the current window or any window of the current buffer
* feat(lsp): pass client ID in code action filter (#36046)Maria Solano2025-10-05
|
* fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano2025-10-04
|
* docs: small fixes (#35791)zeertzjq2025-09-16
| | | | | | | | | | | | | | | | | | | | | Close #34938 Close #35030 Close #35233 Close #35259 Close #35290 Close #35433 Close #35541 Close #35766 Close #35792 Co-authored-by: huylg <45591413+huylg@users.noreply.github.com> Co-authored-by: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Co-authored-by: sooriya <74165167+thuvasooriya@users.noreply.github.com> Co-authored-by: Andrew Braxton <andrewcbraxton@gmail.com> Co-authored-by: Enric Calabuig <enric.calabuig@gmail.com> Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com> Co-authored-by: David Sierra DiazGranados <davidsierradz@gmail.com> Co-authored-by: Stepan Nikitin <90522882+vectravox@users.noreply.github.com> Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
* refactor(lua): consistent use of local aliasesChristian Clason2025-08-28
|
* fix(lsp): don't treat MarkedString[] with language id as empty #35518Robert Muir2025-08-27
| | | | | | | | | Problem: Hover response of MarkedString[] where the first element contains a language identifier treated as empty. Solution: Fix empty check to handle case of MarkedString[] where the first element is a pair of a language and value.
* fix(lsp): handle array with empty string when checking empty hover (#35423)Igor Lacerda2025-08-21
|
* fix(lsp): update window title when cycling through signatures #35407Tiago Inaba2025-08-20
|