Commit Graph

37255 Commits

Author SHA1 Message Date
Jan Edmund Lazo
16c25e8aee vim-patch:8.2.4955: text property in wrong position after auto-indent (#40766)
Problem:    Text property in wrong position after auto-indent.
Solution:   Adjust text property columns. (closes vim/vim#10422, closes vim/vim#7719)

788c06a249

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2026-07-16 06:48:20 +00:00
Sean Dewar
1741da8412 fix(window): yeet grid later when closing float in other tabpage #40758
Problem: #40731 may still crash if close_buffer autocmds reinsert the float's
grid. Plus removing the grid (and posting win_close) is unneeded if
win_close_othertab refuses to close the window later, which is possible.

Solution: do the stuff before freeing the window, like win_close.
2026-07-15 19:09:54 -04:00
glepnir
5ce9e74f13 feat(completion): commitCharacters #38417
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.
2026-07-15 19:08:37 -04:00
Olivia Kinnear
4f1ef2dec1 fix(restart): keep :restart error message concise #40746 2026-07-15 19:05:46 -04:00
Justin M. Keyes
31ad7d4527 Merge #40621 fix(ui2)!: legacy 'ruler' inconsistencies 2026-07-15 08:13:37 -04:00
phanium
6f370f34f2 fix(window): remove float grid from compositor layers before free #40731
Problem: Closing a floating window from a non-current tab frees its grid
without removing it from the compositor's `layers` table, so the next
`ui_comp_put_grid()` walks a dangling pointer (UAF).

Solution: Call `ui_comp_remove_grid()` (and `ui_call_win_close()` for
multigrid UIs) before `win_free_mem()`, matching `win_close()` since
PR #21551.
2026-07-15 07:48:34 -04:00
jdrouhard
44d5593afd refactor(lsp): unify LspNotify, decor provider for capabilities #40691
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.
2026-07-15 07:07:17 -04:00
Robert Muir
4bc30d6e10 fix(lsp): improve inlayHint.resolveSupport in client capabilities #40741
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
2026-07-15 06:49:45 -04:00
Barrett Ruth
b2570e6852 fix(showcmd): avoid stale %S contents #40747
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-07-15 06:10:09 -04:00
Justin M. Keyes
671e9d4913 feat(marks): :marks completion, list extmarks #40743
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.
2026-07-15 05:55:51 -04:00
zeertzjq
f17dfc9ab3 test: fix typo (#40750) 2026-07-15 07:55:01 +00:00
zeertzjq
39bc59a8f1 fix(floatwin): don't use same window as altwin (#40748)
Fixes a regression from #34486
Fix #40745
2026-07-15 05:59:45 +00:00
Barrett Ruth
4b69d3fd2d test: adjust exit waits for slow CI (#40739) 2026-07-15 05:37:28 +08:00
Justin M. Keyes
9cbb8e24c7 Merge #40728 from janlazo/na-runtime-datetime-1liner
build(vim-patch): N/A runtime/doc/*.txt changes
2026-07-14 10:28:01 -04:00
Christian Clason
b10da8b377 build(deps): bump luajit to 3c4f9fe20 2026-07-14 11:51:05 +02:00
Jan Edmund Lazo
02290ba155 build(vim-patch): detect patch v8.2.0000 as N/A
Following features must be N/A to detect v8.Y.0000 as N/A

- VisVim
- Windows *.def files
- Gvim
- runtime/doc/version8.txt ("too old")
  (https://github.com/neovim/neovim/pull/1116 deletes version7.txt)
2026-07-14 01:34:44 -04:00
Jan Edmund Lazo
2e9b06caf7 build(vim-patch): N/A runtime/doc/*.txt changes
Vim's runtime/doc/*.txt may change the 1st line only
for publish datetime.
Nvim removed those datetimes.

TODO - src/version.h for vX.Y.0000 patch.
2026-07-14 01:03:57 -04:00
Jan Edmund Lazo
60cbdc7996 build(vim-patch): src/version.h is N/A #40730
PR https://github.com/neovim/neovim/pull/36585 enabled
"scripts/vim-patch.sh", "scripts/vimpatch.lua" to optimize out
(all?) macros from Vim's "src/version.h".
If it does have relevant updates, then the applicable files
(ie. src/version.c) will use them to make the patch applicable.

Goal - Detect N/A patches for Vim release vX.Y.0000.
2026-07-13 21:26:08 -04:00
Barrett Ruth
0bb2f5cc08 fix(ftplugin): source inherited Lua ftplugins
Problem:
Vimscript ftplugins that inherit a base ftplugin often use explicit
`runtime! ftplugin/foo.vim` patterns. This skips corresponding Lua
ftplugins, unlike top-level ftplugin loading.

Solution:
Use the existing `{vim,lua}` patterns for bang runtime imports while
preserving each call's current lookup breadth.
2026-07-14 00:18:50 +02:00
Barrett Ruth
fd02e91319 fix(ftplugin): port checkhealth ftplugin to Lua 2026-07-14 00:18:50 +02:00
Justin M. Keyes
eb94149a29 refactor(vimscript)!: drop ctxget(), ctxpush(), etc #40724
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.
2026-07-13 17:57:13 -04:00
Justin M. Keyes
06ded1330c refactor(core): group Visual-mode globals in VisualExtent #40722 2026-07-13 16:19:32 -04:00
Barrett Ruth
73bb6a8a5e fix(dir): let 3P dir-browser plugin rename the dir buffer #40529
Problem:
`FileType directory` fires *before* the `BufEnter` path where `dir.lua`
populates the buffer, in order to allow a 3P dir-browser plugin to handle the
event and (optionally) rename the buffer to e.g. `example:///tmp/foo/`.

But currently, `open_buffer()` continues after `filetypedetect BufRead` as if
the original directory buffer is *still* current and valid, which may fall
through to the built-in `nvim.dir` path after a 3P plugin ALREADY handled the
directory.

Solution:
Keep a buf ref around the early `filetypedetect BufRead` call for directory
buffers.

If the `FileType directory` handler switches away from/deletes the original
directory buffer, stop the open path instead of continuing into the built-in
`nvim.dir` flow.
2026-07-13 15:10:19 -04:00
Justin M. Keyes
4d736cd41f Merge #40721 from justinmk/refactor 2026-07-13 14:35:23 -04:00
Justin M. Keyes
fe794153ed feat(docs): mark optional API parameters 2026-07-13 20:01:55 +02:00
Justin M. Keyes
9982f6e0e4 refactor(api): omit optional param 2026-07-13 19:44:15 +02:00
Justin M. Keyes
dc8934482e feat(api): optional params after opts #40720
Problem:
After 25439dad7e, `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
2026-07-13 13:43:49 -04:00
dependabot[bot]
01d1ee330f ci: bump actions/labeler in the github-actions group across 1 directory
Bumps the github-actions group with 1 update in the / directory: [actions/labeler](https://github.com/actions/labeler).


Updates `actions/labeler` from 6.1.0 to 6.2.0
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/v6.1.0...v6.2.0)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-13 17:46:54 +02:00
Justin M. Keyes
f50f421694 test(pack): unreliable "vim.pack" tests on Windows #40717
FAILED   …/plugin/pack_spec.lua:92: …/plugin/pack_spec.lua @ 70: vim.pack update() can use lockfile revision as a target
    …/plugin/pack_spec.lua:92: …/plugin/pack_spec.lua:70: process still exists
    stack traceback:
    D:/a/neovim/neovim/test/functional/testnvim/exec_lua.lua:124: in function 'system_sync'
    …/plugin/pack_spec.lua:92: in function 'git_cmd'
    …/plugin/pack_spec.lua:113: in function 'git_add_commit'
    …/plugin/pack_spec.lua:1209: in function <…/plugin/pack_spec.lua:1173>

fix #40167
2026-07-13 10:49:48 -04:00
Barrett Ruth
25439dad7e feat(api): relax contract, opts + rest params are optional #40581
Problem:
|api-contract| allows adding an optional trailing `opts` parameter, but
the dispatch generator still requires every parameter, so `opts` cannot
be omitted.

Solution:
Treat a trailing `Dict(...) *opts` parameter as optional in the generated
RPC and Lua dispatch wrappers.

Co-authored-by: Judit Novak <judit.novak@gmail.com>
2026-07-13 10:28:24 -04:00
Dmytro Meleshko
e18820007f ci: avoid running Coverity in forks #40718
Problem:
If you have this repo forked, the workflow for Coverity Scan creates a lot of
spammy emails about that workflow failing.

Solution:
Check for the presence of `COVERITY_SCAN_TOKEN` and `COVERITY_SCAN_EMAIL` at the
very start of `.github/workflows/coverity.yml`, skip the rest of the workflow if
they are absent. Unfortunately, Github Actions don't offer a straightforward way
of doing that, so using [this workaround](https://github.com/orgs/community/discussions/25280)).
2026-07-13 09:59:31 -04:00
Barrett Ruth
1665b992b7 fix(filetype): trigger FileType after BufReadCmd #40679
Problem:
A successful `BufReadCmd` can leave an existing `filetype` without
rerunning its `FileType` setup, so state cleared during reload may not
be restored.

This also causes `:edit`/reload syntax `directoryDirectory` groups to
not be reapplied.

Solution:
After `BufReadCmd` handles a read, trigger `FileType` for the existing
`filetype` if no `FileType` event fired during the read.
2026-07-13 09:08:09 -04:00
Justin M. Keyes
6ea01d37f8 refactor(core): group insert-mode globals in InsState #40712
Problem:
Insert-mode globals are scattered.

Solution:
Group them into one struct. Besides improving readability and
discoverability, this greatly helps with save/restore of an insert-mode
session.
2026-07-13 09:06:04 -04:00
Justin M. Keyes
07144616ca Merge #40713 from justinmk/fixbuild 2026-07-13 08:44:07 -04:00
Justin M. Keyes
e1c1bd3722 fix(coverity): RESOURCE_LEAK, USE_AFTER_FREE
/src/nvim/ex_docmd.c: 5033             in ex_restart()
    5027         // The address after --listen may be in use by the current server.
    5028         if (i > 0 && strequal(arg, "--listen")) {
    5029           const listitem_T *next_li = li->li_next;
    5030           if (next_li != NULL) {
    5031             const char *addr = tv_get_string(TV_LIST_ITEM_TV(next_li));
    5032             if (strstr(addr, ":") || strstr(addr, "/") || strstr(addr, "\\")) {
    >>>     CID 649201:         Resource leaks  (RESOURCE_LEAK)
    >>>     Overwriting "listen_arg" in "listen_arg = xstrdup(addr)" leaks the storage that "listen_arg" points to.
    5033               listen_arg = TO_SLASH_SAVE(addr);
    5034     #ifdef MSWIN
    5035               // On Windows, don't pass --listen to new server (named pipe can't be reused immediately).
    5036               // Instead pass the address via RPC; new server rebinds after startup.
    5037               li = next_li;
    5038               continue;

    *** CID 649200:         Memory - illegal accesses  (USE_AFTER_FREE)
    /src/nvim/eval/fs.c: 228             in modify_fname()
    222
    223       // ":h" - head, remove "/file_name", can be repeated
    224       // Don't remove the logical root, see `FileInfo`.
    225       while (src[*usedlen] == ':' && src[*usedlen + 1] == 'h') {
    226         valid |= VALID_HEAD;
    227         *usedlen += 2;
    >>>     CID 649200:         Memory - illegal accesses  (USE_AFTER_FREE)
    >>>     Using freed pointer "s".
    228         while (tail > s && after_pathsep(s, tail)) {
    229           MB_PTR_BACK(*fnamep, tail);
    230         }
    231         *fnamelen = tail <= s ? (size_t)(s - *fnamep) : (size_t)(tail - *fnamep);
    232         if (*fnamelen == 0) {
    233           // Result is empty.  Turn it into "." to make ":cd %:h" work.
2026-07-13 05:48:05 +02:00
Justin M. Keyes
3a7989f4f4 docs(shada): outdated docstrings #40711 2026-07-12 22:42:47 -04:00
tao
4a08596314 fix(path): normalize separators (slashes) #39155
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>
2026-07-12 13:23:44 -04:00
Kim A. Brandt
543a96e491 fix(lsp): unclear error on malformed server responses #40422
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.
2026-07-12 12:52:10 -04:00
glepnir
58b6310adc fix(startup): respect enter for windows created in startup scripts #37287
Problem: When a split window is created from the init script using nvim_open_win()
with enter=false, the current window focus is not preserved. The cursor
incorrectly moves into the newly created split during startup.

Solution: Save curwin before the iteration loop in create_windows(), and
restore it after the loop. also update edit_buffers() to use curwin instead
of firstwin.
2026-07-12 12:30:40 -04:00
Justin M. Keyes
17f13ab338 Merge #40473 from janlazo/vimpatch_na_cfuncs
build(vim-patch): detect N/A C files based on diff
2026-07-12 12:13:20 -04:00
Justin M. Keyes
81c4c295ac refactor(insert): rename edit.c => insert.c #40705
Problem:
- `edit.c` is an unnecessarily misleading and less-discoverable name
  than `insert.c`.
- Numerous insert-mode related things are named with a `ins_` prefix.
- There is already a `insexpand.c` module...

Solution:
Rename `edit.c` => `insert.c`.
2026-07-12 11:57:17 -04:00
bfredl
c1e09659b4 Merge pull request #40628 from Rawan10101/wasm-runtime-bundling
build(wasm): bundle runtime files into MEMFS
2026-07-12 17:53:45 +02:00
Justin M. Keyes
ac66c9de03 Merge #40703 from justinmk/fixci 2026-07-12 09:30:57 -04:00
Justin M. Keyes
88b627d72d test(autoread): unreliable "coalesces rapid changes via debouncing"
previous: #40272

    FAILED   …/autoread_spec.lua @ 142: autoread file watcher coalesces rapid changes via debouncing
    Expected values to be equal.
    Expected:
    1
    Actual:
    2
    stack traceback:
    …/autoread_spec.lua:169: in function <…/autoread_spec.lua:142>
2026-07-12 15:15:46 +02:00
Justin M. Keyes
83ced05984 fix(ctx): coverity CHECKED_RETURN
CID 649145:         Error handling issues  CHECKED_RETURN
    /src/nvim/api/window.c: 138             in nvim_win_set_cursor()
    132       // Make sure we stick in this column.
    133       w->w_set_curswant = true;
    134
    135       // make sure cursor is in visible range and
    136       // cursorcolumn and cursorline are updated even if w != curwin
    137       CtxSwitch switchwin;
    >>>     CID 649145:         Error handling issues  (CHECKED_RETURN)
    >>>     Calling "ctx_switch" without checking return value (as is done elsewhere 5 out of 6 times).
    138       ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay);
    139       update_topline(curwin);
    140       validate_cursor(curwin);
    141       ctx_restore(&switchwin);
    142
    143       redraw_later(w, UPD_VALID);
2026-07-12 15:15:46 +02:00
Justin M. Keyes
d25ae8b8c2 refactor(input): rename getchar.c => input.c #40698
Problem:
`getchar.c` is a quirky name and doesn't align with our existing
`os/input.c` and `tui/input.c` modules, which encompass the same topic
at different layers.

Solution:
Rename `getchar.c` => `input.c` for discoverability.

Introduce `dialog.c` for functionality related to showing confirm
prompts, dialogs, etc.
2026-07-12 08:34:13 -04:00
rawan10101
fde6f72f74 build(wasm): bundle runtime files into MEMFS 2026-07-12 14:51:41 +03:00
Christian Clason
1227148ac3 build(deps): bump tree-sitter to d11d18f74 2026-07-12 12:13:02 +02:00
Barrett Ruth
41294e4253 docs(dir): remove augroup deletion note #40696 2026-07-11 18:20:27 -04:00
Barrett Ruth
67af4141c8 fix(filetype): false positive when matching directory buffer #40695
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>
2026-07-11 18:19:44 -04:00