Commit Graph

36001 Commits

Author SHA1 Message Date
Maria Solano
c76bbd0a54 fix(diagnostics)!: restore is_pull namespace argument #38698
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.

(cherry picked from commit 665ebce569)
2026-04-08 20:46:16 +00:00
luukvbaal
5ac95da8ea fix(statusline): no window-local highlights for last line 'ruler' #38879
Problem:  When the 'ruler' is in the last line of the screen, it takes
          local highlight definitions of the current window, tripping an
          assert (since c1648cf8).
Solution: Don't use window-local highlight definitions when the ruler is
          not part of a statusline.

Co-authored-by: glepnir <glephunter@gmail.com>
(cherry picked from commit b35a2e58e9)
2026-04-08 16:39:56 +00:00
Luis Calle
f529bc74f9 docs: vim.range, vim.pos #38869
Problem:
`vim.Range` and `vim.Pos` have signature mismatches on the docs of some functions.

Solution:
Split the "module" functions from the "class" functions (just like it's done in other modules like `vim.version`) and regenerate the docs.

(cherry picked from commit c530fd8e75)
2026-04-08 16:19:48 +00:00
Dan Drennan
11a4a0077c fix(health): recognize Zig build optimization levels #38804
Problem: When Neovim is built with Zig, `:checkhealth` falsely reports
"Non-optimized debug build" for release builds. The extraction regex
stops at the first space, and the validation regex only lists CMake
build type names.

Solution: Fix the extraction regex to capture the full build type string
and add Zig optimization levels (ReleaseFast, ReleaseSafe, ReleaseSmall)
to the validation regex.

AI-assisted: Claude Code
(cherry picked from commit 65ef6cec1c)
2026-04-08 12:43:27 +00:00
glepnir
ca0e3818c0 fix(pum): crash with 'pumborder' and wide item (#38852)
Problem: pum_col goes negative when item width + border exceeds screen.

Solution: account for border_width in pum_compute_horizontal_placement()
instead of adjusting pum_col after the fact

(cherry picked from commit 8603fc9180)
2026-04-08 01:49:56 +00:00
zeertzjq
eee2d10fd2 fix(rpc): trigger UILeave earlier on channel close (#38846)
Problem:
On exit, rpc_free() is called when processing main_loop.events after
libuv calls close callbacks of the channel's stream. However, when there
are no child processes, these libuv callbacks are called in loop_close()
instead of proc_teardown(), and main_loop.events isn't processed after
loop_close(). As a result, calling remote_ui_disconnect() in rpc_free()
causes UILeave to depend on the presence of child processes.

Solution:
Always call remote_ui_disconnect() in rpc_close_event(), and remove the
call in rpc_free().

(cherry picked from commit 5d66ef188f)
2026-04-07 21:55:09 +00:00
luukvbaal
a358b9be64 fix(message): flush messages before "empty" msg_show #38854
Problem:  When emitting a msg_show event with the "empty" kind,
          there may still be messages waiting to be emitted, which
          are then dropped as a result of recursion protection.
Solution: Flush messages before emitting "empty" message show.
(cherry picked from commit 7fff91359e)
2026-04-07 17:54:09 +00:00
Tomas Slusny
6cb5012e36 fix(difftool): ensure standardized locale for diff output parsing #38853
Always pass LC_ALL=C to diff when parsing its output.

Closes #38838

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
(cherry picked from commit 382a1c40c2)
2026-04-07 17:37:52 +00:00
zeertzjq
a7214c0719 fix: don't make path empty when truncating trailing slashes (#38844)
Fixes the following Coverity warning:

*** CID 549779:         Integer handling issues  (INTEGER_OVERFLOW)
/src/nvim/undo.c: 717             in u_get_undo_file_name()
711           dir_name[dir_len] = NUL;
712
713           // Remove trailing pathseps from directory name
714           char *p = &dir_name[dir_len - 1];
715           while (vim_ispathsep(*p)) {
716             *p-- = NUL;
>>>     CID 549779:         Integer handling issues  (INTEGER_OVERFLOW)
>>>     Expression "dir_len--", where "dir_len" is known to be equal to 0, underflows the type of "dir_len--", which is type "size_t".
717             dir_len--;
718           }
719
720           bool has_directory = os_isdir(dir_name);
721           if (!has_directory && *dirp == NUL && !reading) {
722             // Last directory in the list does not exist, create it.

(cherry picked from commit 6b0367481c)
2026-04-07 02:29:33 +00:00
Sanzhar Kuandyk
319c031820 fix(channel): fix Ctrl-C handling regression in terminal
Problem: Normal Windows builtin-TUI startup spawns the embedded server as DETACHED_PROCESS, which breaks Ctrl-C delivery to :terminal jobs.
Solution: Restores the default behavior once the embedded server has a
console so terminal jobs inherit it.

(cherry picked from commit 8bb7533639)
2026-04-07 01:14:46 +00:00
Sanzhar Kuandyk
608d0e01ba refactor(channel): defer hidden console allocation to :detach
Refactor #37977: instead of allocating a hidden console at startup, borrow the parent's console via AttachConsole() and only create an isolated hidden console when :detach is called, with fd 0/1/2 re-bound to the new CONIN$/CONOUT$.

(cherry picked from commit 789741bb83)
2026-04-07 01:14:46 +00:00
glepnir
25170ca02d fix(diagnostic): virtual_lines should anchor at end_lnum, not lnum #38701
Problem: Multi-line diagnostics always render virtual lines below lnum.

Solution: Use end_lnum when placing the virt_lines extmark.
(cherry picked from commit af707dd242)
2026-04-06 18:05:35 +00:00
luukvbaal
c6c348471d fix(cmdline): 'inccommand' preview after setcmdline() #38795
Problem:  'inccommand' preview is not executed after setcmdline(),
          and as a result cmdline_show event is emitted when redrawing
          is not allowed (5b6477be).
Solution: Call command_line_changed() when ccline.cmdbuff_replaced is
          set (by setcmdline()).
(cherry picked from commit 1354787029)
2026-04-06 17:58:41 +00:00
Justin M. Keyes
69baf0059c Merge #38833 2026-04-06 13:12:25 -04:00
Christian Clason
ceaa8b648a feat(filetype): vim.filetype.inspect() returns copy of registry
Problem: No way of inspecting the (user-added) filetype detection rules.

Solution: Add `vim.filetype.inspect()` returning copies of the internal
`extension`, `filename`, `pattern` tables. Due to the dynamic nature of
filetype detection, this will in general not allow getting the list of
known filetypes, but at least one can see if a given extension is known.
2026-04-06 18:53:36 +02:00
Josh Triplett
c294bc397b fix(tui): check background color on resume
Problem:
We normally get the background color via continuous reporting. However,
if we were backgrounded while the light/dark mode changed, we won't have
received the report, and we'll have the wrong background color.

Without this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will not match the current state.

Solution:
Query it on resume as well. (This requires separating the query from the
flush, to just do the query along with all the others, while waiting to
flush until we've set up uv.)

With this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will have updated.
2026-04-06 18:47:03 +02:00
Luis Calle
0a3add979a feat(vim.pos)!: require buf param on vim.pos, vim.range #38665
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

(cherry picked from commit 01be30f638)
2026-04-06 16:19:43 +00:00
Justin M. Keyes
a5f1b373fa build: version bump 2026-04-06 15:21:14 +02:00
Justin M. Keyes
7ac5a26d56 NVIM v0.12.1
Following is a list of commits (fixes/features only) in this release.
See `:help news` in Nvim for release notes.

FEATURES
--------------------------------------------------------------------------------
- 8a79d3a3bb :restart: reattach all UIs (#38683)

FIXES
--------------------------------------------------------------------------------
- 415626d46d :restart: inherit stderr fd on Unix (#38755)
- 8b3f3113c4 :restart: only pass --headless when there is no UI (#38580)
- e5792f6353 api: avoid error when parsing invalid expr after :echo (#38695)
- 6ef5f59be6 channel: crash on exit after closing v:stderr channel (#38754)
- 14ee84e7a5 cmdline: redraw cmdline after empty message (#38485)
- b2702913b9 defaults: check for TUI on non-stdio channel on startup (#38581)
- c3e52bb264 events: avoid recursive loop_uv_run() from vim.ui_attach() shell message
- 4bf170d79d help: show error when using :help! with nothing at cursor #38775
- c692e848e9 lsp: do not respond to codelens refresh if a request is already scheduled (#38801)
- 2eb14c54bc lsp: highlight snippet preview when server can't completionItem/resolve (#38534)
- f2764a596d lsp: reset document color processed version on clear (#38582)
- 8f7cbf6d66 lsp: use `winresetview()` to avoid switching to normal mode (#38641)
- 6cb439ac9e net: handle remote archive URLs via tar/zip browse #38744
- 35a9bf8785 pack: avoid eager vim.version call #38705
- fdf94493cf pack: use `uv.available_parallelism()` to compute number of threads #38717
- 60a24d707c termkey: use terminfo for (shift+)left/right keys
- 9f16ad8ca3 treesitter: select reset to "v" visualmode()
- 2d9619fac7 treesitter: select with node ending with unicode char (#38557)
- d83141c0f2 ui2: allow empty argument for enable() #38605
- b924afb36b ui2: correct buffer reference in msg:start_timer() (#38600)
- 131a3cacb3 ui2: prevent flicker when entering pager from expanded cmdline (#38662)
- bac7c3a996 ui2: update spill indicator when appending to expanded cmdline #38715
- dee6d2ad97 ui2: vim.on_key should return nil instead of false (#38668)
- e7a07364ad vim.net: check if vim.system's stdout is nil #38713
- 32ca1aae88 window: clear cmdline 'ruler' when window is closed (#38631)
- d660233edf windows: force console codepage to UTF-8 for shell/system() #38742

PERFORMANCE
--------------------------------------------------------------------------------
- 3de423eb20 vim.pos: use `nvim_buf_line_count` instead of fetching all lines #38686

BUILD
--------------------------------------------------------------------------------
- 38b5cfc74a cmake: allow ignoring deps sha

VIM PATCHES
--------------------------------------------------------------------------------
- 90b4f02b44 068c060: runtime(rustfmt): not correctly escaping directory names (#38597)
- 304c0ac9f9 12f6f20: runtime(sh): Keep function name patterns engine neutral (#38719)
- 10bd554c0f 82ebaa7: runtime(racket): Make visual K mapping more robust for shell injection (#38677)
- c084ab9f57 9.2.0276: [security]: modeline security bypass (#38657)
- 04fabbf32d 9.2.0277: tests: test_modeline.vim fails (#38672)
- 3e2ce64f88 9.2.0280: [security]: path traversal issue in zip.vim (#38693)
- 58cc2fdc5f 9.2.0285: :syn sync grouphere may go beyond end of line (#38727)
- bf084967d7 9.2.0299: runtime(zip): may write using absolute paths (#38810)
- a837c906bb 9.2.0303: tests: zip plugin tests don't check for warning message properly
- c09e82d12a 9.2.0304: tests: test for 9.2.0285 doesn't always fail without the fix
- dd85c13382 runtime file updates (#38659)

REFACTOR
--------------------------------------------------------------------------------
- 49133b4f77 typval.c: fix wrong argument to macro (#38813)

REVERTED CHANGES
--------------------------------------------------------------------------------
- 8e490e70ed "fix(scripts): gen_terminfo clears Windows terminfo definitions #36736"
- ad0adbb1b2 "refactor(process): don't read from PTY master using uv_pipe_t" (#37401)
v0.12.1 stable
2026-04-06 15:12:48 +02:00
Luuk van Baal
c3e52bb264 fix(events): avoid recursive loop_uv_run() from vim.ui_attach() shell message
Problem:  vim.ui_attach() msg_show callback runs the risk of a recursive
          loop_uv_run() when trying to display a message from a shell
          command stream.
Solution: Schedule the message callback on the fast_events queue.
(cherry picked from commit fa302037f9)
2026-04-06 09:57:59 +00:00
zeertzjq
c09e82d12a vim-patch:9.2.0304: tests: test for 9.2.0285 doesn't always fail without the fix
Problem:  When the terminal is very large, test for 9.2.0285 doesn't
          trigger an ASAN error without the fix.
Solution: Use a window with fixed height (zeertzjq)

closes: vim/vim#19924

b03970f41f
(cherry picked from commit f8695fc529)
2026-04-06 09:28:32 +00:00
zeertzjq
a837c906bb vim-patch:9.2.0303: tests: zip plugin tests don't check for warning message properly
Problem:  zip plugin tests may match messages from previous test cases
          when checking for warning message.
Solution: Clear messages at the start of these tests (zeertzjq).

closes: vim/vim#19926

a1f4259e68
(cherry picked from commit c2d7f6b642)
2026-04-06 09:28:32 +00:00
nameearly
49133b4f77 refactor(typval.c): fix wrong argument to macro (#38813)
(cherry picked from commit eb9be11da8)
2026-04-06 04:32:05 +00:00
zeertzjq
bf084967d7 vim-patch:9.2.0299: runtime(zip): may write using absolute paths (#38810)
Problem:  runtime(zip): may write using absolute paths
          (syndicate)
Solution: Detect this case and abort on Unix, warn in the documentation
          about possible issues

46f530e517

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 4aa8969d29)
2026-04-06 02:39:21 +00:00
Justin M. Keyes
f92a68d4bc docs: statusline
fix https://github.com/neovim/neovim/issues/38670

(cherry picked from commit 6b796696c3)
2026-04-06 01:24:32 +00:00
Justin M. Keyes
eac20cd17f docs: bump minimum required Win 10 to version 2004
see https://github.com/neovim/neovim/issues/32367#issuecomment-4188641644

(cherry picked from commit 57457f227d)
2026-04-06 01:24:32 +00:00
Evgeni Chasnovski
35a9bf8785 fix(pack): avoid eager vim.version call #38705
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.
(cherry picked from commit 157c7bccb0)
2026-04-06 01:18:37 +00:00
Elijah Koulaxis
d660233edf fix(windows): force console codepage to UTF-8 for shell/system() #38742
Problem:
On Windows, `:!echo тест` shows `????` because the console code page defaults to a legacy ANSI encoding (e.g. CP1252) instead of `UTF-8`

Solution:
Call `SetConsoleOutputCP(CP_UTF8)` and `SetConsoleCP(CP_UTF8)` in `do_os_system()` before spawning child processes, and restore the original values after. It covers both `:!` and `system()` since they both go through `do_os_system()`

(cherry picked from commit bba48ee1b0)
2026-04-05 23:47:51 +00:00
Yi Ming
c692e848e9 fix(lsp): do not respond to codelens refresh if a request is already scheduled (#38801)
(cherry picked from commit 909fc0b992)
2026-04-05 21:15:28 +00:00
Tom Ampuero
6cb439ac9e fix(net): handle remote archive URLs via tar/zip browse #38744
Problem:
Opening .tar.gz or .zip URLs shows raw binary instead of using the archive plugins.

Solution:
Similar to the original netrw implementation, the autocmd should detect
archive URLs, download them to a temp file and the open them with
tar/zip handlers already bundled as vim plugins.

(cherry picked from commit 6d420feaef)
2026-04-05 20:32:59 +00:00
Yochem van Rosmalen
e7a07364ad fix(vim.net): check if vim.system's stdout is nil #38713
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.

(cherry picked from commit 398ee83f4f)
2026-04-05 19:24:57 +00:00
Evgeni Chasnovski
fdf94493cf fix(pack): use uv.available_parallelism() to compute number of threads #38717
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.
(cherry picked from commit 3cba8df041)
2026-04-05 17:44:08 +00:00
zeertzjq
4bf170d79d fix(help): show error when using :help! with nothing at cursor #38775
It's possible to still show the old Easter egg, but then the user won't
know about the new feature, so showing E349 is better.

(cherry picked from commit 9705a1c13b)
2026-04-05 15:55:29 +00:00
luukvbaal
bac7c3a996 fix(ui2): update spill indicator when appending to expanded cmdline #38715
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.
(cherry picked from commit 2663f51890)
2026-04-05 14:10:13 +00:00
dundargoc
38b5cfc74a build(cmake): allow ignoring deps sha
Followup to 39335d6a7d.

(cherry picked from commit bebf949f1f)
2026-04-05 11:30:43 +00:00
zeertzjq
415626d46d fix(:restart): inherit stderr fd on Unix (#38755)
This in turn gives TTY access to channel_from_stdio() in the new server,
if the old server has access to a TTY.

(cherry picked from commit 9927d9259d)
2026-04-04 14:25:27 +00:00
zeertzjq
6ef5f59be6 fix(channel): crash on exit after closing v:stderr channel (#38754)
Problem:  Crash on exit after closing v:stderr channel when piping
          to stdin.
Solution: Reopen stderr as /dev/null or NUL instead of closing it.
          This also avoids writing to an related file if one is opened
          after closing v:stderr.
(cherry picked from commit e20c4ea966)
2026-04-04 13:27:26 +00:00
zeertzjq
58cc2fdc5f vim-patch:9.2.0285: :syn sync grouphere may go beyond end of line (#38727)
Problem:  :syn sync grouphere may go beyond end of line.
Solution: Start searching for the end of region at the end of match
          instead of a possibly invalid position (zeertzjq).

closes: vim/vim#19896

b7cffc8434
(cherry picked from commit d7ef77d175)
2026-04-03 09:52:07 +00:00
zeertzjq
304c0ac9f9 vim-patch:12f6f20: runtime(sh): Keep function name patterns engine neutral (#38719)
Request less backtracking to function-name candidates for
nonlinear patterns with any regexp engine BUT force using
the old engine with these patterns to avoid incurring an
additional penalty, according to ":syntime report", when the
new regexp engine is preferred.

fixes:  vim/vim#19847
closes: vim/vim#19849

12f6f20552

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
(cherry picked from commit 3cb79189f3)
2026-04-02 23:23:05 +00:00
zeertzjq
d7898dc1e6 test(terminal/cursor_spec): fix flaky test (#38712)
FAILED   test/functional/terminal/cursor_spec.lua @ 419: :terminal cursor uses the correct attributes
test/functional/terminal/cursor_spec.lua:448: Expected objects to be the same.
Passed in:
(string) 'block'
Expected:
(string) 'vertical'
stack traceback:
	test/functional/terminal/cursor_spec.lua:448: in function <test/functional/terminal/cursor_spec.lua:419>

(cherry picked from commit 596a7a32f3)
2026-04-02 15:09:15 +00:00
altermo
9f16ad8ca3 fix(treesitter): select reset to "v" visualmode()
(cherry picked from commit facc21cc63)
2026-04-02 13:49:39 +00:00
zeertzjq
8a79d3a3bb feat(:restart): reattach all UIs (#38683)
This is quite easy since [command] is now only executed once on UIEnter.
2026-04-02 21:45:04 +08:00
zeertzjq
e5792f6353 fix(api): avoid error when parsing invalid expr after :echo (#38695)
Problem:  Parsing :echo followed by invalid expression leads to error.
Solution: Suppress error when skipping over expression.
(cherry picked from commit f2cdf73afc)
2026-04-01 23:42:23 +00:00
zeertzjq
3e2ce64f88 vim-patch:9.2.0280: [security]: path traversal issue in zip.vim (#38693)
Problem:  [security]: path traversal issue in zip.vim
          (Michał Majchrowicz)
Solution: Detect more such attacks and warn the user.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-jc86-w7vm-8p24

7088926316

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 0851ac2706)
2026-04-01 22:54:26 +00:00
Justin M. Keyes
0142453543 backport: docs: misc #38692 2026-04-01 17:08:38 -04:00
Luis Calle
3de423eb20 perf(vim.pos): use nvim_buf_line_count instead of fetching all lines #38686
(cherry picked from commit 79a2235fd1)
2026-04-01 19:50:47 +00:00
phanium
dee6d2ad97 fix(ui2): vim.on_key should return nil instead of false (#38668)
(cherry picked from commit a2d9863c27)
2026-04-01 13:34:04 +00:00
zeertzjq
10bd554c0f vim-patch:82ebaa7: runtime(racket): Make visual K mapping more robust for shell injection (#38677)
fyi @benknoble

82ebaa79b0

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit a0fcf32ad5)
2026-04-01 12:07:53 +00:00
zeertzjq
04fabbf32d vim-patch:9.2.0277: tests: test_modeline.vim fails (#38672)
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).

8c8772c6b3
(cherry picked from commit 65e2218585)
2026-04-01 10:21:24 +00:00
zeertzjq
c084ab9f57 vim-patch:9.2.0276: [security]: modeline security bypass (#38657)
Problem:  [security]: modeline security bypass
Solution: disallow mapset() from secure mode, set the P_MLE flag for the
          'complete', 'guitabtooltip' and 'printheader' options.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-8h6p-m6gr-mpw9

75661a66a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit c7604323e3)
2026-04-01 01:52:31 +00:00