Commit Graph

33899 Commits

Author SHA1 Message Date
bfredl
f9d2115a35 perf(highlight): allow decoration providers to skip ranges without data
Continuing the work of #31400

That PR allowed the provider to be invoked multiple times per line.
We want only to do that when there actually is more data later on the
line. Additionally, we want to skip over lines which contain no new
highlight items. The TS query cursor already tells us what the next
position with more data is, so there is no need to reinvoke the range
callback before that.

NB: this removes the double buffering introduced in #32619 which
is funtamentally incompatible with this (nvim core is supposed to keep
track of long ranges by itself, without requiring a callback reinvoke
blitz). Need to adjust the priorities some other way to fix the same issue.
2025-09-09 12:54:04 +02:00
zeertzjq
d15936f6ef Merge pull request #35693 from zeertzjq/vim-6bb16d2
vim-patch: Python syntax updates
2025-09-09 12:40:12 +08:00
zeertzjq
12868474db vim-patch:77cfc49: runtime(python): highlight ellipsis literals
The ellipsis literal (`...`) can be used in multiple contexts:

- Placeholders:     `class Foo: ...`
- Containers:       `Tuple[int, ...]`
- Assignments:      `x = ...`

This is a trickier pattern to match because we can't rely on keyword
boundaries, so we instead look for exactly three dots (`...`).

This does mean that we will match the `...` portion of `x...x`, which
isn't valid Python syntax, but I think that's an acceptable trade-off
that avoids making this pattern much more complex.

Reference:
- https://docs.python.org/3/library/constants.html#Ellipsis

closes: vim/vim#18107

77cfc49060

Co-authored-by: Jon Parise <jon@indelible.org>
2025-09-09 11:39:23 +08:00
zeertzjq
53e78bec7c vim-patch:6bb16d2: runtime(python): Update syntax file, fix f-string float highlighting
Fix matching of floats at the beginning of an f-string replacement
field, immediately after the opening brace.

The existing pattern, using `\zs`, cannot consume the already matched
`{` so use a lookbehind instead.

See comment: https://github.com/vim/vim/pull/17962#issuecomment-3201550443

closes: vim/vim#18220

6bb16d2cee

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-09 11:37:12 +08:00
zeertzjq
eb19206e03 vim-patch:9.1.1742: complete: preinsert does not work well with 'autocomplete' (#35692)
Problem:  complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
          (Girish Palya)

This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.

Try: `:set ac cot=preinsert`

See `:help 'cot'` for more details.

closes: vim/vim#18213

fa6fd41a94

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 03:35:41 +00:00
glepnir
c553008e74 fix(api): crash when moving curwin to other tabpage #35679
Problem: nvim_win_set_config may crash when attempting to move curwin to a
different tabpage if there is no other non-float available to switch to.

Solution: fix the crash. Fix ONE_WINDOW checks in winframe_find_altwin and
win_altframe to consider floating windows by instead using one_window. Allow
one_window to consider non-current tabpages. We can use one_window in
win_close_othertab now to also better reflect its use in win_close.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-09-08 18:30:20 -07:00
zeertzjq
c951fa9eeb Merge pull request #35690 from zeertzjq/vim-9.1.1738
vim-patch:9.1.{1738,1744},d7d6a6f
2025-09-09 09:14:43 +08:00
notomo
bbfcde3ab2 fix(lsp): check if buffer is valid in scheduled client:on_attach() #35672
Problem:
lsp._capability.is_enabled() can raise error if buffer is invalid in client:on_attach().

- error
```
./build/bin/nvim --clean --headless +"source ./minimal.lua"
vim.schedule callback: ...omo/workspace/neovim/runtime/lua/vim/lsp/_capability.lua:209: scoped variable: Invalid buffer id: 2
stack traceback:
        [C]: in function '__index'
        ...omo/workspace/neovim/runtime/lua/vim/lsp/_capability.lua:209: in function 'is_enabled'
        ...e/notomo/workspace/neovim/runtime/lua/vim/lsp/client.lua:1108: in function <...e/notomo/workspace/neovim/runtime/lua/vim/lsp/client.lua:1101>
```
- reproduction minimal.lua
```lua
vim.opt.runtimepath:append("/path/to/nvim-lspconfig/")
vim.lsp.enable("lua_ls")

vim.cmd.tabedit("runtime/lua/vim/_defaults.lua")
vim.api.nvim_create_autocmd({ "LspAttach" }, {
  group = vim.api.nvim_create_augroup("test", {}),
  callback = function()
    vim.cmd.tabedit("runtime/lua/vim/_defaults.lua")
    local bufnr = vim.api.nvim_get_current_buf()
    vim.api.nvim_buf_delete(bufnr, { force = true })
  end,
})
```

Solution:
Check whether buffer is valid.
2025-09-08 17:52:25 -07:00
zeertzjq
327a2d57eb vim-patch:d7d6a6f: runtime(doc): Improve doc for cmdline-autocompletion
- Address https://github.com/vim/vim/pull/18219#issuecomment-3264634710
- Make the cmdline-autocompletion help more user friendly

closes: vim/vim#18245

d7d6a6f05a

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:30:34 +08:00
zeertzjq
223f9622df vim-patch:9.1.1744: tests: Test_skip_wildtrigger_hist_navigation() may fail
Problem:  tests: Test_skip_wildtrigger_hist_navigation() may fail
          (zeertzjq).
Solution: Correct test to validate intended behavior (Girish Palya).

See https://github.com/vim/vim/pull/18219#issuecomment-3265183318

closes: vim/vim#18243

3980c86525

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:25:58 +08:00
zeertzjq
b51eba9273 vim-patch:9.1.1738: cmdline-autocompletion breaks history navigation
Problem:  cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
          Palya)

Up/Down arrows support history navigation when using wildtrigger()

fixes: vim/vim#18207
closes: vim/vim#18219

708ab7f5fb

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:25:19 +08:00
James McCoy
a7b8102f20 Merge pull request #35659 from jamessan/enable-arm-unittests
Fix unittests on aarch64 / arm64
2025-09-08 20:13:16 -04:00
zeertzjq
7f2298ad32 fix(cmdline): fix inconsistent behavior with ext_popupmenu (#35688) 2025-09-09 00:11:13 +00:00
Shadman
acb99b8a65 fix(prompt_buffer): plugins can't set ': mark #35624
Problem:
Currently, prompt_buffer manages `:` mark by itself and exposes it
read-only mark. However when it fails there can be no mitigation made
by plugins. The `:` mark should act like a regular marks and be
modifiable.

Solution:
Allow plugins to set `:` mark.
2025-09-08 15:09:48 -07:00
Justin M. Keyes
1cb1cfead0 docs: drop "xx.vim" syntax help-tags #35623
Problem:
These "foo.vim" syntax tags add 100+ useless tags to help. In
particular, "progress.vim" is the first match for "progress", which not
the result anyone is actually looking for, since Nvim 0.12 gained the
"progress-message" feature.

Solution:
Drop the "foo.vim" syntax tags. The "ft-foo" tags are more appropriately
named.
2025-09-07 20:45:22 -07:00
zeertzjq
29f30ad91c vim-patch:9.1.1679: unclear what key causes CmdlineLeave autocommand (#35677)
Problem:  unclear what key causes CmdlineLeave autocommand
Solution: Set |v:char| to the key (Girish Palya).

related: vim/vim#17806
closes: vim/vim#18063

ba9551d131

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 11:40:12 +08:00
zeertzjq
da78772328 test(lsp): fix flakiness in inline completion test (#35676)
The flakiness happens because get() uses vim.schedule(), and a following
key may be processed before the scheduled event. Use poke_eventloop() to
ensure that the scheduled event is processed.
2025-09-08 02:54:57 +00:00
zeertzjq
f0bf6d7647 Merge pull request #35673 from zeertzjq/vim-9.1.1676
vim-patch: cmdline completion fixes
2025-09-08 10:38:37 +08:00
zeertzjq
bea87b4a9e test: add tests for #20348 2025-09-08 09:24:13 +08:00
zeertzjq
18f24b85c3 vim-patch:9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pum
Problem:  Memory leak with wildmode=longest,full and wildoptions=pum
          (after 9.1.1737).
Solution: Avoid using showmatches() and WILD_NEXT together.  Also fix
          wildmode=longest,noselect:full selecting wrong item
          (zeertzjq).

fixes: vim/vim#18228
closes: vim/vim#18229

c7f235bd43
2025-09-08 09:02:37 +08:00
zeertzjq
d784ed7013 vim-patch:9.1.1739: Matches may be listed twice with wildmode=longest,list
Problem:  Matches may be listed twice with wildmode=longest,list when
          "longest" doesn't change command line (after 9.1.1737).
Solution: Set did_wild_list when trying "list" after "longest"
          (zeertzjq).

closes: vim/vim#18227

a28a2eb9d9
2025-09-08 09:02:37 +08:00
zeertzjq
f2bda1effc vim-patch:9.1.1737: Patch v9.1.1714 introduce a regression for wildmenu
Problem:  Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq)
Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya)

- Fixed a regression caused by PR vim/vim#18125 selecting wrong item
- Fixed another regression where the first pasted text did not appear on
  the command-line after starting Vim.

closes: vim/vim#18212

8fec92d631

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
zeertzjq
1359578abb vim-patch:9.1.1714: completion: wildmode=longest:full selects wrong item
Problem:  completion: wildmode=longest:full selects wrong item
          (zeertzjq)
Solution: Fix issue, refactor ex_getln.c slightly
          (Girish Palya)

fixes: vim/vim#18102
closes: vim/vim#18125

2eccb4d0be

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
zeertzjq
3b5337ab6c vim-patch:9.1.1676: completion: long line shown twice
Problem:  completion: long line shown twice
          (Maxim Kim)
Solution: Fix the issue, disable an incorrect test.
          (Girish Palya)

fixes: vim/vim#18035
closes: vim/vim#18088

57379302aa

Omit removal of blank line in Test_noselect_expand_env_var() as it's
added again in patch 9.1.1682.
Cherry-pick two blank lines in Test_long_line_noselect() from patch
9.1.1682.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
zeertzjq
a16064ff29 vim-patch:partial:9.1.1639: completion: popup may be misplaced
Problem:  During commandline completiom, popup window placement can be
          incorrect when 'noselect' is present in 'wildmode'
          (Shane-XB-Qian)
Solution: Disable "showtail" feature when 'noselect' is present.

fixes: vim/vim#17969
closes: vim/vim#18001

1e38198a41

Partial port excluding the showtail change and the test.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:36 +08:00
skewb1k
ad22d0ace9 fix(cjson): fix strbuf_set_length incorrectness #35565
`strbuf_set_length` was incorrectly updating
length with `+=` instead of assignment.

Also syncs minor updates with upstream.
2025-09-07 15:45:34 -07:00
Evgeni Chasnovski
0c49167490 docs: adjust *lua-plugin-init* wording #35600
Problem: Unnecessarily anecdotal wording.

Solution: Adjust wording while delivering the same message.
2025-09-07 15:04:09 -07:00
Evgeni Chasnovski
fa3920282d fix(pack): handle Git environment variables #35626
Problem: Some environment variables which are useful when working inside
  a bare repository can affect any Git operation.

Solution: Explicitly unset problematic environment variables.
2025-09-07 14:42:09 -07:00
skewb1k
448f15ca39 feat(json): pretty-format (indent) with vim.json.encode() #35424
Problem:
There is no straightforward way to pretty-print objects as JSON.
The existing `vim.inspect` outputs LON.

Solution:
Introduce an `indent` option for `vim.json.encode()` which enables
human-readable output with configurable indentation.

Adapts PR to upstream: openresty/lua-cjson#114
2025-09-07 14:38:27 -07:00
glepnir
2b156be19c refactor(api): redundant w_pos_changed assignment #35663
Problem: w_pos_changed flag was being set redundantly after win_config_float call

Solution: remove duplicate assignment since win_config_float already sets this flag internally
2025-09-07 10:11:32 -07:00
Evgeni Chasnovski
7853cde29a feat(pack): vim.pack.get() gets VCS info #35631
Problem:
Force resolve `spec.version` overrides the information about whether
a user supplied `version` or not. Knowing it might be useful in some use
cases (like comparing to previously set `spec` to detect if it has
changed).

Solution:
Do not resolve `spec.version`. This also improves speed when triggering
events and calling `get()`.
- Place default branch first when listing all branches.
- Use correct terminology in `get_hash` helper.
- Do not return `{ '' }` if there are no tags.

Problem:
There is no way to get more information about installed plugins, like
current revision or default branch (necessary if resolving default
`spec.version` manually). As computing Git data migth take some time,
also allow `get()` to limit output to only necessary set of plugins.

Solution:
- introduce arguments to `get(names, opts)`, which follows other
  `vim.pack` functions. Plugin extra info is returned by default and
  should be opt-out via `opts.info = false`.
  - Examples:
    - Get current revision: `get({ 'plug-name' })[1].rev`
    - Get default branch: `get({ 'plug_name' })[1].branches[1]`
- `update()` and `del()` act on plugins in the same order their names
  are supplied. This is less surprising.
- default `opts.info` to `true` since this simplifies logic for the
  common user, while still leaving the door open for a faster `get()` if
  needed.
2025-09-07 09:59:31 -07:00
github-actions[bot]
fd59e72b47 docs: update version.c #35576
vim-patch:8.1.1919: using window options when passing a buffer to popup_create()
vim-patch:8.1.1954: more functions can be used as a method
vim-patch:8.1.1982: more functions can be used as methods
vim-patch:8.1.1986: more functions can be used as methods
vim-patch:8.1.1987: more functions can be used as methods
vim-patch:8.1.1993: more functions can be used as methods
vim-patch:8.1.1996: more functions can be used as methods
vim-patch:8.1.2004: more functions can be used as methods
vim-patch:8.1.2295: if buffer of popup is in another window cursorline sign shows

vim-patch:8.2.0568: the man filetype plugin overwrites the unnamed register
vim-patch:8.2.1186: with SGR mouse codes balloon doesn't show up after click
vim-patch:8.2.3539: GTK3: with 'rightleft' set scrollbar may move unintentionally
vim-patch:8.2.3681: cannot drag popup window after click on a status line
vim-patch:8.2.4561: build failure with some combination of features
vim-patch:8.2.4984: dragging statusline fails for window with winbar

vim-patch:9.0.0136: after CTRL-Left-mouse click a mouse scroll also has CTRL
vim-patch:9.0.0696: it is unclear if the +rightleft and +arabic features are used
vim-patch:9.0.0931: MS-Windows: mouse column limited to 223
vim-patch:9.0.1896: "below" virtual text doesn't work with 'rightleft'
2025-09-07 09:36:52 -07:00
zeertzjq
5f23ce732d Merge pull request #35664 from zeertzjq/vim-efb913a
vim-patch: runtime file updates
2025-09-07 22:00:54 +08:00
zeertzjq
4521f6da7d vim-patch:1ed2ff7: runtime(m4): Remove m4Type and leftover m4Function in syntax script
closes: vim/vim#18223

1ed2ff77d8

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-09-07 21:22:52 +08:00
zeertzjq
91fa613fad vim-patch:6505dc6: runtime(nu): Add new Nushell runtime files
See: https://github.com/elkasztano/nushell-syntax-vim

Thanks to Pete Cruz (@Petesta) for promoting this addition.

closes: vim/vim#18208

6505dc69d3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-09-07 21:22:12 +08:00
zeertzjq
30dc9934a6 vim-patch:efb913a: runtime(m4): Remove m4Function
closes: vim/vim#18211

efb913a4f5

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-09-07 21:21:33 +08:00
Christian Clason
13b04207f1 build(deps): bump tree-sitter-query to v0.7.0 2025-09-07 12:51:46 +02:00
James McCoy
9cd026fe83 ci: enable unittests on arm runner 2025-09-06 20:15:41 -04:00
James McCoy
e702f97518 fix(tests): ignore vector math types
As noted in #34908, the arm unittests fail due to unrecognized types:

    ERROR    test/unit/testutil.lua @ 802: Expressions parser works with &opt
    test/unit/testutil.lua:774: test/unit/testutil.lua:758: (string) '
    test/unit/testutil.lua:288: declaration specifier expected near '__SVFloat32_t''
    exit code: 256

After testing on Debian's arm64 porterbox, the unittests cleanly pass
when ignoring various types defined in
/usr/include/aarch64-linux-gnu/bits/math-vector.h
2025-09-06 20:15:35 -04:00
Maria José Solano
21f2c2b19c docs(lsp): tweak inline_completion.get code snippet #35657
`replace_keycodes` is true if `expr` is set, and "Accept" is a better
term to describe the keymap.
2025-09-06 16:12:32 -07:00
Christian Clason
f23bd47254 build(deps): bump tree-sitter to v0.25.9 2025-09-07 00:16:13 +02:00
Christian Clason
22fedc09b0 ci: disable wasmtime build
Problem: The wasmtime version compatible with tree-sitter 0.25.x fails
current Rust lint.

Solution: Disable wasmtime build.

Rationale:
1. As the only Rust dependency, these force us into a fast-moving update cycle (new warnings for everyone!);
2. wasmtime has a monthly release cycle, but we're locked into whatever tree-sitter supports, and there's no clear compatibility matrix (and I no longer care enough to spend the time and effort keeping this synced between tree-sitter and neovim);
3. we only test building with wasmtime but not actually using wasm parsers (this was actually broken for a while without being caught);
4. we're probably not going to go with wasmtime as our default wasm engine anyway.
2025-09-07 00:16:13 +02:00
Lewis Russell
ef48104c31 fix(types): nvim_get_win_config return type #35639 2025-09-06 14:19:12 -07:00
Phạm Bình An
798bb3f66a docs: details dict in nvim_buf_get_extmark() #35289
Problem: The document of nvim_buf_get_extmark currently lacks the
following:
- "details" directory: nvim_buf_get_extmarks() allows an option details
  to get a "details" directory in result, but it doesn't mention where
  that "details" directory is, what fields does it have.

Solution: Add docs for "details" directory in nvim_buf_get_extmarks()
2025-09-06 13:38:31 -07:00
Sean Dewar
da39966a3a fix(api): win_set_config error message for splitting from a float #35650
Problem: after #34287 nvim_win_set_config no longer errors when attempting to
split from a floating window only if "win" is 0.

Solution: fix the regression, reduce the scope of "parent" and similar checks to
only where it's currently used and add test coverage for the errors.
2025-09-06 13:22:46 -07:00
glepnir
14e94f4617 perf(api): reduce redundant win_find_tabpage calls (#35643)
Problem: `nvim_win_set_config` calls `win_find_tabpage(parent)` with redundant calls

Solution: Cache `parent_tp` early and reuse before window operations.
2025-09-06 12:48:44 +01:00
dependabot[bot]
bc15b35cf6 ci: bump actions/labeler from 5 to 6 (#35641)
Bumps [actions/labeler](https://github.com/actions/labeler) from 5 to 6.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-05 20:34:26 -07:00
dependabot[bot]
749fa7e753 ci: bump actions/github-script from 7 to 8 (#35642)
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-05 20:30:39 -07:00
zeertzjq
ba5fedde65 Merge pull request #35647 from zeertzjq/vim-510ca80
vim-patch: runtime file updates
2025-09-06 09:36:49 +08:00
zeertzjq
63b53c8d15 vim-patch:dfcd9ac: runtime(ada): mark as unmaintained, fix a few issues with the ftplugin
closes: vim/vim#18178

dfcd9ac120

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-06 08:16:23 +08:00