aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
...
* feat(vim.pos)!: require `buf` param on vim.pos, vim.range #38665Luis Calle2026-04-06
| | | | | | | 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
* Merge #38796 from justinmk/doc2Justin M. Keyes2026-04-05
|\
| * docs: statuslineJustin M. Keyes2026-04-06
| | | | | | | | fix https://github.com/neovim/neovim/issues/38670
* | fix(pack): avoid eager vim.version call #38705Evgeni Chasnovski2026-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Commands that rely on Git may need its version to perform more targeted actions (like decide which arguments are safe to use). For performance, computing this version is delayed up until it is needed (like to not compute on regular startup), but not done before every Git operation (as it is too much and can be done better). This requires storing the Git version in a variable which is currently initiated via `vim.version.parse()` call (most probably because it was easier to handle Lua types this way). However, the problem is that this results in sourcing `vim.version` and computing `vim.version.parse` on every startup even if no Git operation would be done. Solution: Don't call `vim.version.parse()` during `require('vim.pack')` and ensure its more precise lazy computation.
* | feat(defaults): :Open without args opens current file #38776Olivia Kinnear2026-04-05
| | | | | | | | | | | | | | Problem: Running `:Open` on an open buffer does not run `vim.ui.open()` on that file, requiring the user to type `:Open %`. This is inconsistent with most other vim commands which accept files, which default to the current buffer's file. Solution: Default to the current file when `:Open` is used without arguments.
* | fix(lsp): do not respond to codelens refresh if a request is already ↵Yi Ming2026-04-05
| | | | | | | | scheduled (#38801)
* | fix(vim.net): check if vim.system's stdout is nil #38713Yochem van Rosmalen2026-04-05
| | | | | | | | | | | | | | | | | | Problem: Apparently vim.SystemCompleted.stdout can also be nil, even without a custom stdout handler. (Although the docs can be interpreted otherwise). Solution: Explicitly check for nil and set the result body to an empty string if stdout was nil.
* | fix(pack): use `uv.available_parallelism()` to compute number of threads #38717Evgeni Chasnovski2026-04-05
|/ | | | | | | | | Problem: Computing number of threads for parallel asynchronous computation using `uv.cpu_info()` can be slow. This is especially noticeable since it is pre-computed on every `require('vim.pack')` and not only when parallelism is needed. Solution: Use `uv.available_parallelism()` to compute number of threads in a helper function.
* fix(ui2): update spill indicator when appending to expanded cmdline #38715luukvbaal2026-04-05
| | | | | | Problem: When messages are appended to an already expanded cmdline, the spilled lines indicator is not updated. Solution: Remove early return for updating virtual text while cmdline is expanded, guard updating "msg" virt_text at callsite instead.
* vim-patch:af58a9f: runtime(doc): adjust :h 'autowrite' and :h 'autowriteall'zeertzjq2026-04-04
| | | | | | | | | | | | - Don't go over 78 columns. - Change the first "and" to "or", as "or" is used below. - Change "takes one" to "switches", as "one" may be mistaken as referring to the command instead of the user. - Use backticks in :h 'autowriteall' like in :h 'autowrite'. closes: vim/vim#19859 https://github.com/vim/vim/commit/af58a9f5e9e0bf748700645d07c6262eb281d737
* vim-patch:9.2.0267: 'autowrite' not triggered for :termzeertzjq2026-04-04
| | | | | | | | | | | | Problem: 'autowrite' not triggered for :term Solution: Trigger autowrite for :term command (rendcrx) closes: vim/vim#19855 https://github.com/vim/vim/commit/466b5f531a9818d4fa834126d64e8b771e4a497f Co-authored-by: rendcrx <974449413@qq.com>
* vim-patch:9.2.0287: filetype: not all ObjectScript routines are recognized ↵zeertzjq2026-04-03
| | | | | | | | | | | | | (#38731) Problem: filetype: not all ObjectScript routines are recognized Solution: Also detect "%RO" and "iris" patterns inside *.rtn files (Hannah Kimura) closes: vim/vim#19873 https://github.com/vim/vim/commit/863e85e00ad45f3e1f939cf9774c33b0570b9948 Co-authored-by: Hannah <hannah.kimura@intersystems.com>
* 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.
* fix(treesitter): select reset to "v" visualmode()altermo2026-04-02
|
* docs: misc #38584Justin M. Keyes2026-04-01
|
* Merge #38560 refactor vim.lsp.rpcJustin M. Keyes2026-04-01
|\
| * refactor(lsp): better encapsulation and readability, inline unnecessaryYi Ming2026-04-01
| |
| * refactor(lsp): merge `vim.lsp.rpc.Client` and `vim.lsp.rpc.PublicClient`Yi Ming2026-03-30
| |
* | perf(vim.pos): use `nvim_buf_line_count` instead of fetching all lines #38686Luis Calle2026-04-01
| |
* | fix(ui2): vim.on_key should return nil instead of false (#38668)phanium2026-04-01
| |
* | vim-patch:9.2.0277: tests: test_modeline.vim fails (#38672)zeertzjq2026-04-01
| | | | | | | | | | | | | | Problem: tests: test_modeline.vim fails (after v9.2.0276) Solution: Rewrite the tests to use the existing s:modeline_fails() function, update documentation (zeertzjq). https://github.com/vim/vim/commit/8c8772c6b321d4955c8f09926e3eda2b4cd83680
* | fix(ui2): flicker when entering pager from expanded cmdline #38639luukvbaal2026-03-31
| | | | | | | | | | | | | | | | | | | | | | Problem: 'showcmd' causes flickering when pressing "g<" to enter the pager when the cmdline is expanded for messages. Initial keypress for an incomplete mapping is not giving 'showcmd' feedback while cmdline is expanded for messages (which is only dismissed upon the vim.on_key callback after 'timeoutlen'). Solution: Delay dismissing expanded cmdline when vim.on_key() callback receives "g". Place 'showcmd' "last" virtual text during expanded cmdline.
* | fix(lsp): use `winresetview()` to avoid switching to normal mode (#38641)Yi Ming2026-03-31
| |
* | fix(cmdline): redraw cmdline after empty message (#38485)luukvbaal2026-03-31
| | | | | | | | | | | | | | Problem: Cmdline is not redrawn after an empty message clears it. Remembered last drawn cursor position may be outdated but equal to the current cmdline content with UI2. Solution: Ensure cmdline is redrawn after an empty message clears it. Compare wanted cursor position with actual cursor position.
* | fix(treesitter): select with node ending with unicode char (#38557)altermo2026-03-31
| | | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* | fix(defaults): check for TUI on non-stdio channel on startup (#38581)zeertzjq2026-03-31
| |
* | fix(ui2): allow empty argument for enable() #38605Christian Clason2026-03-30
| | | | | | | | | | | | Problem: `vim._core.ui2.enable` requires passing an empty table for default options, unlike other (native) Lua API. Solution: Initialize `opts` with empty table if `nil` is passed.
* | fix(ui2): correct buffer reference in msg:start_timer() (#38600)Ayush Goyal2026-03-30
| | | | | | | | | | | | | | Problem: Mixing "buf" and "M.bufs.msg" in M.msg:start_timer(). Cannot run `require("vim._core.ui2").enable(nil)`. Solution: Replace "M.bufs.msg" with "buf". Allow `opts == nil`. Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
* | docs: fix syntax errors in examples #38606skewb1k2026-03-30
| |
* | 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): reset document color processed version on clear (#38582)Maria Solano2026-03-29
|
* fix(lsp): highlight snippet preview when server can't completionItem/resolve ↵Marcus Caisey2026-03-29
| | | | | | | | | | | | | | | | | | (#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.
* docs: misc #38532Justin M. Keyes2026-03-29
| | | | | | | | | Close #38431 Close #38521 Close #38530 Co-authored-by: tayheau <thopsore@pasteur.fr> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev>
* feat: extend vim.Pos, vim.Range #36397Luis Calle2026-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* test: fix s390x failuresJustin M. Keyes2026-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* docs: news #38464Justin M. Keyes2026-03-28
|
* fix(progress): require "source" for progress-message #38514Shadman2026-03-28
| | | | | | | | | | | Problem: - Progress-events are filtered by "source". But "source" is not required by nvim_echo. - Without "++nested" (force=false), nvim_echo in an event-handler does not trigger Progress events. - vim.health does not declare a "source". Solution: - Make source mandatory for progress-messages - Enable ++nested (force=true) by default when firing Progress event. - Set "source" in vim.health module.
* docs(lsp): add `init_options` to Copilot example #38502Maria Solano2026-03-27
| | | | | | | 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).
* feat(prompt): prompt_appendbuf() appends to prompt buffer #37763Shadman2026-03-27
| | | | | | | | | | | Problem: Currently, we recommend always inserting text above prompt-line in prompt-buffer. This can be done using the `:` mark. However, although we recommend it this way it can sometimes get confusing how to do it best. Solution: Provide an api to append text to prompt buffer. This is a common use-case for things using prompt-buffer.
* fix(pack): set `source` in progress report #38511Evgeni Chasnovski2026-03-27
| | | | | | | | | 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.
* feat(progress): set Progress-event pattern to "source" #38495Shadman2026-03-27
| | | | | | | | | | | | Problem: Currently, there's no way to distinguish progress messages coming from different sources. Nor can Progress event be easily filtered based on source. Solution: - Add "source" field to nvim_echo-opts. - The Progress event pattern is now defined by the "source" field. - Include the "title" as ev.data. - Unrelated change: set force=false to disable nesting.
* fix(ui2): ENTER may focus pager in insert/terminal mode #38497phanium2026-03-26
| | | | | | | fix(ui2): prevent <CR> from focusing pager in insert/terminal mode Problem: <CR> in insert/terminal mode can focus pager unexpectedly. Solution: Don't enter the pager when <CR> is pressed during expanded cmdline in insert/terminal mode.
* fix(ui2): no paging in dialog below expanded cmdline #38489luukvbaal2026-03-26
| | | | | | | | | | | Problem: When entering the cmdline below expanded messages, those messages are moved to the dialog window. The dialog window supports paging but that is unexpected in this situation where it just serves to keep (some of, exactly those that were visible before the cmdline was entered) the messages visible. Wrong highlight group for dialog "more" message. Solution: Don't create the `vim.on_key()` dialog pager callback after entering the cmdline below expanded messages. Use the MsgMore highlight group for the paging hint title.
* refactor(progress): simplify progress-status format #38491Shadman2026-03-26
| | | | | | | | | | | | Problem: Currently we are using if 1 item then {title}: {percent}% else Progress: {AVG}%({N}) dropping {title} and Progress text saves up space in statusline plus makes the format consistent, less jumping around. Solution: Use `{AVG}%({N})` for all cases.
* fix(treesitter): ignore stale fold refresh callbacksLewis Russell2026-03-25
| | | | | | | | | | | | | | | | | | | | | Problem: The fold refresh path for foldminlines/foldnestmax creates a new FoldInfo and starts an async parse. If FileType or BufUnload re-enters before that callback returns, foldinfos[bufnr] can be cleared or replaced. The callback then indexes a stale slot and raises an "attempt to index a nil value" error. Solution: Capture the FoldInfo created for the refresh and carry that object through the async callback. Before calling foldupdate(), verify that the buffer still points at the same FoldInfo generation; otherwise ignore the stale callback. AI-assisted: Codex Fixes #38461
* feat(api): nvim_set_hl{update:boolean} #37546glepnir2026-03-25
| | | | | | | Problem: nvim_set_hl always replaces all attributes. Solution: Add update field. When true, merge with existing attributes instead of replacing. Unspecified attributes are preserved. If highlight group doesn't exist, falls back to reset mode.
* refactor(treesitter): use same visual-select as lsp #38475altermo2026-03-25
| | | | | | | Problem treesitter select over-complicates visual selection. Solution make it use same visual selection logic as lsp.
* vim-patch:9.2.0237: filetype: ObjectScript routines are not recognized (#38479)zeertzjq2026-03-25
| | | | | | | | | | | | | | Problem: filetype: ObjectScript routines are not recognized Solution: Add ObjectScript routines detection for .mac, .int, and .inc files (Hannah Kimura) Reference: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GORIENT_ch_intro#GORIENT_intro_routines closes: vim/vim#19805 https://github.com/vim/vim/commit/25f6539645d805295b11253c7bd8632aa20604f4 Co-authored-by: Hannah Kimura <hannah.kimura@intersystems.com>
* fix(pack): add trailing newline to lockfile #38469Justin Mayhew2026-03-24
| | | | | | | | 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.
* fix(ui2): show messages in dialog window when entering expanded cmdline #38465luukvbaal2026-03-24
| | | | | | | | |