Commit Graph

37123 Commits

Author SHA1 Message Date
jdrouhard
f0559997dd fix(lsp): semantic tokens reset_timer() usage #40554
Problem: reset_timer() was being called without checking for whether the
client state for the client_id still existed. debounce_request() starts
a timer that defers a call to send_request() which then calls
reset_timer(). If the timer fires after the client_state is erased, then
the deferred function attempts to dereference the timer on a nil client
state.

Solution: Change reset_timer to take a state directly so it can't be nil
and move the reset_timer() call inside a guard that ensures state
exists. Additionally, reset a client's timer when the client detaches so
it doesn't become dangling.
2026-07-04 11:22:34 -04:00
jdrouhard
29db6ce84c fix(lsp): use LspNotify for document_color #40571
Problem: The document_color lsp module was already using the capability
framework but was still using raw buffer events to handle requests and
reloading. This means that every keystroke was sending a document_color
request to the server since there was no debounce in the raw handlers.

Solution: Switch to using LspNotify autocmd events. LspNotify fires just
after new document versions are synced with the server and provides a
built in debounce mechanism for changes. It also provides the signal for
when the current state should be cleared (didClose). The detach part is
already handled by the capability framework.

Fixes #39785
2026-07-04 09:29:05 -04:00
Barrett Ruth
6cbc5ea13d docs(lsp): document rpc Client request/notify as fields #40573
Problem:
`request()` and `notify()` are methods of the object returned by
`vim.lsp.rpc.start()`/`connect()`, but were rendered with module-level
helptags (`vim.lsp.rpc.request()`, `vim.lsp.rpc.notify()`) (erroneously
implying module functions that do not exist).

Solution:
Mark the wrappers `@private` and describe them on `vim.lsp.rpc.Client` instead.
2026-07-04 09:24:25 -04:00
Justin M. Keyes
00917aa6f6 test: unreliable "stdpath() avoids DOS 8.3 filenames" #40574
Problem:

    FAILED   …/defaults_spec.lua @ 1286: stdpath() avoids DOS 8.3 filenames for "cache" and "run"
    Expected values to be equal.
    Expected:
    "XTEST_~1"
    Actual:
    "XTEST_~2"
    stack traceback:
    …/defaults_spec.lua:1296: in function <…/defaults_spec.lua:1286>

Solution:
Relax the test.
2026-07-04 13:03:51 +00:00
Manoj Panda
9456cec7f9 vim-patch:9.2.0769 conversion to utf-16be using iconv is inconsistent #40567
fix(iconv): conversion to utf-16be using iconv is inconsistent

vim-patch:9.2.0769

Problem:  enc_canonize function changes utf-16be to utf-16 but in linux
          type utf-16 defaults to utf-16le.

Solution: Creating a separate entry for utf-16be in enc_canon_table.
          Note: the effect is only visible on iconv implementations that
          treat "utf-16" and "utf-16be" differently, so the test does
          not necessarily fail on an unpatched Vim. But the bug is
          visible in vim.iconv. (Manoj Panda)

from: vim/vim@2a63f74
closes: neovim#40262

Signed-off-by: Manoj Panda <manojpandawork@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-07-04 11:50:38 +00:00
STG
abedbfc175 fix(cmdwin): set 'noscrollbind' #40556
Problem:
Opening cmdwin from a 'scrollbind' window makes cmdwin scrollbinded.
Legacy cmdwin set 'noscrollbind'.

Solution:
Set 'noscrollbind'.
2026-07-04 07:29:26 -04:00
zeertzjq
44baf03f2a Merge pull request #40566 from zeertzjq/vim-9.2.0782
vim-patch:9.2.{partial:0579,0782}
2026-07-04 09:02:40 +08:00
zeertzjq
60e46704bd vim-patch:9.2.0782: tests: missing cleanup in test_mksession.vim
Problem:  Some test_mksession tests do not cleanup all the state
Solution: Add commands to clean up state introduced by the test
          (Illia Bobyr)

Before this change the following 4 tests were failing when executed
individually:

  Test_mksession_arglocal_localdir
  Test_mksession_buffer_count
  Test_mksession_one_buffer_two_windows
  Test_mksession_winminheight

As in
```
  TEST_FILTER=winminheight make test_mksession
```
Yet, when ran as part of the whole test suite they succeeded.

This was due to some state leaking from one test into another.

I think this is bad, as it can confuse someone making changes in the
relevant area.

`Test_mksession_winminheight` is actually still broken a bit, and
requires `winheight` and `winwidth` set at the beginning of the test,
rather than later, when it actually matters.  This exposes a subtle bug
in the session restore script.  I have a patch in a separate commit.

closes: vim/vim#20691

834b8d218f

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2026-07-04 08:47:05 +08:00
zeertzjq
d7b7922dcb vim-patch:partial:9.2.0579: :mksession, :mkview and :mkvimrc emit legacy Vim script
d69cf0dbcf

New tests only.

Co-authored-by: Miguel Barro <miguel.barro@live.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-04 08:45:47 +08:00
zeertzjq
b5fd22e771 vim-patch:9.2.0781: tests: Test_fuzzy_completion_bufname_fullpath() creates unnecessary dir (#40565)
Problem:  tests: Test_fuzzy_completion_bufname_fullpath() creates an
          unnecessary directory with the name of a file.
Solution: Only create the parent directory of the file (zeertzjq).

closes: vim/vim#20695

98efa50279
2026-07-03 23:17:49 +00:00
zeertzjq
008209d148 Merge pull request #40559 from zeertzjq/vim-9.2.0770
vim-patch:9.2.{0770,0771}
2026-07-03 15:47:02 +08:00
zeertzjq
b856d5080d vim-patch:9.2.0771: dict_add_list() has inconsistent ownership on failure
Problem:  dict_add_list() frees the passed list on failure path
          (when dict_add() fails) but not on the other (when
          dictitem_alloc() fails), so a caller cannot tell whether it
          still owns the list after a failure.
Solution: On failure leave the passed list untouched and owned by the
          caller; only take a reference on success.

related: vim/vim#20668

Supported by AI.

3ae1443d10

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-03 15:19:55 +08:00
zeertzjq
6f98352163 vim-patch:9.2.0770: dict_add_dict() has inconsistent ownership on failure
Problem:  dict_add_dict() frees the passed dict on one failure path
          (when dict_add() fails) but not on the other (when
          dictitem_alloc() fails), so a caller cannot tell whether it
          still owns the dict after a failure.  Callers that unref the
          dict on failure (e.g. in window.c) then double-free it when
          dict_add() fails.
Solution: Make the failure contract consistent: on failure leave the
          passed dict untouched and owned by the caller; only take a
          reference on success.

related: vim/vim#20668

Supported by AI.

12dbe788d4

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-03 15:18:30 +08:00
zeertzjq
87c2319986 vim-patch:9.2.0763: tests: style issue in test_plugin_netrw (#40543)
Problem:  tests: style issue in test_plugin_netrw (after v9.2.0761)
Solution: Clean-up newly created directory, use consistent concat
          operator

1ebd2fdb78

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-03 08:18:01 +08:00
Barrett Ruth
7325e3b55a fix(dir): define "-" (up/parent) mapping earlier #40531
Problem:
The dir.lua "-" mapping cannot be easily overridden (because of autocmd
ordering).

Solution:
- Move it to defaults.lua.
- Also to be extra polite: fall back to builtin `-` motion if the user
  disabled the `dir.lua` plugin.
2026-07-02 15:55:48 -04:00
nikolightsaber
3f8be434e1 docs: pos argument in vim.lsp.ListOpts should be optional #40550
Problem: the pos argument in ListOps for lsp is an optional parameter,
but the lua_ls typing system doesn't reflect that

Solution: let pos be optional

Co-authored-by: nikolightsaber <nikolightsaber@gmail.com>
2026-07-02 15:25:44 -04:00
Rawan Khalid
25d65d60b6 docs: WebAssembly build instructions #40541
Adds build instructions for the experimental WASM (`wasm32-emscripten`) target
under the Cross-compiling section of `BUILD.md`.
2026-07-02 13:07:53 -04:00
Evgeni Chasnovski
25d33dd12b fix(pack): do not assert non-nil stderr #40544
Problem: On some systems `stderr` can be disabled. This results in not
  usable `vim.pack` since it asserted `stderr` to be non-nil.

Solution: Stop asserting non-nil `stderr`. The downside is that
  potential errors are not shown, but this is intentional since `stderr`
  is disabled on system level.

  Still assert non-nil `stdout` as its output is important for
  `vim.pack` to actually do its job. Disabled `stdout` is not something
  that can work with `vim.pack`.
2026-07-02 12:12:35 -04:00
zeertzjq
f33364a41d Merge pull request #40542 from zeertzjq/vim-9.2.0392
vim-patch:9.2.{0392,0401,0426}
2026-07-02 21:25:35 +08:00
zeertzjq
3210315559 vim-patch:9.2.0426: tests: still some flaky screendump tests
Problem:  tests: still some flaky screendump tests
          (James McCoy)
Solution: Replace flaky VerifyScreenDump checks with assert_* assertions
          for Test_visual_block_scroll and Test_scrolloffpad_with_folds,
          and remove the now-unused dump files, mark those tests as
          flaky (which happened previously for screendump tests
          automatically) (Yasuhiro Matsumoto).

fixes:   vim/vim#20096
related: vim/vim#20095

cf5d7102b9

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-07-02 21:07:19 +08:00
zeertzjq
562b3fcb05 vim-patch:9.2.0401: tests: still a few flaky tests
Problem:  tests: still a few flaky tests
Solution: Add WaitForAssert to test_messages.vim, use a smaller terminal
          window for test_tabpanel, add TermWait() in test_messages
          to handle DECQRM messages.

closes: vim/vim#20074

0bc64b19a2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-02 21:07:03 +08:00
zeertzjq
b4901ae0b6 vim-patch:9.2.0392: tests: Some tests are flaky
Problem:  tests: Some tests are flaky and cause CI to fail
Solution: Add WaitForAsserts() calls to reduce flakiness

closes: vim/vim#20050

1940bcb243

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-02 21:06:47 +08:00
Jan Edmund Lazo
3255e0546f build(vim-patch): mark 'tabpanel' files as N/A #40538
https://github.com/neovim/neovim/issues/34273 was not reopened.
Unsure if this feature warrants C code based on current codebase
and ecosystem. Nvim avoided CVE because it hasn't ported this feature
both "autocmd_add()".

N/A C functions outside these files will be marked N/A if
https://github.com/neovim/neovim/pull/40473 is merged.
2026-07-02 06:56:23 -04:00
Christian Clason
3bb7887d5d build(deps): bump tree-sitter to 9fc2f486a 2026-07-02 10:53:08 +02:00
zeertzjq
e4e9eebbae vim-patch:partial:9.2.0762: duplicated sub-option name check in :set completion (#40535)
Problem:  The same sub-option name check appears ten times.
Solution: Extract the check into new completing_value_for_subopt()
          function (Shane Harper).

No functional change.

closes: vim/vim#20676

979602fd89

Co-authored-by: Shane Harper <shane@shaneharper.net>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 08:29:44 +08:00
zeertzjq
0d0772c937 vim-patch:d859e12: runtime(xml): Update xml syntax file
Improve performance

related: chrisbra/vim-xml-runtime#36

d859e128a8

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-Authored-by: Dmytro Meleshko <dmytro.meleshko@gmail.com>
2026-07-02 08:14:48 +08:00
zeertzjq
6f4ebdad80 vim-patch:a65741c: runtime(screen): Bring the syntax up to version 5
* Match command names introduced in v.5.0.0 (August 2024):
  "auth", "multiinput", "status", "truecolor".
* Match command names introduced in v.4.5.0 (January 2017):
  "defdynamictitle" and "dynamictitle".
* Deprecate command names that have been retired thus far:
  "debug", "maxwin", "nethack", "password", "time".
* Remove a spurious "defzombie" command name (this name is
  just lamented over in the documentation entry for the
  "zombie" command as being more fitting than "zombie"
  because its effects are not local to a window; no such
  name is entered in "comm.c").
* Separately group the Braille navigation commands, "bd_*",
  that may belong to another, superset program Dotscreen:
  (see doc/README.DOTSCREEN and commit 848af83f5 elsewhere).
* Revise string escape characters:
    - Recognise more characters, "%[`<>=eEfFHOPSxX]".
    - Recognise undocumented characters, "%[gNpT]", and list
      relevant Screen commits in the comments.
    - Match optional qualifiers, "%\%([-+L]\|\d\+\).".
* Match more items in double-quoted command arguments.
* Match unquoted environment variable references.
* Match octal numbers, e.g. "defmode 0622".
* Match escaped octal numbers, e.g. "bind \077 help".

Unless a Dotscreen program (c. 1995) or an older than
v.4.3.1 (c. 2015) Screen program, that was compiled with
"HAVE_BRAILLE" defined, is installed and needs configuring,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('dotscreenCommands')
    syn clear dotscreenCommands
endif
-----------------------------------------------------------

To BACKPORT the updated syntax file to version 4 of Screen,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('screenDeprecatedCommands')
    syn clear screenDeprecatedCommands
endif

if hlexists('screenVersion5Commands')
    syn clear screenVersion5Commands
endif
-----------------------------------------------------------

References:
https://lists.gnu.org/archive/html/info-gnu/2024-08/msg00004.html
https://lists.gnu.org/archive/html/info-gnu/2017-01/msg00007.html
https://git.savannah.gnu.org/git/screen.git

closes: vim/vim#20550

a65741c8b3

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
2026-07-02 08:14:48 +08:00
zeertzjq
567053bb3c vim-patch:dd89754: runtime(typst): Improve ftplugin, and syntax file
- Move whitespace formatting settings from the indent to the filetype
  plugin behind a "typst_recommended_style" config option.
- Set browsefilter
- Improve syntax file

Thanks to Maxim Kim for taking on maintainership of the typst runtime
files.

related: vim/vim#20036
closes:  vim/vim#20077

dd8975428b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Maxim Kim <habamax@gmail.com>
2026-07-02 08:14:48 +08:00
zeertzjq
6003545f38 vim-patch:9.2.0761: runtime(netrw): Unix: unable to open '\' file (#40533)
Problem:  runtime(netrw): Unix: unable to open '\' file
Solution: Adjust directory pattern (Manoj Panda)

closes: vim/vim#20685

86d8af37ba

Co-authored-by: Manoj Panda <manojpandawork@gmail.com>
2026-07-01 23:45:14 +00:00
zeertzjq
f8262a415a Merge pull request #40525 from zeertzjq/vim-9.2.0739
vim-patch:9.2.{0739,0748,0749,0750,0755,0759}: 'autocompletedelay' fixes
2026-07-02 04:12:54 +08:00
zeertzjq
a243486a46 vim-patch:9.2.0759: Some code for 'autocompletedelay' is no longer needed
Problem:  Some code for 'autocompletedelay' is no longer needed now that
          'autocompletedelay' doesn't block redraw (after 9.2.0739).
Solution: Remove unnecessary code. Also remove a duplicate screendump
          and an outdated comment in test (zeertzjq)

closes: vim/vim#20686

0b86b97cc9
2026-07-02 03:57:56 +08:00
zeertzjq
cef0dcd54e vim-patch:9.2.0755: 'autocomplete' behaves inconsistently when recording
Problem:  If 'autocompletedelay' is non-zero, 'autocomplete' doesn't
          work when recording a register (after 9.2.0750).
Solution: Still produce K_COMPLETE_DELAY when recording a register, and
          drop it in gotchars_add_byte() instead (zeertzjq).

This patch only changes the behavior when recording a register.
Replaying a register with 'autocomplete' still doesn't fully work
regardless of 'autocompletedelay', as 'autocomplete' isn't triggered
when there is pending input.

closes: vim/vim#20675

a658728918
2026-07-02 03:57:56 +08:00
zeertzjq
826ca0ccfe vim-patch:9.2.0750: completion: 'autocompletedelay' deferral leaks state
Problem:  After 'autocompletedelay' was made non-blocking, the deferred
          popup can misbehave: a pending autocomplete survives leaving
          Insert mode and then keeps waking the editor in Normal mode,
          the deferral is recorded into registers while recording a
          macro, the popup appears an extra 'updatetime' late when
          'autocompletedelay' is larger and a CursorHoldI autocommand
          exists, CursorHoldI can fire twice without an intervening
          keypress, and an open balloon is dismissed (after v9.2.0739)
Solution: Treat the deferral like CursorHold: only keep it pending in
          Insert mode and not while recording, with pending typeahead,
          or when completion is already active; drop it when Insert mode
          ends; measure the delay from when the user typed so a
          CursorHold in between does not push the popup back; and do not
          let the deferral re-enable CursorHoldI or dismiss the balloon.
          (Hirohito Higashi).

closes: vim/vim#20669

1f0f14bc2f

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 03:57:56 +08:00
zeertzjq
5f47d7ac08 vim-patch:9.2.0749: 'autocompletedelay' interferes with i_CTRL-K
Problem:  'autocompletedelay' interferes with i_CTRL-K (after 9.2.0739).
Solution: Clear the pending autocompltion from the previous key when a
          new key is typed.

closes: vim/vim#20666

0d292e2067
2026-07-02 03:57:56 +08:00
zeertzjq
f2af45127f vim-patch:9.2.0748: 'autocompletedelay' interferes with CTRL-G U
Problem:  'autocompletedelay' interferes with CTRL-G U (after 9.2.0739).
Solution: Restore the flag for CTRL-G U.

related: vim/vim#8937
related: vim/vim#20666

9fb5b5d876
2026-07-02 03:57:56 +08:00
zeertzjq
14f2a86cd6 vim-patch:9.2.0739: completion: 'autocompletedelay' blocks the main loop and drops autocommands
Problem:  With a non-zero 'autocompletedelay', Insert-mode autocommands
          (TextChangedI, TextChangedP, CursorMovedI) are delayed, and
          while typing faster than the delay they are dropped entirely,
          because the delay blocks the main loop.
Solution: Make 'autocompletedelay' non-blocking: instead of busy-waiting
          before showing the popup menu, defer it with an input-wait
          timeout (K_COMPLETE_DELAY) modeled on CursorHoldI, so typing
          stays responsive and the Insert-mode autocommands fire normally.

The delay timer coexists with 'updatetime': the main loop waits for the
sooner of the two and triggers the event whose deadline was reached, so
'autocompletedelay' no longer shadows CursorHold timing.  Changing the
completion leader, for example with Backspace, updates the visible popup
immediately like a zero delay; only the first popup is deferred.

Update the 'autocompletedelay' screendumps for the non-blocking display.
One test opened the menu with CTRL-N right after the delay expired and
could race with the deferred popup, so it now waits a little longer than
the delay before sending the key.

fixes:  vim/vim#20591
closes: vim/vim#20598

8ce43ea4e3

Also include some insexpand.c and ui.c changes from patch 9.2.0750.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 03:57:56 +08:00
bfredl
7a4186e1d5 Merge pull request #40306 from Rawan10101/wasm-stubs
build(wasm): add missing platform stubs
2026-07-01 20:57:02 +02:00
Barrett Ruth
daa229bfde fix(dir): restore loaded plugin guard #40528 2026-07-01 14:45:55 -04:00
Justin M. Keyes
12ea9735f7 refactor(path): path_skip_sep() #40524
Problem:
Redundant code.

Solution:
Add path_skip_sep() and use it.

Dropping MB_PTR_ADV is safe: the loops only advance while `*p` is
a one-byte separator (`/`, `\`, `:`). MB_PTR_ADV was needed in legacy
Vim because it supported non-UTF-8 (DBCS) *internal* encodings.
2026-07-01 09:48:54 -04:00
tao
fa9b3381bc feat(path): fnamemodify(':h') preserves logical root #40447
Problem:
On Windows, `fnamemodify('//foo/C$', ':h')` incorrectly removes `C$`
as a regular file name and returns `//foo`. However, this is a valid
UNC path, `foo` is a server name and `C$` is a share name.
The correct result should be `//foo/C$`.

Solution:
Extend `os_fileinfo2` and `FileInfo` with `prefix_off`, `rest_off` to
identify path types and logical root boundaries. ':h' can use this info
to prevent traversing past the logical root.

Examples:
  /foo               => /
  //foo              => // (POSIX)
  //foo/bar          => //foo (POSIX)
  //server/share/foo => //server/share/ (Windows)
  C:/foo             => C:/
  //?/C:/foo         => //?/C:/

Co-authored-by: Barrett Ruth <br@barrettruth.com>
2026-07-01 08:25:21 -04:00
Justin M. Keyes
05d7040425 Merge #40516 from justinmk/health 2026-07-01 07:45:47 -04:00
Justin M. Keyes
ed9a1c0b15 fix(health): handle failed dir listing 2026-07-01 13:27:07 +02:00
Justin M. Keyes
34efdadb4e feat(health): report ulimit info
Problem:
Nvim shows `(libuv) kqueue(): Too many open files` on macos.
ref https://github.com/neovim/neovim/issues/40238

Solution:
Add a healthcheck for this situation.
2026-07-01 13:26:21 +02:00
Justin M. Keyes
d253acca35 Merge #40114 feat(vim.fs): dir(), find() error-reporting 2026-07-01 07:18:08 -04:00
Justin M. Keyes
1035a9fb5d refactor(dir): use vim.fs.dir() 2026-07-01 13:01:02 +02:00
Justin M. Keyes
971a0a0fe0 feat(vim.fs): dir() ergonomics 2026-07-01 13:00:06 +02:00
Justin M. Keyes
f141916e3d fix(vim.fs): dir(), find() error-reporting 2026-07-01 12:05:41 +02:00
Rudrajeet Pal
4e04dff228 feat(vim.fs): dir(), find() error-reporting
Problem:
vim.fs.dir() and vim.fs.find() drop errors returned by uv.fs_scandir().

Solution:
- vim.fs.dir():
  - Return root scan failures as a secondary return value.
  - Propagate recursive scan failures through the iterator. This allows
    callers to distinguish unreadable directories from empty ones.

- vim.fs.find(): Collect errors during search, and return the list as
  a second retval.
2026-07-01 12:05:41 +02:00
zeertzjq
0d81f257af Merge pull request #40523 from zeertzjq/vim-9.1.1540
vim-patch:9.1.{1540,1542}
2026-07-01 17:50:33 +08:00
zeertzjq
3fd0ed3176 vim-patch:9.1.1542: Coverity complains about uninitialized variable
Problem:  Coverity complains about uninitialized variable
          (Tony Mechelynck)
Solution: Initialize variables

closes: vim/vim#17717

6865bdc914

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-01 17:32:08 +08:00