aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
...
* fix(lsp): incorrect rendering of markdown codeblock #40861Justin M. Keyes2026-07-20
| | | | | | | | | | | | Problem: LSP hover erroneously drops blank lines before a 4-space-indented codeblock, which is not valid Markdown. This causes incorrect parsing and wrong display. Solution: Fix `split_lines` so that it doesn't drop the blank line just before a 4-space-indented codeblock. fix https://github.com/neovim/neovim/issues/40860
* feat(lua): Iter:count() #40831PinkLea2026-07-20
|
* fix(diagnostic): skip out-of-range lnum in underline handler #40839penglei2026-07-20
| | | | | | | | | | | | | | | | Problem: `vim.diagnostic.handlers.underline.show` throws `E565: Index out of bounds` when it tries to underline a diagnostic whose `lnum` is past the end of the buffer. This happens with stale diagnostics set on an unloaded buffer (e.g. via `bufadd()`) that are drawn only after the buffer is loaded: by then the file on disk can be shorter than the `lnum` the diagnostic carried. File pickers (snacks.nvim) that open files via `bufadd` + `:buffer` hit this whenever an LSP server has already emitted diagnostics for that URI. Solution: Skip diagnostics with an out-of-range `lnum` in the underline handler. Other handlers `M.virtual_text.show()`, `M.signs.show()`, have a similar condition.
* fix(lsp): preview window converted to normal window is auto-closed (#40770)Rocco Vaccone2026-07-19
| | | | | | | | | | | | | Problem: A floating preview window (hover, signature help) converted to a normal window (e.g. with CTRL-W_H or nvim_win_set_config()) is still closed by the open_floating_preview() autocommands, and a later preview may focus or close it as if it were still a float. Solution: When the preview window is no longer floating, remove its auto-close autocommands and stop tracking it as the buffer's floating preview. Closes #36659
* feat(eval): declare more "fast" functions #40834Justin M. Keyes2026-07-19
|
* fix(lua): vim.keycode cleanup #40817Justin M. Keyes2026-07-18
|
* feat(lua): vim.keycode() gets structured parse result #38636altermo2026-07-18
| | | | | | | | | | | | | | | | | Problems: 1. Can't get individual parts of a key-chord separately: modifiers, key. 2. Can't separate a key-combo into individual key-chords. Solution: Enhance `vim.keycode()` to optionally return a structured parse result as a list of key-chords: - `key_raw` the key-chord (problem 2) - `mod` the modifiers of `key_raw` (problem 1) - `key_orig` the key part of the key-chord, only here if differing from `key` (this doesn't solve any of the above mentioned problems, but it may provide useful and it's (in terms of code) free) - `key` a normalized version of `key_orig` (solving problem 1), example(the first is `key_orig` and second is `key`): `lt` and `<`, `Bar` and `|` (in `<C-Bar>`)
* vim-patch:9.2.0788: filetype: hip files are not recognized (#40809)zeertzjq2026-07-18
| | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: hip files are not recognized Solution: Detect *.hip files as hip filetype, include filetype, syntax and indent plugins, update makemenu.vim and synmenu.vim (Young) Round out HIP (Heterogeneous-compute Interface for Portability) support to mirror the existing CUDA files: - autoload/dist/ft.vim: detect the ".hip" extension as filetype "hip" - ftplugin/hip.vim: behave like C++ by sourcing ftplugin/cpp.vim - indent/hip.vim: use cindent, like indent/cuda.vim - makemenu.vim / synmenu.vim: add a Syntax menu entry The syntax/hip.vim file already sources syntax/cpp.vim and adds the HIP-specific keywords, matching syntax/cuda.vim. closes: vim/vim#20773 https://github.com/vim/vim/commit/b3ad239038ff1d3e1708b0027454b2ef6a86a8a2 Co-authored-by: Young <young20050727@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* fix(ui2): avoid ModeChanged in message window #40788Barrett Ruth2026-07-18
|
* vim-patch:9.2.0786: filetype: Containerfile is not recognized (#40807)zeertzjq2026-07-18
| | | | | | | | | | | | | Problem: filetype: Containerfile is not recognized Solution: Detect *.[Cc]ontainerfiles as dockerfile filetype (Omer Tuchfeld) closes: vim/vim#20783 Supported by AI. https://github.com/vim/vim/commit/6b62ae68c6df250019085fea2992399f1477ad4f Co-authored-by: Omer Tuchfeld <omer@tuchfeld.dev>
* docs: misc, remove some old help tags #40214Justin M. Keyes2026-07-18
| | | | | | | | | | - Remove old help tags: they add noise to cmdline completion. Co-authored-by: acehinnnqru <acehinnnqru@gmail.com> Co-authored-by: KangaZero <samuelyongw@gmail.com> Co-authored-by: Simone Ragusa <hi@interrato.dev> Co-authored-by: Chinmay Dalal <~chinmay/public-inbox@lists.sr.ht> Co-authored-by: coyaSONG <66289470+coyaSONG@users.noreply.github.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev>
* fix(restart): distinguish v:exitreason for :restart! #40801Barrett Ruth2026-07-18
|
* feat(completion): support completionList.applyKind #40769glepnir2026-07-17
| | | | | | | | | | | Problem: values from completionList.itemDefaults always replace the item's own commitCharacters and data. Since 3.18 a server can ask for them to be merged instead. Solution: Handle CompletionList.applyKind and advertise applyKindSupport. Drop itemDefaults once folded into the items: get_items() runs twice on the same result and a Merge isn't idempotent. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#completionItemApplyKinds
* refactor(detach): eliminate `nvim__ui_detach` #40793Justin M. Keyes2026-07-17
| | | | | | | | | | | | | | | Problem: `nvim__ui_detach` was added in 85e0559d46c7 in order to implement `detach_others` from Lua. Using Lua in this case is doing more harm than good. Solution: Extract `ui_detach_channel`, which also allows it to be used for the "self detach" path from `ex_detach`. Bonus: the old MSWIN path always called `os_swap_to_hidden_console()`; now `ui_detach_channel` only does so for a stdio channel. For the common stdio TUI this is identical; for a socket UI it's more correct (no parent console to swap).
* feat(ui): ":%detach!" detaches all other UIs #39216Jason Woodland2026-07-17
| | | | | | | Problem: Not easy for one UI to kick the others off a shared Nvim server. Solution: Treat `:%detach` as detach-other-UIs.
* feat(health): rearrange vim.ui.img checks #40782Olivia Kinnear2026-07-17
|
* fix(dir): custom 3P directory-browser #40725Barrett Ruth2026-07-16
| | | | | | | | | | Problem: Third-party directory browsers do not have a documented way to take over local directory buffers from nvim.dir. Solution: Document deleting the nvim.dir augroup and handling FileType directory as the after-startup handoff, and avoid installing the built-in buffer-local "-" mapping when "-" is already mapped.
* fix(lsp): capability cleanup #40763jdrouhard2026-07-16
|
* feat(completion): commitCharacters #38417glepnir2026-07-15
| | | | | | | | | Problem: LSP completion commitCharacters are not handled. Typing a commit character (e.g. `.`, `(`, `;`) while a completion item is selected does not accept the item first. Solution: Store commit characters as a flat string in complete-items. Check it before completion stops, accept the match and let the character be inserted normally.
* fix(restart): keep :restart error message concise #40746Olivia Kinnear2026-07-15
|
* Merge #40621 fix(ui2)!: legacy 'ruler' inconsistenciesJustin M. Keyes2026-07-15
|\
| * docs(ui2): deprecate v:echospaceSébastien Hoffmann2026-07-11
| | | | | | | | | | | | The purpose of `v:echospace` was to avoid disruptive "Press ENTER" prompts. Since those are no longer a problem with ui2, the complexity of maintaining it up-to-date is no longer justified.
| * fix(ui2): fix ruler on repeated messagesSébastien Hoffmann2026-07-11
| | | | | | | | | | | | | | | | | | | | Problem: a long message is cropped to keep the ruler visible. But when the message is repeated, it can be written over the ruler, while the repetition indicator "(1)" is still placed just before the ruler, which ends up somewhere inside the message. Solution: currently, long messages are only cropped when setting the 'last' virttext. Make sure this happens after a repeated long message.
| * fix(ui2): correctly crop message at multibyte/multicell characterSébastien Hoffmann2026-07-11
| |
| * fix(ui2): clear showcmd virt_text together with search countSébastien Hoffmann2026-07-11
| | | | | | | | | | | | | | | | | | | | Problem: when the search count is displayed, the showcmd virt_text is set to 11 empty spaces to ensure a consistent distance between search count and ruler, or screen edge in case of noruler. But when the search count is removed to make place for a message, the empty dummy showcmd remains and unnecessarily erases part of the message. Solution: properly remove showcmd together with search count.
| * fix(ui2)!: don't constrain ruler to ru_wid, fix leading item groupSébastien Hoffmann2026-07-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ui2's ruler is no longer of fixed width, and the internal width variable `ru_wid` now acts as an arbitrary maximum, which is unnecessary because the same can now be achieved transparently with an item group. Furthermore, the old way of setting `ru_wid` with an overloaded subset of the item group syntax leads to a number of inconsistencies. In particular, when the configured ruler expression is reused for including the ruler into the statusline, where the item group syntax is interpreted in the usual way. The fact that this width is set in the `minwid` position is more confusing now that it is a de-facto maximum. Solution: for ui2, constrain the ruler only by half the screen width, which previously was an additional limit relevant on small screens. Skip the special-case treatment of the ruler's leading item group spec, process it like a normal item group. Example: the current fallback ruler expression in the default statusline now actually works for `rulerformat` itself: set rulerformat=%-14.(%l,%c%V%)\ %P because the result can naturally expand to 18 cells instead of being truncated to the default 17 cells, and removing the period after `minwid` doesn't change the result, whereas before, it would unhelpfully lead to setting the fixed ruler width to 14 cells. BREAKING CHANGE: if the user used to set the ruler's fixed width, it will now be treated as minimum instead of a maximum width, which in practice increases backwards-compatibility with ui1 and vim. The main remaining difference is that item groups are right-aligned by default, but backwards-compatibility can be achieved by setting a negative `minwid`, which ui1 and vim ignore. To restore the previous fixed width, specify `maxwid` as well, but this does not work in ui1 and vim. If `rulerformat` contains a `%=` without enclosing item group, it will now expand to fill half the screen width. But in that case, it will already spread out similarly in the new expression-based statusline, so consistency of the ruler in both positions is increased. To simulate the previous default behaviour, wrap it in `%-17.17(...%)`. For best compatibility and reuse with vim, leave out `maxwid` and make `minwid` negative, e.g. `%-20(...%)`. fix https://github.com/neovim/neovim/issues/40247
* | refactor(lsp): unify LspNotify, decor provider for capabilities #40691jdrouhard2026-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Every LSP capability that sends a request on a document change to update its state was using its own buffer-local autocmd to do so. That means there is a separate autocmd per buffer per active capability/feature, and the actual code inside the autocmd callback was virtually identical. The same problem occurred for capabilities that had components to draw on the screen that had their own decoration providers. Solution: Introduce a central `LspNotify` autocmd and decoration provider in the capability module itself. New base class methods `on_close` and `on_change` that take a client_id have been provided, for `didClose` and `didOpen`/`didChange` notifications respectively. New base class method `on_win` that takes topline and botline has been provided to add extmarks or perform other work when lines of a buffer are being drawn. The autocmd callback loops through each active capability instance for the buffer and calls a corresponding method with the triggering client_id if it is currently attached to the buffer that triggered the autocmd. The decoration provider just calls on_win for all active capabilities on the buffer. This slightly tweaks folding range to make use of these new client-id specific callbacks.
* | fix(lsp): improve inlayHint.resolveSupport in client capabilities #40741Robert Muir2026-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem The current list of properties for inlay hint resolve support includes a non-existent "location". This field should be "label.location" according to the specification. Tooltips and commands for inlay hint "parts" aren't advertised as being resolvable. Solution Remove "location" and add "label.location", "label.tooltip", and "label.command". Closes #40740
* | feat(marks): :marks completion, list extmarks #40743Justin M. Keyes2026-07-15
| | | | | | | | | | | | | | | | | | Problem: - No UI for listing extmarks. - `:marks` doesn't support cmdline-completion. Solution: - Add completion and extmarks support to `:marks`. - Update `get_buf_local_marks` to include the ":" (prompt-buffer) mark.
* | refactor(vimscript)!: drop ctxget(), ctxpush(), etc #40724Justin M. Keyes2026-07-13
| | | | | | | | | | | | | | | | | | | | Problem: This functions are most likely never used in the wild. - They are redundant with `nvim_get_context` + `nvim_load_context`. - The "context" concept was never fully developed and hasn't gained traction. Solution: Drop these vimscript aliases, they are just extra cruft.
* | feat(docs): mark optional API parametersJustin M. Keyes2026-07-13
| |
* | refactor(api): omit optional paramJustin M. Keyes2026-07-13
| |
* | feat(api): optional params after `opts` #40720Justin M. Keyes2026-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: After 25439dad7e2b, `opts` is optional, but not params that follow it. Solution: - Update `gen_api_dispatch.lua`, docs, tests. - Enhance the `nvim_get_api_info()` api-metadata to include a boolean flag indicating whether a parameter is optional: ``` [type, name, optional] ``` Note: Currently, optional params are assumed to be Dict/Array. Since we don't yet have any use-cases of optional params following `opts`, the build just checks this assumption and we can deal with it later if we ever care to: nvim_get_hl: optional param "foo" has type "Integer" but (currently) we assume Dict/Array
* | fix(path): normalize separators (slashes) #39155tao2026-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Continue separators normalization, and try to keep it at the nvim <-> external boundary, e.g., `fn.xxx`, `api.xxx`, `:xxx` Solution: some key changes - normalize `$HOME-windows` - normalize entry points of changing directory - `nvim_set_current_dir()`, `chdir()` - normalize the named pipe - `--listen` arg, `--server` arg, `:restart` - `serverstart()`, `sockconnect()`, `serverstop()` - make `expand()` respect 'shellslash' again - clean up `did_set_shellslash` - replace `forward_slash` with `TO_SLASH` - remove obsolete `TMP_PATHSEPSTR` - remove `slash_adjust` in `do_autocmd_dirchanged`? - make `fnamemodify()` always return `/` (except when substituting separators via `:s`, `:gs` ?) Note: - these funcs still apply `slash_adjust` on return, as before: `:pwd`, `chdir()`, `exepath()`, `getcwd()` - these funcs alwarys return `/`, unlike before the normalization PRs - `getcompletion()`, `finddir()`, `findfile()` Also - clean up code, comments, formatting and tests - move `TO_SLASH` from `f_chdir` to `changedir_func` - move `TO_SLASH` from `f_bufadd` to `buflist_new` Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* | fix(lsp): unclear error on malformed server responses #40422Kim A. Brandt2026-07-12
| | | | | | | | | | | | | | | | | | Problem: Malformed server responses with `null` (vim.NIL) values, do not show clear error messages. Solution: Assert two known, specific cases, to avoid user confusion.
* | fix(filetype): false positive when matching directory buffer #40695Barrett Ruth2026-07-11
|/ | | | | | | | | | | Problem: URI buffer names can end with a slash, but slash-ended directory matching should not preempt URI filetype patterns. Solution: Do not use the slash shortcut for names with URI schemes, so those continue through normal filetype matching. Co-authored-by: Adam Karafyllidis <akisarou90@gmail.com>
* fix(api): nvim_cmd() "args" type too narrow #40670glepnir2026-07-10
| | | | | | | Problem: nvim_cmd() accepts number/boolean in args and converts them to strings, but the keyset declares ArrayOf(String). Solution: use ArrayOf(Union(Integer, String, Boolean)) and wrap union types in parens when generating array annotations.
* fix(filetype): ensure directory bufname ends w/ slash sep #40552Barrett Ruth2026-07-10
| | | | | | | | | | | | Problem: `vim.filetype.match()` needs a cheap way to recognize directory buffers without doing filesystem stat work. Solution: Ensure full buffer names for directories end in a trailing slash. Now directory buffers can proceed through the normal 'filetype' path. Note side-effects: session and ShaDa buffer-list restore behavior must be compatible, so those + corresponding tests must be updated.
* fix(dir): user/plugin can override default "-" mapping #40676Barrett Ruth2026-07-10
|
* fix(dir): select origin on parent navigation #40658Barrett Ruth2026-07-09
|
* fix(dir): preserve alternate buffer #40659Barrett Ruth2026-07-09
|
* feat(lua): add `cwd` context to `vim._with()` #40653Evgeni Chasnovski2026-07-09
| | | | | | | | Problem: No concise way to execute a callback with temporarily set working directory. This might be useful when sourcing nested files to allow them to assume that current working directory is their root directory. Solution: Add `cwd` context to `vim._with().`
* refactor(logging)!: rename current_level #40642Justin M. Keyes2026-07-08
|
* feat(pack): 'packlockfile' option #40562Evgeni Chasnovski2026-07-08
| | | | | Problem: No way to configure the lockfile location. Solution: Add 'packlockfile' option.
* fix(lsp): clear push diagnostics on detach #40634Oleh Volynets2026-07-08
| | | | | | | | | Problem: when an LS client detaches from the buffer, only pull diagnostics are cleared via capability framework. Push diagnostics remain stuck even when client stops/restarts. Solution: clear push diagnostics on client detach. ref #33864
* fix(lsp): refresh document-pull buffers on workspace/diagnostic/refresh #40623Caleb White2026-07-08
| | | | | | | | | | | | | | When a server supports both document and workspace pull diagnostics, `on_refresh` only dispatched a `workspace/diagnostic` request. The workspace response handler skips buffers with `pull_kind == "document"` (i.e. all buffers opened by the user), so their diagnostics went stale until the next `didChange` or `didOpen` event. Change `on_refresh` to always refresh document-pull buffers via `textDocument/diagnostic`, regardless of whether the server also supports workspace diagnostics. This ensures that opened buffers see updated diagnostics (e.g. after a save triggers an external tool like PHPStan) without requiring the user to re-enter insert mode.
* feat(vim.fs): vim.fs.mkdir() #40599Barrett Ruth2026-07-08
| | | | | | | | | Problem: `vim.fs` does not provide a directory creation helper matching its filesystem API shape. Solution: Add `vim.fs.mkdir()` as a thin wrapper around `vim.fn.mkdir()`, with `parents` and `mode` options.
* refactor(lsp): use LspNotify for codelens #40604jdrouhard2026-07-07
| | | | | | | | | | | | | | | | | | | | | Problem: The codelens LSP module was using its own raw buffer events and its own debounce mechanism for refreshing code lens in attached buffers. Solution: Switch the module to using the LspNotify autocmd events. LspNotify fires just after document versions are synced with the server and provides a built in debounce mechanism for changes. Additionally, this fixes some bugs with the previous implementation: 1. The workspace/codeLens/refresh handler re-requested codelens for all buffers but when the response came back, it forced an extra redraw after clearing the work the handler had just done. 2. Document synchronization was reworked to be more resilient to multiple clients providing codelens for a single buffer. The latest document version is now separately tracked per client (and per client's lenses per row) instead of for the buffer as a whole. This allows the on_win() function to properly redraw all codelens even when different clients' responses for a particular document version come back at different times.
* fix(man.lua): cache pages until width changes #40607Barrett Ruth2026-07-06
| | | | | | | Problem: :Man unloads hidden buffers, so reopening large pages reruns rendering even when the width is unchanged. Solution: keep regular man buffers loaded and refresh them only when the effective width changes.
* fix(api): nvim_win_resize tweaks #40596Justin M. Keyes2026-07-05
|