Commit Graph

7434 Commits

Author SHA1 Message Date
Justin M. Keyes
31dfecb458 docs: misc, editorconfig
fix https://github.com/neovim/neovim/issues/36858
2025-12-15 13:55:15 -05:00
Tristan Knight
8165427b4d fix(lsp): correct capability checks for dynamic registration (#36932)
Refactor capability checks in Client:_supports_registration and
Client:supports_method to properly handle dynamicRegistration and unknown
methods. Now, dynamic capabilities are checked before assuming support for
unknown methods, ensuring more accurate LSP feature detection.
2025-12-15 13:23:57 -05:00
glepnir
e265cc28f9 refactor(test): deprecates functions in some tests #36972
Problem: feed_command, nvim_buf_set_option, nvim_buf_get_number, and exc_exec
are marked as deprecated.

Solution: Remove them from the test units in api/buffer_spec, autocmd/focus_spec,
ui/input_spec, and editor/put_spec.

Some test units only used a few deprecated functions, so creating a separate PR
for each would be excessive. Therefore, several were combined into a single PR.
2025-12-15 10:58:24 -05:00
glepnir
df849f6541 refactor(test): use command, pcall_err in num_options_spec #36933
Problem: feed_command is marked as deprecated, and validating error messages
is a bit verbose.

Solution: use command and pcall_err with matches
2025-12-15 02:13:58 -05:00
glepnir
86a4588d4a test: remove feed_command in undo_spec #36953
Problem: feed_command is marked as deprecated.

Solution: replace it with command and pcall_err.
2025-12-15 02:11:23 -05:00
Riley Bruins
976a47e81b Revert "refactor(treesitter): use scratch buffer for string parser" #36964
This reverts commit 2a7cb32959.
2025-12-15 02:09:36 -05:00
zeertzjq
2700f6642a fix(buffer): switching buffer should respect jumpoptions+=view (#36969)
Also add missing change to buflist_findfmark() from #19224.
2025-12-15 14:45:11 +08:00
Jaehwang Jung
63737e6e73 fix(treesitter): no injection highlighting on last line #36951
Problem:
If the last visible line in a window is not fully displayed, this line
may not get injection highlighting. This happens because line('w$')
actually means the last *completely displayed* line.

Solution:
Use line('w$') + 1 for the botline.

This reverts 4244a96774
"test: fix failing lsp/utils_spec #36609",
which changed the test based on the wrong behavior.
2025-12-14 19:01:49 -05:00
zeertzjq
592582ba48 fix(input): don't exit on EOF when peeking for input with -es (#36948)
Only exit on EOF when doing a blocking wait for input.
2025-12-15 08:00:40 +08:00
zeertzjq
18642a63be vim-patch:9.1.1969: Wrong cursor position after formatting with long 'formatprg' (#36918)
Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

50325c3d59
2025-12-12 08:07:55 +08:00
skewb1k
b87bdef2a8 fix(lua): relax vim.wait() timeout validation #36900
Problem:
After bc0635a9fc `vim.wait()` rejects floats
and NaN values.

Solution:
Restore the prior behavior, while still supporting `math.huge`. Update
tests to cover float case.
2025-12-10 09:44:05 -05:00
CompileAndConquer
aeebc51851 fix(grid): assert crash during extreme resize layouts #36847
Problem:
When the terminal shrinks, Neovim tries to recompute the layout and
adjust every window so that the total width matches the new Columns. But
in the scenario of numerous windows split horizontally, there is
not enough space for all of them. The frame width (topframe->fr_width) never
reaches the new Columns value, the logic tries to redistribute this negative
space across child frames, but it triggers the assert.

Solution:
Skip this case in `win_update`.
2025-12-10 00:32:51 -05:00
glepnir
625c59fe5f fix(highlight): Normal-linked groups shouldn't override CursorLine #35026
Problem: CursorLine doesn't consistently highlight text using groups
linked to Normal (e.g., in quickfix, passwd files), while it works
for direct Normal usage.

Solution: Don't let normal background from linked groups override
explicit non-normal backgrounds during attribute combination.
2025-12-09 23:01:27 -05:00
zeertzjq
df9e4a037a fix(eval): 0 should mean current tabpage in gettabvar() (#36891)
This matches the gettabvar() behavior change in Vim 8.1.1218.
2025-12-10 00:53:57 +00:00
skewb1k
bc0635a9fc fix(lua): vim.wait(math.huge) fails #36885
Problem:
`nlua_wait()` uses `luaL_checkinteger()` which doesn't support
`math.huge` since it's double type. On PUC Lua this fails with
'number has no integer representation' error and on LuaJIT this
overflows int.

Solution:
Use `luaL_checknumber()` and handle `math.huge`.
2025-12-09 13:59:06 -05:00
skewb1k
3b6e8e484e fix(float): prevent truncation of title that fits exactly #36880
Problem:
The `over_flow` parameter in `grid_draw_bordertext` always added 1 for
the '<' character. As a result, titles that fit exactly were still
truncated with an unnecessary '<'.

Solution:
Adjust `over_flow` only when the actual overflow is greater than 0.

Fix #36872
2025-12-09 13:37:32 -05:00
zeertzjq
747cf30c37 vim-patch:9.1.1965: q can accidentally start recording at more prompt (#36879)
Problem:  When exiting at the end of the more prompt (at the hit enter
          prompt) by hitting q the recording mode will be started.
          (Jakub Łuczyński)
Solution: Don't add the q key to the typeahead buffer
          in the function wait_return (Bjoern Foersterling)

fixes: vim/vim#2589
closes: vim/vim#18889

ecce3497fa

Co-authored-by: Bjoern Foersterling <bjoern.foersterling@gmail.com>
2025-12-09 22:25:47 +08:00
zeertzjq
5235f3663f vim-patch:9.1.1964: Wrong display when using setline() at hit-enter prompt (#36878)
Problem:  Wrong display when using setline() at hit-enter prompt
          (after 8.2.3204).
Solution: Only skip scrolling for changed lines in top area if it's
          scrolled down due to w_topline change. Also add more testing
          for what 8.2.3204 fixed (zeertzjq).

closes: vim/vim#18887

e72eacceab
2025-12-09 22:25:34 +08:00
Mathias Fußenegger
c5d4050586 Revert "feat(lsp): support version in textDocument/publishDiagnostics #36754" (#36865)
This reverts commit 03d6cf7aae.

See https://github.com/neovim/neovim/pull/36754#issuecomment-3626115697
The change was supposed to avoid showing stale diagnostics but had the
opposite effect.
2025-12-09 13:29:21 +01:00
Justin M. Keyes
3afe0c6740 Merge #36859 refactor: clint.py => clint.lua 2025-12-08 01:58:58 -05:00
glepnir
cb171ee7cb fix(float): tail truncate long title #28387
Problem:
We truncate the title from start, this is somewhat inconsistent
with the way vim works. Usually we use < to truncate and keep
more trailing characters.

Solution:
Keep more trailing characters.
2025-12-08 01:52:07 -05:00
Justin M. Keyes
0bb5bc5557 refactor: clint.py => clint.lua
Problem:
`clint.py` is the last python in our codebase, and beyond that it needs
some cleanup. And it lacks tests, so modifying it can be painful.

Also, we need a way to add ad-hoc lint rules for *Lua*, so it will help
to have our ad-hoc rules for C in the same language (the scripts may
share functions/techniques): https://github.com/neovim/neovim/issues/28372

Solution:
- convert to `clint.lua` (mostly AI-generated, but it now has test
  coverage, unlike `clint.py`)
- drop rules that are no longer needed:
  - "readability/multiline_string"
    - technially still relevant, but very uncommon so doesn't really matter.
  - "--line-length"
    - Not used in the old clint.py, nor the new clint.lua.
  - "comment whitespace" check
    - It is enforced by uncrustify.
  - "TODO" check
    - The `-google-readability-function-size` clang-tidy rule enforces
      "TODO(user)" format. (It was already enabled long ago.)
2025-12-08 01:43:02 -05:00
zeertzjq
647f11e6ae vim-patch:9.1.1958: Wrong display with sign_unplace() and setline() in CursorMoved (#36851)
Problem:  Wrong display when scrolling with 'scrolloff' and calling
          sign_unplace() and setline() in CursorMoved (after 8.2.3204).
Solution: Still scroll for changed lines below the top area when the top
          is scrolled down (zeertzjq)

closes: vim/vim#18878

2da433cff7
2025-12-08 09:24:26 +08:00
Nathan Smith
551bb63d44 feat(events): MarkSet event, aucmd_defer() #35793
Problem:
- Can't subscribe to "mark" events.
- Executing events is risky because they can't be deferred.

Solution:
- Introduce `MarkSet` event.
- Introduce `aucmd_defer()`.

Helped-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-12-07 15:13:31 -05:00
Justin M. Keyes
ebb7c38ca2 docs: misc
fix https://github.com/neovim/neovim.github.io/issues/419

Co-authored-by: Rob Pilling <robpilling@gmail.com>
2025-12-06 20:33:02 -05:00
Tristan Knight
0f3e3c87b7 feat(lsp): support dynamic registration for diagnostics (#36841) 2025-12-06 15:55:07 -08:00
Olivia Kinnear
4e1644d4d3 feat(spell): opt-out of confirm when downloading spellfiles #36836 2025-12-06 17:20:02 -05:00
zeertzjq
5370b7a2e0 vim-patch:partial:9.1.1955: sort() does not handle large numbers correctly (#36840)
Problem:  sort() does not handle large numbers correctly
          (Igbanam Ogbuluijah)
Solution: Don't truncate the return value of tv_get_number_chk()
          (Yegappan Lakshmanan)

closes: vim/vim#18868

04794efe12

Use a Lua test for now, as the Vimscript test uses tuples.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-12-06 21:49:16 +08:00
Justin M. Keyes
d6bee7e407 test: skip noisy "terminal mode unavailable" logs #36794
Problem:
Every CI log has a lot of noise at the end, which makes it harder to
find relevant test failures:

    Running tests from test/functional/terminal/tui_spec.lua
    ...
    T5831 TUI bg color queries the terminal for background color:
    T5832 TUI bg color triggers OptionSet from automatic background processing:
    T5833 TUI bg color sends theme update notifications when background changes #31652:
    ...
    Running tests from test/functional/ui/output_spec.lua
    ...
    WRN 2025-12-02T03:36:47.304 ui/c/T5831.28003.0 tui_handle_term_mode:223: TUI: terminal mode 2026 unavailable, state 0
    WRN 2025-12-02T03:36:47.359 ui/c/T5832.28006.0 tui_handle_term_mode:223: TUI: terminal mode 2048 unavailable, state 0
    WRN 2025-12-02T03:36:47.414 ui/c/T5833.28009.0 tui_handle_term_mode:223: TUI: terminal mode 2048 unavailable, state 0

Solution:
- Skip logging in test-mode.
    - This can be reverted later, when these logs are changed to "INFO"
      level, per this TODO comment:
      ```
      // TODO(bfredl): This is really ILOG but we want it in all builds.
      // add to show_verbose_terminfo() without being too racy ????
      WLOG("TUI: terminal mode %d unavailable, state %d", mode, state);
      ```
2025-12-05 16:04:24 -05:00
Pig Fang
6aa80b1ab2 refactor(lsp): fix lint 2025-12-05 15:51:46 +00:00
Pig Fang
b9eba5cde2 test(lsp): accept callback for diagnostic 2025-12-05 15:51:46 +00:00
Pig Fang
03f944b0fe refactor(lsp): fix lint 2025-12-05 15:51:46 +00:00
Pig Fang
016335a7d0 feat(lsp): support refreshing workspace diagnostics 2025-12-05 15:51:46 +00:00
Pig Fang
a7c21f4b17 test(lsp): polish tests of refreshing diagnostics 2025-12-05 15:51:46 +00:00
Pig Fang
bcb110482b test(lsp): update test name 2025-12-05 15:51:46 +00:00
Pig Fang
02067a9892 feat(lsp): support diagnostic refresh request 2025-12-05 15:51:46 +00:00
zeertzjq
a8a0bba2f8 fix(ui): close outdated cmdline pum on redraw (#36815) 2025-12-05 00:23:22 +00:00
zeertzjq
bfe007a187 vim-patch:9.1.1948: Windows: Vim adds current directory to search path
Problem:  Windows: Vim always adds the current directory to search path.
          This should only happen when using cmd.exe as 'shell'. For
          example, powershell won't run binaries from the current
          directory.
Solution: Only add current directory to system path, when using cmd.exe
          as 'shell'.

related: vim/vim#10341
related: 083ec6d9a3b7

4d87c9742a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-04 11:54:27 +08:00
Justin M. Keyes
2bbc90f4d5 Merge #36585 feat: has() can check multiple Vim versions 2025-12-03 00:28:53 -05:00
Justin M. Keyes
65141153d9 Merge #36792 unreliable tests 2025-12-02 01:06:40 -05:00
Justin M. Keyes
ebd758f809 test: unreliable "channel opened, ..., deleted by pressing a key"
Problem:
Test sometimes fails on macos:

    test/functional/terminal/channel_spec.lua:96: Expected objects to be the same.
    Passed in:
    (number) 3
    Expected:
    (number) 2

Solution:
Retry a few times.
2025-12-02 00:14:09 -05:00
Justin M. Keyes
c8f2b10a40 test: unreliable "job exit event on jobstart(…,{term=true})"
Problem:
Test often fails in cirrus (bsd) ci:

    FAILED   test/functional/terminal/channel_spec.lua @ 149: no crash when TermOpen autocommand processes job exit event when using jobstart(…,{term=true})
    test/functional/terminal/channel_spec.lua:158: Row 1 did not match.
    Expected:
      |*^ready $ foobar                                              |
      |*                                                            |
      |*[Process exited 0]                                          |
      |                                                            |
    Actual:
      |*^ready $                                                     |
      |*[Process exited 0]                                          |
      |*                                                            |
      |                                                            |

Solution:
Use one printf call instead of multiple.
2025-12-02 00:08:38 -05:00
benarcher2691
ad438b6b14 fix(ui): exclude hidden windows from tabline window count #36779
Problem: When `vim._extui` is enabled, the default tabline shows an
incorrect window count (e.g., "2" when only 1 window is visible). This
happens because the extui pager window has `focusable=true` (needed for
user interaction) but `hide=true` (not visible by default).

Solution: Modify the window counting logic in `statusline.c` and
`ex_docmd.c:ex_tabs()` to also exclude hidden windows
(`wp->w_config.hide`), not just non-focusable windows.

Also updates test expectations in `cmdline2_spec.lua` which previously
expected the incorrect window count "2" when extui was enabled. The test
now correctly expects no window count indicator when only 1 visible
window exists.

Fixes #36759
2025-12-01 23:57:56 -05:00
zeertzjq
b64e36cef0 vim-patch:9.1.1943: Memory leak with :breakadd expr
Problem:  Memory leak with :breakadd expr
Solution: Free debug_oldval and debug_newval before assigning to them.
          Verify the existing (though confusing) :breakadd expr behavior
          (zeertzjq).

It seems that :breakadd expr doesn't work as documented at all. This PR
only fixes the memory leak. The tests are for the existing behavior.

closes: vim/vim#18844

a474de64df
2025-12-02 07:24:28 +08:00
benarcher2691
7f2d5d6883 fix(msgpack): use fixstr encoding for strings of length 20-31 #36737
Problem:
MessagePack fixstr format supports string lengths 0-31, but mpack_str()
only used fixstr for lengths < 20. Strings of 20-31 bytes were
incorrectly encoded as str8 (2-byte header) instead of fixstr (1-byte
header).

Solution:
Change the condition from `len < 20` to `len < 32` to match the
MessagePack specification.

This fix affects message timing which exposed a pre-existing race
condition in the channels_spec PTY test. The test now uses a helper
function to accumulate partial PTY reads, making it more robust.

Fixes #32784
2025-12-01 13:16:44 -05:00
Jan Edmund Lazo
5196162540 feat(version): support multiple Vim versions
Group up to 15 vimpatch numbers in 1 line to guard against
'make formatc'.
1-liner for vim_versions, num_patches.

Automate '*Version' to remove version.h macros.

'-V1 -v' lists merged Vim versions.
2025-12-01 02:34:51 -05:00
Tristan Knight
23ddb2028b feat(lsp): semanticTokens/range #36705
Problem:
Nvim supports `textDocument/semanticTokens/full` and `…/full/delta`
already, but most servers don't support `…/full/delta` and Nvim will try
to request and process full semantic tokens response on every buffer
change. Even though the request is debounced, there is noticeable lag if
the token response is large (in a big file).

Solution:
Support `textDocument/semanticTokens/range`, which requests semantic
tokens for visible screen only.
2025-11-30 21:06:56 -05:00
CompileAndConquer
f9ef1a4cab fix(buffer): defer w_buffer clearing to prevent dict watcher crash #36748 2025-11-30 20:56:53 -05:00
zeertzjq
14d65dae91 fix(buffer): don't allow changedtick watcher to delete buffer (#36764) 2025-12-01 09:14:14 +08:00
Olivia Kinnear
12d4c624bb feat(ex_cmds): consistent :restart behavior (#36723) 2025-11-30 02:14:28 -08:00