feat(api): rename buffer to buf
Problem:
`:help dev-name-common` states that "buf" should be used instead of
"buffer" but there are cases where buffer is mentioned in the lua API.
Solution:
- Rename occurrences of "buffer" to "buf" for consistency with the
documentation.
- Support (but deprecate) "buffer" for backwards compatibility.
Co-authored-by: Jordan <46637683+JordanllHarper@users.noreply.github.com>
Problem: nvim_exec_autocmds() documentation incorrectly describes the default
for "pattern" as *, when it's actually the current file name (like :doautocmd).
Solution: correct it. Add a test.
Problem:
Since 2f6d1d3c88, `apply_text_edits`
unconditionally sets `buflisted=true`, causing spurious BufDelete events
if plugins restore the original 'buflisted' state on unlisted buffers:
65ef6cec1c/src/nvim/option.c (L2159-L2169)
Solution:
- Don't set 'buflisted' in `apply_text_edits`. Set it more narrowly, in
`apply_workspace_edit` where the semantics requires affected buffers
to be visible to the user.
- Also skip setting 'buflisted' if it would not be changed, to avoid
redundant `OptionSet` events.
(cherry picked from commit 6473d007e7)
Problem: vim.VersionRange had no __eq metamethod, so comparing 2 distinct
but same value instances always returned false. In vim.pack.add this caused
redundant lockfile rewrites, even when the resulting lockfile content was
unchanged.
Solution: Add __eq metamethod on vim.VersionRange
fix(health): misleading warnings re filetypes registered w/ vim.filetype.add() #38867
Problem:
`:checkhealth vim.lsp` validates configured filetypes against
`getcompletion('', 'filetype')`. This only reflects runtime support
files.
This causes false warnings in `:checkhealth vim.lsp` for configured
filetypes that are known to the Lua filetype registry, including
values added with `vim.filetype.add()` and built-in registry-only
filetypes.
Solution:
Build the healthcheck's known-filetype set from both
`getcompletion('', 'filetype')` and `vim.filetype.inspect()`.
(cherry picked from commit 20a3254ad4)
Co-authored-by: Barrett Ruth <62671086+barrettruth@users.noreply.github.com>
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)
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)
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)
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)
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.
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.
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)
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)
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)
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)
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)
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)
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)
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)
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#19847closes: vim/vim#1984912f6f20552
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
(cherry picked from commit 3cb79189f3)
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)
* vim-patch:e551e71: runtime(tera): use fnameescape() when loading separate syntax files
e551e71d7e
Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit ec1bea9c05)
* vim-patch:374f06f: runtime(racket): Use shellescape() to harden the K mapping
fyi: @benknoble
374f06ffd8
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Michał Majchrowicz <mmajchrowicz@afine.com>
(cherry picked from commit d29db48e0a)
---------
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Michał Majchrowicz <mmajchrowicz@afine.com>
fix(ui2): flicker when entering pager from expanded cmdline #38639
Problem: 'showcmd' causes flickering when pressing "g<" to enter the
pager when the cmdline is expanded for messages.
Initial keypress for an incomplete mapping is not giving 'showcmd'
feedback while cmdline is expanded for messages (which is only
dismissed upon the vim.on_key callback after 'timeoutlen').
Solution: Delay dismissing expanded cmdline when vim.on_key() callback
receives "g".
Place 'showcmd' "last" virtual text during expanded cmdline.
(cherry picked from commit 75e5e37942)
Co-authored-by: luukvbaal <luukvbaal@gmail.com>
Problem: Cmdline is not redrawn after an empty message clears it.
Remembered last drawn cursor position may be outdated but
equal to the current cmdline content with UI2.
Solution: Ensure cmdline is redrawn after an empty message clears it.
Compare wanted cursor position with actual cursor position.
(cherry picked from commit 1685ced335)
Problem: `vim._core.ui2.enable` requires passing an empty table for
default options, unlike other (native) Lua API.
Solution: Initialize `opts` with empty table if `nil` is passed.
(cherry picked from commit e508aa0fa8)
Problem: Mixing "buf" and "M.bufs.msg" in M.msg:start_timer().
Cannot run `require("vim._core.ui2").enable(nil)`.
Solution: Replace "M.bufs.msg" with "buf". Allow `opts == nil`.
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
(cherry picked from commit f50e7d8205)
Problem:
The snippet preview is not being highlighted by treesitter for
completion items from servers which don't support
`completionItem/resolve` (like gopls). This was broken by #38428.
Solution:
Call `update_popup_window` after updating the completion item with the
snippet preview.
I've added assertions to the `selecting an item triggers
completionItem/resolve + (snippet) preview` test case which covers the
snippet preview being shown since no tests failed when I removed the
`nvim__complete_set` call which actually populates the preview on this
codepath.