Commit Graph

31722 Commits

Author SHA1 Message Date
Guilherme Soares
17b46d01e2
test(treesitter): inspect_tree #31182
To prevent #30986 and #31198 regression update inspect_tree tests
2025-01-08 05:06:09 -08:00
notomo
5b9518b436
fix(api): nvim_set_decoration_provider callback return type #31912
Problem: incorrect return type doc causes luals `Annotations specify that at most 0 return value(s) are required, found 1 returned here instead.` diagnosis

Solution: correct return type doc
2025-01-08 04:37:29 -08:00
Christian Clason
561580aba5 vim-patch:9.1.0995: filetype: shaderslang files are not detected
Problem:  filetype: shaderslang files are not detected
Solution: detect '*.slang' files as shaderslang filetype,
          include a filetype and syntax script (mtvare6)

Reference:
https://shader-slang.com/

closes: vim/vim#16387

616219f684

Co-authored-by: mtvare6 <mtvare6@proton.me>
2025-01-08 10:32:45 +01:00
zeertzjq
141114c170
fix(api): crash on invalid buffer to nvim_buf_del_user_command (#31908) 2025-01-08 05:16:41 +00:00
Evgeni Chasnovski
6719276040
fix(highlight): make TablineSel more noticeable with 'notermguicolors' #31905
Problem: Linking `TablineSel` to `Normal` makes it more noticeable with
`notermguicolors` but less so with `termguicolors` (compared to using
bold text in both cases).

Solution: use bold text with `termguicolors` and regular with
`notermguicolors`.
2025-01-07 14:02:35 -08:00
glepnir
b12b91c274
feat(health): show :checkhealth in floating window #31086
Problem: health can not shown in a floating window
Solution: add g:health variable
2025-01-07 08:09:01 -08:00
Riley Bruins
d9ee0d2984 perf(treesitter): don't fetch parser for each fold line
**Problem:** The treesitter `foldexpr` calls `get_parser()` for each
line in the buffer when calculating folds. This can be incredibly slow
for buffers where a parser cannot be found (because the result is not
cached), and exponentially more so when the user has many
`runtimepath`s.

**Solution:** Only fetch the parser when it is needed; that is, only
when initializing fold data for a buffer.

Co-authored-by: Jongwook Choi <wookayin@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-01-07 16:43:45 +01:00
Jared Baur
b67fcd0488
fix(highlight): make TablineSel more noticeable #31896
The default `TablineSel` highlighting makes it subjectively difficult to
differentiate the selected tab from unselected ones.
2025-01-07 04:21:15 -08:00
dundargoc
d8bc08db7f refactor: adopt vterm
We have changed too much to consider it a mere bundled dependency (such
as unicode handling in e3bfcf2fd4), and
can consider it our own at this point.
2025-01-07 12:35:24 +01:00
Christian Clason
4d94059919 vim-patch:3159b64: runtime(sh): fix typo in Last Change header
related: vim/vim#16394

3159b6494e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-07 08:03:13 +01:00
Christian Clason
b44a8ba1e7 vim-patch:cf1f555: runtime(sh): add PS0 to bashSpecialVariables in syntax script
PS0 is also a special prompt variable. (It is expanded and displayed
after it reads a command but before executing it.)

References:
https://www.gnu.org/software/bash/manual/html_node/Interactive-Shell-Behavior.html

closes: vim/vim#16394

cf1f55548d

Co-authored-by: Jon Parise <jon@indelible.org>
2025-01-07 08:03:13 +01:00
Christian Clason
a942dea157 vim-patch:7ceaa8f: runtime(vim): Remove trailing comma from match_words
fixes: vim/vim#16377 (`filetype plugin indent on` breaks matchit).
closes: vim/vim#16389

7ceaa8f3dd

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-01-07 08:03:13 +01:00
zeertzjq
e27f7125d6
Merge pull request #31893 from zeertzjq/vim-9.1.0984
vim-patch:9.1.{0984,0991}: getstacktrace(), v:stacktrace
2025-01-07 09:42:17 +08:00
zeertzjq
8fa4306eb9 vim-patch:9.1.0991: v:stacktrace has wrong type in Vim9 script
Problem:  v:stacktrace has wrong type in Vim9 script.
Solution: Change the type to t_list_dict_any.  Fix grammar in docs.
          (zeertzjq)

closes: vim/vim#16390

6655bef330
2025-01-07 09:15:10 +08:00
zeertzjq
d5308637bf vim-patch:9.1.0984: exception handling can be improved
Problem:  exception handling can be improved
Solution: add v:stacktrace and getstacktrace()

closes: vim/vim#16360

663d18d610

Co-authored-by: ichizok <gclient.gaap@gmail.com>
Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
2025-01-07 09:15:10 +08:00
luukvbaal
06ff5480ce
vim-patch:9.1.0993: New 'cmdheight' behavior may be surprising #31892
Problem:  Although patch 9.1.0990 fixed a real problem/inconsistency,
          it also introduced new behavior that may break BWC and/or be
          unexpected. Before 9.1.0990, window commands could make the
          topframe smaller (without changing 'cmdheight'; quirk that is
          now fixed), but did not allow extending the topframe beyond
          the 'cmdheight' set by the user. After 9.1.0990, the user can
          reduce the 'cmdheight' below the value they set explicitly,
          through window commands, which may lead to confusion.
          (aftere v9.1.0990)
Solution: Store the value explicitly set by the user and clamp the
          'cmdheight' when resizing the topframe. This also applies to
          dragging laststatus, which in contrast to window commands
          _did_ allow reducing the 'cmdheight' to values below the one
          set by the user. So with this patch there is still new
          behavior, but I think in a way that is less surprising.
          While at it, also fix a Coverity warning, introduced in
          v9.1.0990 (Luuk van Baal)

c97e869535
2025-01-06 17:00:09 -08:00
Riley Bruins
30de00687b
refactor(treesitter): simplify condition #31889 2025-01-06 16:56:53 -08:00
dundargoc
b6ab294838 fix: fix incorrect search code 2025-01-06 20:03:17 +00:00
Justin M. Keyes
3d9fb975b9
Merge #31625 perf(decor): improve iter_captures() cache 2025-01-06 07:09:34 -08:00
luukvbaal
86770108e2
fix(lsp): open_floating_preview() zindex relative to current window #31886
Problem:  open_floating_preview() may be hidden behind current window if
          that is floating and has a higher zindex.
Solution: Open floating preview with zindex higher than current window.
2025-01-06 06:05:50 -08:00
vanaigr
dd234135ad refactor: split predicates and directives 2025-01-06 00:35:19 -06:00
vanaigr
8d2ee542a8 perf(decor): join predicates and matches cache 2025-01-06 00:34:48 -06:00
vanaigr
ef77845b97 test: benchmark treesitter highlighing 2025-01-06 00:34:19 -06:00
zeertzjq
9b7905df16
Merge pull request #31882 from zeertzjq/vim-0c3e57b
vim-patch: doc updates
2025-01-06 10:17:19 +08:00
zeertzjq
e8c0b87c1f vim-patch:fd77161: runtime(doc): update doc for :horizontal
Revert the documentation for :horizontal from commit
0c3e57b403e0e3a1fefc because :horizontal cannot be shortened to :ho

closes: vim/vim#16362

fd771613b3

Co-authored-by: h-east <h.east.727@gmail.com>
2025-01-06 09:54:55 +08:00
zeertzjq
22dadf4c33 vim-patch:0c3e57b: runtime(doc): update index.txt, windows.txt and version9.txt
closes: vim/vim#16357

0c3e57b403

Co-authored-by: h-east <h.east.727@gmail.com>
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2025-01-06 09:53:49 +08:00
zeertzjq
abb19e873b
Merge pull request #31881 from zeertzjq/vim-21c37d7
vim-patch: update Vim syntax
2025-01-06 09:43:47 +08:00
zeertzjq
53f5d528cf vim-patch:6139766: runtime(vim): fix failing vim syntax test
after v9.1.0985

related: vim/vim#16356

6139766e82

Co-authored-by: h-east <h.east.727@gmail.com>

N/A patch:
vim-patch:8a27d97: runtime(doc): Capitalise the mnemonic "Zero" for the 'z' flag of search()
2025-01-06 09:16:13 +08:00
zeertzjq
b23c28845f vim-patch:21c37d7: runtime(vim): update base-syntax after v9.1.0936
21c37d7f69

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-06 09:16:13 +08:00
Justin M. Keyes
5e02a2c470
"nvim -es": disable shada #21723
Problem:
`nvim -es` (and `nvim -Es`) is the recommended way to non-interactively
run commands/vimscript. But it enables shada by default, which is
usually not wanted.

Solution:
- Disable shada by default for `nvim -es/-Es`. This can be overridden by
  `-i foo` if needed.
- Do NOT change the 'loadplugins' default.
  - User config + packages _should_ be enabled by default, for both `nvim
    -es` and `nvim -l`. Else any Lua packages you have can't be accessed
    without `-u path/to/config`, which is clumsy.
      - Use-cases:
        ```
        nvim --headless "+Lazy! sync" +qa
            would become: nvim -es "+Lazy! sync"
        nvim --headless +PlugInstall +qall
            would become: nvim -es +PlugInstall
        ```
  - Opt-out (`--clean` or `-u NONE`) is much easier than opt-in (`-u
    path/to/config`).
  -  User config/packages are analogous to pip packages, which are
     expected when doing `python -c ...`.

related: 7c94bcd2d7
related: ddd0eb6f51
2025-01-05 17:10:16 -08:00
Justin M. Keyes
570a8da01b
fix(health): "q" should not close last window #31876 2025-01-05 11:31:39 -08:00
Daiki Noda
ac5a6d9ff5
build: fix RelWithDebInfo optimization flags #31802
Problem:
RelWithDebInfo generates redundant flags:

    Compilation: /usr/bin/cc -O2 -g -Og -g

The `CMAKE_C_FLAGS_RELWITHDEBINFO` variable is being modified in a way
that caused duplicate `-Og` and `-g` flags to be added. The resulting
flags were `-O2 -g -Og -g`.

- `-Og` (Optimize for debugging) and `-O2` (Optimize for performance)
  are different optimization levels. We can't use both at once.
- The duplicate `-g` flag is redundant and no effect.

multiple -O flags has no effect for code, just redundant.

> If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

Solution:
Adjust the flags to use the more appropriate `-O2 -g`.

    Compilation: /usr/bin/cc -O2 -g

BEFORE:

```
:verbose version
NVIM v0.11.0-dev-1443+ge00cd1ab40
Build type: RelWithDebInfo
LuaJIT 2.1.1734355927
Compilation: /usr/bin/cc -O2 -g -Og -g -flto -fno-fat-lto-ob
jects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict
...
```

AFTER:

```
:verbose version
NVIM v0.11.0-dev-e00cd1ab4-dirty
Build type: RelWithDebInfo
LuaJIT 2.1.1734355927
Compilation: /usr/bin/cc -O2 -g -flto -fno-fat-lto-objects -
Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-protot
...
```
2025-01-05 11:28:31 -08:00
Maria José Solano
548f19ccc3
feat(health): close checkhealth buffers with q #31870 2025-01-05 09:51:51 -08:00
Christian Clason
bd2a4edf1b vim-patch:202ebc6: runtime(zsh): sync syntax script with upstream repo
fixes: vim/vim#16371

202ebc6ced

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-05 17:13:00 +01:00
luukvbaal
847c28f6f6
fix(cmdline): always show cmdline when it is a prompt #31866
Cmdline prompts should ignore `cmd_silent`.
2025-01-05 05:59:50 -08:00
glepnir
bf48dfadec
fix(api): nvim__complete_set requires completeopt=popup #31177
Problem:
If completeopt does not include "popup" flag, nvim__complete_set still
auto-creates a floating preview window.

Solution:
Fail if completeopt does not include the "popup" flag.
2025-01-05 05:57:53 -08:00
glepnir
d288f7003d
fix(popup): wrong extmark data sync when lines changed in popup preview #30246
Problem: when popup preview buffer has filetype like markdown and ts
is enabled, the extmark clean and update not correct, if add the extmark
sync there has lots of duplicate codes like nvim_buf_set_lines.

Solution: use nvim_buf_set_lines api internally to set info to popup
preview buffer.
2025-01-05 05:52:50 -08:00
Riley Bruins
b61051ccb4 feat(func): allow manual cache invalidation for _memoize
This commit also adds some tests for the existing memoization
functionality.
2025-01-05 12:28:01 +01:00
luukvbaal
54ac406649
vim-patch:9.1.0990: Inconsistent behavior when changing cmdheight (#31830)
Problem:  Inconsistent behavior when changing cmdheight by resizing the
          topframe through wincmds and dragging laststatus. Changing
          cmdheight by resizing the topframe does not trigger OptionSet.
Solution: Consolidate logic for changing the cmdheight, set the option
          value to handle side-effects (Luuk van Baal)

e15cbc1af4

vim-patch:9.0.0187: command line height changes when maximizing window height

Problem:  Command line height changes when maximizing window height.
Solution: Do not change the command line height. (closes vim/vim#10885)

96bde99bf8
2025-01-05 19:09:38 +08:00
Maria José Solano
5e90406487 fix(health): set nomodifiable in checkhealth buffers 2025-01-05 09:43:59 +01:00
Justin M. Keyes
64b0e6582a
refactor(tests): merge n.spawn/n.spawn_argv into n.new_session #31859
Problem:
- `n.spawn()` is misleading because it also connects RPC, it's not just
  "spawning" a process.
- It's confusing that `n.spawn()` and `n.spawn_argv()` are separate.

Solution:
- Replace `n.spawn()`/`n.spawn_argv()` with a single function `n.new_session()`.
  This name aligns with the existing functions `n.set_session`/`n.get_session`.
    - Note: removes direct handling of `prepend_argv`, but I doubt that was
      important or intentional. If callers want to control use of `prepend_argv`
      then we should add a new flag to `test.session.Opts`.
- Move `keep` to first parameter of `n.new_session()`.
- Add a `merge` flag to `test.session.Opts`
- Mark `_new_argv()` as private. Test should use clear/new_session/spawn_wait
  instead.
2025-01-04 16:48:00 -08:00
dundargoc
a8ace2c58a fix(vim.fs.normalize): normalize case for windows drive letter
Also add tests for the current path casing behavior so it doesn't get
accidentally changed.
2025-01-04 21:48:45 +01:00
Emilia Simmons
69aa33d890 fix(runtime): let matchit and matchparen skips fallback on treesitter captures
When treesitter is enabled, by default syntax groups are not defined, but these
groups are used to identify where to skip matches in matchit and matchparen.

This patch does three things:
1. If syntax is enabled regardless of treesitter (`vim.bo.syntax='on'`):
   Use original implementation.
2. If treesitter is enabled and syntax is not:
   Match the syntax groups (i.e. `comment\|string`) against treesitter captures
   to check for skipped groups.
3. Add an explicit treesitter syntax for marking captures to skip:
   matchit uses `b:match_skip` to determine what counts as skippable
   Where 's:comment\|string' uses a match of the named syntax groups against
   a regex match of comment\|string, 't:comment\|string' now uses vim regex
   to match against the names of the treesitter capture groups.
2025-01-04 20:11:43 +01:00
Gregory Anders
4eaf9371ca
docs: cleanup news.txt (#31854)
Move non-breaking changes out of the breaking changes section
2025-01-04 12:39:57 -06:00
Justin M. Keyes
975c2124a6
test: use spawn_wait() instead of system() #31852
Problem:
Tests that need to check `nvim` CLI behavior (no RPC session) create
their own ad-hoc `system()` wrappers.

Solution:
- Use `n.spawn_wait` instead of `system()`.
- Bonus: this also improves the tests by explicitly checking for
  `stdout` or `stderr`. And if a signal is raised, `ProcStream.status`
  will reflect it.
2025-01-04 06:29:13 -08:00
Christian Clason
7ddadd0fee vim-patch:cd96075: runtime(java): Quietly opt out for unsupported markdown.vim versions
fixes vim/vim#16349
closes: vim/vim#16369

cd96075cde

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2025-01-04 10:35:00 +01:00
Justin M. Keyes
a09c7a5d57
Merge #30384 test: spawn_wait() 2025-01-03 10:46:20 -08:00
Justin M. Keyes
700a25e621 test: include stderr in EOF failure message 2025-01-03 19:24:04 +01:00
Justin M. Keyes
a1ba655dee test: spawn_wait() starts a non-RPC Nvim process
Problem:
Can't use `n.clear()` to test non-RPC `nvim` invocations. So tests end
up creating ad-hoc wrappers around `system()` or `jobstart()`.

Solution:
- Introduce `n.spawn_wait()`
- TODO (followup PR): Rename `n.spawn()` and `n.spawn_wait()`.
  It's misleading that `n.spawn()` returns a RPC session...
2025-01-03 19:24:04 +01:00
Justin M. Keyes
fe87656f29 fix(grid): grid_line_start NULL access with 'redrawdebug'
Problem:
This test causes a null pointer dereference:

    local proc = n.spawn_wait('-l', 'test/functional/fixtures/startup-fail.lua')

    RUN      T1565 startup -l Lua Lua-error sets Nvim exitcode: 241.00 ms OK
    ==================== File …/build/log/asan.13763 ====================
    = …/src/nvim/grid.c:389:12: runtime error: null pointer passed as argument 1, which is declared to never be null
    = /usr/include/string.h:61:62: note: nonnull attribute specified here
    =     0 0x55cc2d869762 in grid_line_start …/src/nvim/grid.c:389:5
    =     1 0x55cc2d8717ca in grid_clear …/src/nvim/grid.c:618:5
    =     2 0x55cc2dbe0f6f in msg_clr_eos_force …/src/nvim/message.c:3085:3
    =     3 0x55cc2dbbbdec in msg_clr_eos …/src/nvim/message.c:3061:5
    =     4 0x55cc2dbbae2c in msg_multiline …/src/nvim/message.c:281:9
    =     5 0x55cc2dbba2b4 in msg_keep …/src/nvim/message.c:364:5
    =     6 0x55cc2dbc4992 in emsg_multiline …/src/nvim/message.c:773:10
    =     7 0x55cc2dbc5d43 in semsg_multiline …/src/nvim/message.c:824:9
    =     8 0x55cc2d9c5945 in nlua_error …/src/nvim/lua/executor.c:158:5
    =     9 0x55cc2d9c89fd in nlua_exec_file …/src/nvim/lua/executor.c:1862:5
    =     10 0x55cc2d9f4d69 in main …/src/nvim/main.c:637:19
    =     11 0x7f319b62a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    =     12 0x7f319b62a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    =     13 0x55cc2ced0f64 in _start (…/build/bin/nvim+0xc48f64) (BuildId: 309c83f8d74297c89719dae9c271dd8ec23e64c3)

Cause:
The tests use `redrawdebug=invalid` by default, but `default_grid_alloc`
skips calling `grid_alloc` when not `full_screen`.

Solution:
Check for `full_screen`.
2025-01-03 18:02:33 +01:00