Problem:
emmylua reports `unresolved-require` for `require('test.testutil')` and
friends, and a file under `test/` cannot even resolve its own siblings.
This happens because `test/.emmyrc.json` and `test/.luarc.json`, cause
vim.lsp to root the workspace at `test/` instead of the repo top-level.
Solution:
Drop the nested configs:
src/.luarc.json
test/.luarc.json
test/.emmyrc.json
Outcomes:
- No "libraries" needed: luv types come from `runtime/lua/uv/_meta.lua`,
not `${3rd}/luv` (which would only duplicate them).
- Drop `test/` from the root `.luarc.json` `ignoreDir` so its modules are
resolvable by LuaLS/Emmylua.
- Note: this means that LuaLS diagnostics will now be reported for
`test/`, but that is not a bad thing...
Problem:
When 'shellslash' is set, exepath() returns forward-slashed paths.
Passing that path to vim.system() can prevent cmd.exe from launching.
Solution:
Convert the resolved executable path to native separators before spawning.
Add a Windows regression test for cmd.exe with 'shellslash' enabled.
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.
- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
"know" about the various magic symbols.
So they harm DX, which means they serve no purpose at all.
Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
`t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
Problem: Deeply nested regexp groups can cause uncontrolled recursion
in the regexp compiler and exhaust the C stack.
Solution: Limit recursive regexp parsing depth in both the backtracking
and NFA compilers (lipengyu)
closes: vim/vim#20731a79cd6bfc3
Co-authored-by: lipengyu <lipengyu@kylinos.cn>
Problem: :argdelete with pattern leads to wrong argidx().
Solution: Correct argidx() in both branches of ex_argdelete(). Also use
ARGCOUNT macro in two more places (zeertzjq).
related: patch 7.4.1119
related: neovim/neovim#40564
closes: vim/vim#206973b40a14a46
Problem:
The existing `showmode` overlay can immediately cover messages emitted while
Visual mode is active, including the `g CTRL-G` word count.
Solution:
Protect Visual mode messages with the existing message delay and temporarily
hide the previous last-line overlay until it is restored.
Problem:
The title is combined with window's attributes only if the title is a
string (which implies the FloatTitle / FloatFooter highlight groups),
but not when the title is text-hl chunks.
Solution:
Combine specified highlight group with window-local Normal highlight as
well.
Problem:
FAILED …/cursorhold_spec.lua @ 73: CursorHold is not triggered after only K_EVENT on startup
Expected values to be equal.
Expected:
1
Actual:
0
stack traceback:
…/cursorhold_spec.lua:79: in function <…/cursorhold_spec.lua:73>
Solution:
Retry instead of hardcoding sleep(50).
Problem:
LSP hover erroneously drops blank lines before a 4-space-indented
codeblock, which is not valid Markdown. This causes incorrect parsing
and wrong display.
Solution:
Fix `split_lines` so that it doesn't drop the blank line just before
a 4-space-indented codeblock.
fix https://github.com/neovim/neovim/issues/40860
Problem:
A floating preview window (hover, signature help) converted to a normal
window (e.g. with CTRL-W_H or nvim_win_set_config()) is still closed by
the open_floating_preview() autocommands, and a later preview may focus
or close it as if it were still a float.
Solution:
When the preview window is no longer floating, remove its auto-close
autocommands and stop tracking it as the buffer's floating preview.
Closes#36659
Problem: ml_get error when changing hidden buffer in Python.
Solution: Block updating folds. (closesvim/vim#7598)
----
"ctx_switch()", "ctx_restore()" obsolete "switch_buffer()" and
"restore_buffer()".
Latter are unused since https://github.com/neovim/neovim/pull/15831.
Mark them as N/A (until some test fails).
----
3e0107ea16
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problems:
On Windows, `:w somedir` (where somedir is an existing directory
in pwd) shows the misleading `E13: File exists (add ! to override)`
instead of `E17: "somedir" is a directory`.
Solution:
drop unnecessary `#ifdef` guard.
Problem: when PR #40621 removed a 50 cell restriction to item group
minwid, a possible integer overflow was introduced when the added
padding is multiplied with the number of fillchar bytes.
Solution: when there is not enough buffer capacity left, reduce the
number of added fillchars before calculating the number of added bytes.
Problem:
Mysterious Windows CI failure points to resource exhaustion, but we have
no visibility/instrumentation:
RUN T610 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <S-Left>: 93.70 ms OK
RUN T611 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <F12><F2><Tab>: 49.48 ms FAIL
…\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed.
stack traceback:
D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap'
…/api/keymap_spec.lua:769: in function <…/api/keymap_spec.lua:768>
RUN T612 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <Space><Tab>: 18.49 ms FAIL
…\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed.
stack traceback:
D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap'
…/api/keymap_spec.lua:769: in function <.../build/Xtest_xdg_api/test/functional/api/keymap_spec.lua:768>
Solution:
Append the child exit-code and signal to the "EOF … crashed" message.
Example:
Nvim EOF (crash?) exit code: 42 (0x0000002A)
On the next failing Windows run, the first crash line will classify the failure:
- 0xC0000005 → access violation (nvim bug)
- 0xC0000374 → heap corruption (nvim bug)
- spawn/resource error or "clean" exit-code → system resource exhaustion
Problem:
nvim_create_autocmd() isn't |api-fast|, so modules that create autocmds
(e.g. vim.treesitter.query) can't be require()d in a fast event context.
Solution:
Mark it |api-fast|. Compile autocmd patterns with RE_NOBREAK so
aucmd_next() won't os_breakcheck() mid-iteration, where a fast
nvim_create_autocmd() could realloc the autocmds vector and dangle the
caller's AutoPat/AutoCmd.
RE_NOBREAK is low-risk because:
- aucmd_next()'s loop checks CTRL-C: `(for (… i < apc->ausize && !got_int; …)`.
- `line_breakcheck()` (`autocmd.c:1912`) runs once per matched autocmd.
- Each autocmd _execution_ runs through `do_cmdline`, which has its own
breakchecks.
However this does admit risk of a pathological case:
a catastrophic-backtracking glob matched against a very long `User`
event-pattern.
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem:
Float border highlight groups (FloatBorder, FloatTitle and FloatFooter)
fall back to Normal background highlight if no background color set.
Solution:
Combine border colors with window-local Normal highlight.
Fix#38330
Problems:
1. Can't get individual parts of a key-chord separately: modifiers, key.
2. Can't separate a key-combo into individual key-chords.
Solution:
Enhance `vim.keycode()` to optionally return a structured parse result
as a list of key-chords:
- `key_raw` the key-chord (problem 2)
- `mod` the modifiers of `key_raw` (problem 1)
- `key_orig` the key part of the key-chord, only here if differing from `key`
(this doesn't solve any of the above mentioned problems, but it may provide
useful and it's (in terms of code) free)
- `key` a normalized version of `key_orig` (solving problem 1), example(the
first is `key_orig` and second is `key`): `lt` and `<`, `Bar` and `|` (in
`<C-Bar>`)
Problem: Visual block reselection wrong with 'virtualedit' when line
lengths are different (Alex Yang, after 8.2.3494).
Solution: Set the entire cursor position to old position when computing
target curswant, since the check_cursor() added in 8.2.3494
may change cursor column as well (zeertzjq).
fixes: vim/vim#20746closes: vim/vim#207488cddbfe468
Problem: extend() and extendnew() don't handle NULL expr2 properly
(Mao-Yining)
Solution: Still set the return value when expr2 is NULL (zeertzjq).
fixes: vim/vim#20758closes: vim/vim#20759e397c82a04
Problem: filetype: hip files are not recognized
Solution: Detect *.hip files as hip filetype, include filetype, syntax
and indent plugins, update makemenu.vim and synmenu.vim (Young)
Round out HIP (Heterogeneous-compute Interface for Portability) support
to mirror the existing CUDA files:
- autoload/dist/ft.vim: detect the ".hip" extension as filetype "hip"
- ftplugin/hip.vim: behave like C++ by sourcing ftplugin/cpp.vim
- indent/hip.vim: use cindent, like indent/cuda.vim
- makemenu.vim / synmenu.vim: add a Syntax menu entry
The syntax/hip.vim file already sources syntax/cpp.vim and adds the
HIP-specific keywords, matching syntax/cuda.vim.
closes: vim/vim#20773b3ad239038
Co-authored-by: Young <young20050727@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Problem:
FAILED …/put_spec.lua:894: …/put_spec.lua @ 898: put command . register special tests should ring the bell when deleting if not appropriate
…/put_spec.lua:894: …/put_spec.lua:898: Bell was not rung after action
Snapshot:
screen:expect([[
^ine of words 1 |
Line of words 2 |
{1:~ }|*4
{3:[No Name] [+] }|
|
{1:~ }|*4
{UNKNOWN_HL_ID(4):[No Name] }|
{UNKNOWN_HL_ID(1): }|
]])
stack traceback:
…/ui/screen.lua:917: in function '_wait'
…/ui/screen.lua:540: in function 'expect'
…/editor/put_spec.lua:894: in function 'bell_test'
…/editor/put_spec.lua:940: in function <…/editor/put_spec.lua:932>
Analysis:
The bell was asserted via the UI 'bell' event (screen.bell), but
vim_beep() rate-limits that to 3 per 500ms. These tests share one
long-lived session, so beeps from earlier tests could exhaust the window
and drop the asserted beep.
Solution:
Use assert_beeps()/assert_nobeep(), which check called_vim_beep (set
before the rate-limit gate).
Problem:
Sampling a transient busy=1 pulse is racy under load.
Solution:
Set a long debounce, assert the stable state, then use a short debounce
to let the reload clear it.
Problem: values from completionList.itemDefaults always replace the
item's own commitCharacters and data. Since 3.18 a server can ask for
them to be merged instead.
Solution: Handle CompletionList.applyKind and advertise applyKindSupport.
Drop itemDefaults once folded into the items: get_items() runs twice on
the same result and a Merge isn't idempotent.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#completionItemApplyKinds
Problem: Test_spelldump_prefixtree_overflow() resets 'runtimepath' to
defaults, which can expose personal spell files to later tests
(Jun-ichi Takimoto, after v9.2.0662)
Solution: Save and restore the test runner's 'runtimepath' value (coyaSONG).
fixes: vim/vim#20765closes: vim/vim#20766f16e30e19d
Co-authored-by: coyaSONG <66289470+coyaSONG@users.noreply.github.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Problem:
`nvim__ui_detach` was added in 85e0559d46 in order to implement
`detach_others` from Lua. Using Lua in this case is doing more harm than
good.
Solution:
Extract `ui_detach_channel`, which also allows it to be used for the
"self detach" path from `ex_detach`.
Bonus: the old MSWIN path always called `os_swap_to_hidden_console()`;
now `ui_detach_channel` only does so for a stdio channel. For the common
stdio TUI this is identical; for a socket UI it's more correct (no
parent console to swap).
Problem:
Expanding an unknown ~user path falls back to the shell. In a fast event,
this re-enters the event loop and aborts Nvim.
Solution:
Leave unknown users unexpanded when the system account lookup fails.
Problem:
Third-party directory browsers do not have a documented way to take over local
directory buffers from nvim.dir.
Solution:
Document deleting the nvim.dir augroup and handling FileType directory as the
after-startup handoff, and avoid installing the built-in buffer-local "-" mapping
when "-" is already mapped.