Commit Graph

36074 Commits

Author SHA1 Message Date
glepnir
34cbfeca9c fix(lsp): show CompletionItem.detail in info popup #38904
Problem: completionItem/resolve response's `detail` field is silently
dropped. Only `documentation` is shown in the popup.

Solution: Prepend `detail` as a fenced code block before `documentation`
in the info popup, skipping if documentation already contains it.

(cherry picked from commit b351afb1b1)
2026-04-18 20:42:42 +00:00
Aditya Malik
326a7d5afb docs(events): Lua types for autocmd event-data #38518
Problem:
  No LuaLS types for event-data fields (ev.data). Types are only
  documented ad hoc in scattered locations.

Solution:
  Add runtime/lua/vim/_meta/events.lua defining vim.event.<name>.data
  classes for events that provide ev.data. Reference the types from
  each event's help in autocmd.txt, lsp.txt, and pack.txt.
(cherry picked from commit 2cb240319b)
2026-04-18 20:35:15 +00:00
Evgeni Chasnovski
9aadbed770 fix(lua): make vim._with() work with buf=0 and win=0 context #39151
Problem: Using `buf=0`/`win=0` context in `vim._with` should be
  equivalent to using explicit buffer/window identifier respectively.

Solution: Explicitly adjust context in case of `buf=0` or `win=0`.
(cherry picked from commit 3a4cc5db0b)
2026-04-18 20:34:47 +00:00
phanium
1ebb9b16d2 fix(eval): crash on some NULL ptr deref #39182
Crash on
```
let busy=$FOO
call prompt_setcallback(bufnr('%'), $FOO)
call chanclose(1, $FOO)
```

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
(cherry picked from commit f0329092f7)
2026-04-18 20:32:05 +00:00
zeertzjq
20c6edbc12 test(tui_spec): don't run tty-test in a shell (#39186)
(cherry picked from commit 48d11681c2)
2026-04-18 12:30:01 +00:00
luukvbaal
f2a5c90cbc fix(marks): adjust marks when unloading "nofile" buffer #39118
Problem:  Marks are not adjusted unloading a buffer that doesn't exist
          on disk. E.g. extmarks are still valid (and will be beyond the
          end of the buffer if the buffer is reloaded), even though the
          text is lost.
Solution: Adjust marks for a cleared buffer when unloading a buffer that
          doesn't exist on disk.
(cherry picked from commit 68f7acaaae)
2026-04-18 11:49:58 +00:00
Evgeni Chasnovski
c6578ea28b fix(vim.filetype): match() fails if g:ft_ignore_pat is not defined #39158
Problem: Calling `vim.filetype.match({ filename = '...', buf = ... })`
  during startup results in an error due to not yet defined
  `g:ft_ignore_pat`.

Solution: Add a guard to check `g:ft_ignore_pat` related properties only
  if the variable is defined. This also allows to simplify other tests
  which did not depend on `g:ft_ignore_pat` but required it explicitly
  set to work.
(cherry picked from commit 6b9b4a1377)
2026-04-18 11:44:54 +00:00
Justin M. Keyes
55d3d1bbeb backport: test(lsp): extract buf/util parts from lsp_spec.lua (#39170)
test(lsp): extract buf/util parts from lsp_spec.lua

Problem:
`test/functional/plugin/lsp_spec.lua` had grown into a large catch-all file that mixed core LSP client lifecycle coverage, `vim.lsp.buf.*` behavior, and `vim.lsp.util.*` behavior in one place.

Solution:
Split the large tests into more focused test files without changing test coverage or intended behavior.

After this change, `lsp_spec.lua` is more focused on core LSP client/config/dynamic-registration behavior.

Co-authored-by: Yi Ming <ofseed@foxmail.com>
2026-04-18 03:01:28 +00:00
zeertzjq
27214645f6 vim-patch:450895d: runtime(make): fix wrong highlighting with $ inside double quotes (#39177)
fixes: vim/vim#19986

450895d86b

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit eb569a695f)
2026-04-18 00:50:15 +00:00
zeertzjq
19a54ad964 vim-patch:e666597: runtime(doc): make window option description a bit less vague (#39173)
Say explicitly that ":setlocal" sets the local value, while ":set" also
sets the global value.

related: vim/vim#19993

e666597622
(cherry picked from commit 674f4b35ab)
2026-04-18 00:45:52 +00:00
zeertzjq
d3ef77639a fix(terminal): forward streamed bracketed paste properly (#39152)
(cherry picked from commit 4eaf782bb6)
2026-04-17 23:22:18 +00:00
dependabot[bot]
501a4425e2 ci: bump the github-actions group across 2 directories with 2 updates
Bumps the github-actions group with 1 update in the / directory: [github/codeql-action](https://github.com/github/codeql-action).
Bumps the github-actions group with 1 update in the /.github/actions/cache directory: [actions/cache](https://github.com/actions/cache).


Updates `github/codeql-action` from 4 to 4.35.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4...v4.35.1)

Updates `actions/cache` from 5 to 5.0.4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v5...v5.0.4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: actions/cache
  dependency-version: 5.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-18 07:19:08 +08:00
zeertzjq
f93561723c test: include test path in summary (#39141)
Ref: https://github.com/neovim/neovim/pull/38486#discussion_r3088483987
(cherry picked from commit fefad0721a)
2026-04-17 14:08:02 +00:00
zeertzjq
e4dc08da1a fix(completion): update CursorColumn during completion (#39159)
Since Nvim uses a compositor, redrawing windows won't lead to flicker in
the popup menu, so the pum_visible() checks in move.c can be removed.

(cherry picked from commit 724fccd46f)
2026-04-17 13:45:21 +00:00
zeertzjq
891c6c9150 vim-patch:8.2.2440: documentation based on patches is outdated (#39144)
Problem:    Documentation based on patches is outdated.
Solution:   Add changes to documentation in a patch.

853886722c

Trailing space was removed in later patches.
Also fix a few more misplaced error numbers from #8155.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 39410ef42b)
2026-04-17 02:10:01 +00:00
Justin M. Keyes
3d01b127f6 test: lint EXX error codes #8155
Problem:
- Choosing a new EXX error code is tedious.
- It's possible to accidentally use an EXX error code for different
  purposes.

Solution:
Add a lint check which requires EXX error codes to have a :help tag.
This also avoids duplicates because `make doc` does `:helptags ++t doc`
which fails if duplicates are found.

(cherry picked from commit bc6d946cca)
2026-04-17 00:58:50 +00:00
glepnir
eb4e7f15d6 refactor: move e_invalwindow to errors.h (#39067)
Problem: e_invalwindow was a static local, inconsistent with other error strings.

Solution: Convert it to EXTERN/INIT style and move it to errors.h.
(cherry picked from commit 92317013b4)
2026-04-17 00:32:11 +00:00
Evgeni Chasnovski
ee6c718feb docs(pack): improve "Synchronize across machines" steps #39122
Problem: Sometimes automatic lockfile synchronization after `:restart`
  might fail, like due to bad/absent Internet connection. This would
  remove failed to install entries from the lockfile (since they are not
  on disk and lockfile is meant to lock the latest plugin version on
  disk).

Solution: Document that this should be treated as an unwanted update and
  use steps similar to "Revert plugin after an update" use case.
(cherry picked from commit 42e9d8dfd1)
2026-04-17 00:19:01 +00:00
altermo
111c7f434e fix(treesitter): TSNode:id() with NUL byte causes unreliable select() #39134
Problem:
`TSNode:id()` returns the underlying c pointer as a string, which may include
NUL bytes. In PUC Lua, `('%s'):format('\0a\0')` returns `''` and not `'\0a\0'`
(i.e. treats the string as a c-string (which terminates at the NUL byte)).

This resulted in two different nodes being able to have the same id.

Solution:
Use concatenation `..` instead of `string.format()`.

(cherry picked from commit bb2284d75e)
2026-04-16 22:48:50 +00:00
luukvbaal
b08c289a45 fix(ui2): dialog paging is inconsistent #39128
Problem:  - Paging keys in the dialog window consume input when the user
            may not expect it. The dismissable title hint intended to
            mitigate that results in having to press Escape twice to
            abandon the prompt.
          - Mimicked "msgsep" float border is taking up unnecessary
            space when window takes up the entire screen.

Solution: - Use (conventional, albeit less convenient) keys intended
            for scrolling to page the dialog window:
            <(Mousewheel/Page)Up/Down>, <Home/End>.
          - Only set the float top border when separation is actually
            necessary, i.e. window does not reach the first row.
(cherry picked from commit f0a8e6f337)
2026-04-16 21:01:25 +00:00
Evgeni Chasnovski
9d66c7828e docs(diagnostic): severity names are sometimes allowed #39120
Problem: Using severity names (like "ERROR", "WARN") in functions like
  `vim.diganostic.get()` and `vim.diagnostic.config()` is allowed and
  tested for many years now. But documentation about it can be clearer.

Solution: Explicitly mention that severity names are allowed in some
  situations. Ideally, it would also require updating typing for
  `vim.diagnostic.SeverityFilter`, but that looks problematic to do
  robustly.
(cherry picked from commit 711f3cc299)
2026-04-16 16:05:12 +00:00
Evgeni Chasnovski
5f23c0a1cf test(pack): increase retry timeout for startup test #39125
Problem: Unreliable test on Windows which sometimes fails with too many
  failed retries.

Solution: Increase timeout in hopes that it will be enough to make it
  pass more frequently. This should not affect fast and already working
  platforms.
(cherry picked from commit df6a0827fb)
2026-04-16 15:18:20 +00:00
Justin M. Keyes
a1712503d8 backport test: lint naming conventions (#39124)
test: lint naming conventions

Problem:
Naming conventions are not automatically checked.

Solution:
Add a check to the doc generator. Eventually we should extract this
somehow, but that will require refactoring the doc generator...

Note: this also checks non-public functions, basically anything that
passes through `gen_eval_files.lua` and `gen_vimdoc.lua`. And that's
a good thing.
2026-04-16 14:29:50 +00:00
purrtc0l
d89cfa1a8e docs(l10n): fix fuzzy zh_CN translations #39109
Problem:
Several zh_CN translations were marked fuzzy with wrong or placeholder msgstr.

Solution:
Fix fuzzy entries, preserve format specifiers, use full-width punctuation.

(cherry picked from commit e56deecf00)
2026-04-16 10:18:48 +00:00
Barrett Ruth
2ea9ed32e4 fix(treesitter): restore highlighting on 32 bit systems #39091
Problem: Treesitter highlighting regressed on 32-bit builds because ranges that should cover the whole buffer were corrupted when passed into Lua.

Solution: Round-trip those range values through Lua and validate them so treesitter sees the same ranges on 32 and 64-bit builds.
(cherry picked from commit 3838a2579e)
2026-04-16 08:39:41 +00:00
Luis Calle
efc136850d refactor(lsp): fix typing for LSP methods #39099
Problem
Some variables use the wrong type (ClientToServer instead of ServerToClient)
and some use vaguer types that could be more strict.

Solution
Use the correct types.

(cherry picked from commit 530cfa1323)
2026-04-16 08:23:06 +00:00
zeertzjq
9c11229832 vim-patch:9.2.0357: [security]: command injection via backticks in tag files (#39102)
Problem:  [security]: command injection via backticks in tag files
          (Srinivas Piskala Ganesh Babu, Andy Ngo)
Solution: Disallow backticks before attempting to expand filenames.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-cwgx-gcj7-6qh8

Supported by AI

c78194e41d

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit 0e07b2a1e2)
2026-04-16 03:33:53 +00:00
Justin M. Keyes
099489b985 backport: refactor: update usages of deprecated "buffer" param #39090 2026-04-15 19:46:07 +00:00
Justin M. Keyes
94f6cbb8bb Merge #39088 test: replace busted with local harness 2026-04-15 14:47:12 -04:00
Justin M. Keyes
df0f88a5a9 refactor(api): rename "window" to "win" (positional parameters) #39083
continues d0af4cd909.

This commit renames positional parameters. This is only "cosmetic", but
is intended to make it extra clear which name is preferred, since people
often copy existing code despite the guidelines in `:help dev-naming`.

(cherry picked from commit 71ac4db335)
2026-04-15 18:12:34 +00:00
Lewis Russell
11d0e7e5fc test: replace busted with local harness
Replace the busted-based Lua test runner with a repo-local harness.

The new harness runs spec files directly under `nvim -ll`, ships its own
reporter and lightweight `luassert` shim, and keeps the helper/preload
flow used by the functional and unit test suites.

Keep the file boundary model shallow and busted-like by restoring `_G`,
`package.loaded`, `package.preload`, `arg`, and the process environment
between files, without carrying extra reset APIs or custom assertion
machinery.

Update the build and test entrypoints to use the new runner, add
black-box coverage for the harness itself, and drop the bundled
busted/luacheck dependency path.

AI-assisted: Codex
(cherry picked from commit 55f9c2136e)
2026-04-15 19:47:10 +02:00
Lewis Russell
0039785724 fix(lua): make vim.deep_equal cycle-safe
AI-assisted: Codex
(cherry picked from commit e289f9579c)
2026-04-15 19:43:25 +02:00
Lewis Russell
243a5ac5fd test(vterm): retain ffi callback structs
AI-assisted: Codex
(cherry picked from commit 08ecb3a734)
2026-04-15 19:43:25 +02:00
Justin M. Keyes
373a248b0f refactor(api): rename buffer to buf (positional parameters) #39013
In 3a4a66017b, 4d3a67cd62, df8d98173c we renamed "buffer" to "buf"
in dict parameters and return-values.

This commit renames positional parameters. This is only "cosmetic", but
is intended to make it extra clear which name is preferred, since people
often copy existing code despite the guidelines in `:help dev-naming`.

(cherry picked from commit d0af4cd909)
2026-04-15 14:09:12 +00:00
zeertzjq
d672f0f494 vim-patch:partial:9.2.0348: potential buffer underrun when setting statusline like option (#39063)
Problem:  potential buffer underrun when settings statusline like option
          (q1uf3ng)
Solution: Validate that p > out before accessing p[-1]

closes: vim/vim#19961

91b402f575

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit e0eb967f8a)
2026-04-15 00:52:51 +00:00
zeertzjq
8ba79b4601 vim-patch:9.2.0345: Wrong autoformatting with 'autocomplete' (#39060)
Problem:  Wrong autoformatting with 'autocomplete'.
Solution: Don't trigger autoformatting when ending autocompletion
          without selecting an item (zeertzjq).

fixes:  vim/vim#19954
closes: vim/vim#19970

efbd482116
(cherry picked from commit 65680f59d1)
2026-04-15 00:15:27 +00:00
Barrett Ruth
d86d9759e5 fix(gf): handle local file: URI paths #38915
Problem:
`gf` and `<cfile>` treat `file:/absolute/path` as a literal path and
open `file:/...` instead of the local file.

Solution:
Strip the local `file:` prefix before path resolution in the hyperlink
path code.

(cherry picked from commit e827c3b648)
2026-04-14 23:40:16 +00:00
Justin M. Keyes
465aa2af1d test: n.rmdir() save-and-restore CWD #39048
(cherry picked from commit faad7c73ac)
2026-04-14 16:18:05 +00:00
Evgeni Chasnovski
843cfd7295 test(pack): use n.rmdir() to delete directories #39046
Problem: using `vim.fs.rm(dir_path, { force = true, recursive = true })`
  can result in an error on Windows if the process has a handle to it.

Solution: Use `n.rmdir()` helper in cases when its possible side effects
  (like changing working directory) does not matter.
(cherry picked from commit b8a24bfadf)
2026-04-14 14:33:53 +00:00
luukvbaal
4a18c05f87 fix(cmdline): avoid Ex-mode NULL cmdline_block event #39043
Problem: Attempting to emit cmdline_block event with NULL cmdbuff after
<C-\><C-N> in Ex-mode.

Solution: Don't emit cmdline_block event when cmdbuff is NULL.
(cherry picked from commit f0f9620b38)
2026-04-14 14:02:14 +00:00
Justin M. Keyes
29684ca3cc Merge pull request #39039 from justinmk/release
backport: docs: lsp, options, api
2026-04-14 07:32:23 -04:00
Justin M. Keyes
ceb355599e ci: mention "backport" in PR title #39040
This doesn't affect the merged commit(s), only the PR title.
2026-04-14 13:27:29 +02:00
Justin M. Keyes
ccba8a8f2d docs: lsp, options, api
- revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b

Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-14 13:27:29 +02:00
Justin M. Keyes
53038d2c38 fix(lua): not obvious which _meta/ files are generated #39035
Problem:
- Not obvious which _meta/ are generated and which should be edited
  manually.
- The require guard (`error('Cannot require a meta file')`) is not
  consistently present in all meta files.

Solution:
- Update headers.
- Add require() guard to all meta files.
- Rename generated meta files with `.gen.lua`.

(cherry picked from commit 65b40e69ac)
2026-04-14 10:04:52 +00:00
neovim-backports[bot]
c630ca7459 refactor(options): generate "modeline disallowed" doc text (#39034)
Problem:
- Lots of redundant text in options docs for "not allowed in
  a modeline", even though we already have a flag that indicates that.
- `deny_in_modelines` is an old vestigial flag only used by 'encoding'
  (which never changes).

Solution:
- Generate docs based on the `secure` flag.
- Remove the `deny_in_modelines` flag (`kOptFlagNoML`).

(cherry picked from commit 829e9ec65e)

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-14 04:43:09 -04:00
Justin M. Keyes
570d8fd128 backport: feat(api): rename buffer to buf in retval #39015
In 3a4a66017b, 4d3a67cd62
we renamed "buffer" to "buf" in dict parameters.

This commit also renames such keys in dict return-values.
2026-04-13 18:38:44 -04:00
neovim-backports[bot]
abcc5342ee fix(terminal): do not reflow altscreen on resize #39024
Problem: reflow can break tui display
Solution: disable reflow on altscreen
(cherry picked from commit 7bb8231577)

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2026-04-13 18:31:24 -04:00
zeertzjq
aac55faa2c test(terminal/channel_spec): wait some time for shell to start (#38995)
Problem:
The retry on Windows doesn't seem to actually work, as the test still
occasionally fails on Windows. Meanwhile the test can fail on Linux as
well:

FAILED   test/functional/terminal/channel_spec.lua @ 123: chansend sends lines to terminal channel in proper order
test/functional/terminal/channel_spec.lua:131: retry() attempts: 1
test/functional/terminal/channel_spec.lua:134: Failed to match any screen lines.
Expected (anywhere): "echo "hello".*echo "world""
Actual:
  |^ech$ o "hello"                                                                                      |
  |echo "world"                                                                                        |
  |hello                                                                                               |
  |$ world                                                                                             |
  |$                                                                                                   |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |term://~/work/neovim/neovim/build/Xtest_xdg_terminal//32516:sh [-]                                  |
  |                                                                                                    |

Solution:
Use a wait before the chansend() instead.

(cherry picked from commit b081cc3aeb)
2026-04-12 23:29:14 +00:00
Justin M. Keyes
5920a1d07f revert: "fix(lsp): only resolve LSP configs once" #38990
revert eb90f5d9e3

(cherry picked from commit 4eb95c8ed2)
2026-04-12 22:09:15 +00:00
Lars Debor
6250019537 fix(lsp): show_document can't position cursor past EOL in insert-mode #38566
Problem: vim.lsp.util.show_document insert mode is unable
to set the cursor after the target character position if the target character
is at end of line.

Solution: Move cursor after the target character (in append position)
in this case.

(cherry picked from commit 891bb0e6ce)
2026-04-12 16:40:51 +00:00