Commit Graph

31676 Commits

Author SHA1 Message Date
Famiu Haque
c5f93d7ab0 refactor(options): remove code for multitype options
Problem: It was decided on Matrix chat that multitype options won't be necessary for Neovim options, and that options should only have a single canonical type. Therefore the code for supporting multitype options is unnecessary.

Solution: Remove the additional code that's used to provide multitype option support.
2025-01-14 09:34:17 +00:00
Riley Bruins
b192d58284 perf(treesitter): calculate folds asynchronously
**Problem:** The treesitter `foldexpr` runs synchronous parses to
calculate fold levels, which eliminates async parsing performance in the
highlighter.

**Solution:** Migrate the `foldexpr` to also calculate and apply fold
levels asynchronously.
2025-01-14 09:30:43 +00:00
Horror Proton
5a54681025 fix(treesitter): uv_dlclose after uv_dlerror 2025-01-14 09:15:35 +00:00
Christian Clason
0dfa4de993 build(deps): bump luajit to HEAD - a4f56a459 2025-01-14 09:00:50 +01:00
Xuyuan Pang
a4f575abd8
fix(lsp): minimum height for floating popup #31990
Problem:
The floating window for hover and signature help always cuts off a few lines,
because the `_make_floating_popup_size` function counts empty lines as having
zero height.

Solution:
Ensure the height is at least 1.
2025-01-13 15:17:23 -08:00
Lewis Russell
34e2185022 fix(options): better handling of empty values
Problem:

Whether an option is allowed to be empty isn't well defined and
isn't properly checked.

Solution:

- For non-list string options, explicitly check the option value
  if it is empty.
- Annotate non-list string options that can accept an empty value.
  - Adjust command completion to ignore the empty value.
- Render values in Lua meta files
2025-01-13 16:58:25 +00:00
luukvbaal
cb7b4e2962
feat(messages): "verbose" message kind #31991 2025-01-13 04:59:34 -08:00
dundargoc
47866cd8d2 refactor: delete duplicate utf8-functionality
Also remove British National Replacement Character Set.

We keep the DEC Special Graphics and ASCII despite it not being unicode
as some old software such as calcurse still rely on this functionality.

References:
- https://github.com/neovim/neovim/pull/31934#discussion_r1911046426
- https://en.wikipedia.org/wiki/DEC_Special_Graphics
- https://vt100.net/docs/vt220-rm/chapter2.html#S2.4.3
2025-01-13 13:16:41 +01:00
dundargoc
0631492f9c feat: add vim.fs.relpath
This is needed to replace the nvim-lspconfig function is_descendant that
some lspconfg configurations still use.
2025-01-13 13:14:52 +01:00
bfredl
913e81c35f fix(getchar): do not simplify keycodes in terminal mode
The code represents a useful pattern in normal mode where remapping
`<tab>` will implicitly also remap `<c-i>` unless you remap that
explicitly. This relies on the _unmapped_ behavior being identical which
is not true in terminal mode, as vterm can distinguish these keys.

Vim seems to entangle this with kitty keyboard mode detection which
is irrelevant for us. Conditional fallbacks depending on
keyboard mode could be done completely inside `vterm/` without getchar.c
getting involved, I would think.
2025-01-13 11:55:16 +01:00
Guilherme Soares
a3ef29d570
test: use temp file #31907 2025-01-13 01:41:49 -08:00
zeertzjq
2c16c84998
vim-patch:9.1.1011: popupmenu internal error with some abbr in completion item (#31988)
Problem:  Popup menu internal error with some abbr in completion item.
Solution: Don't compute attributes when there is no corresponding text.
          Reduce indent in pum_redraw() while at it (zeertzjq).

fixes: vim/vim#16427
closes: vim/vim#16435

3a0cc36c69
2025-01-13 15:18:47 +08:00
Lewis Russell
99c4bd2f69
Merge pull request #31631 from ribru17/async_parse_attempt_2
feat(treesitter): async parsing
2025-01-13 06:58:33 +00:00
Christian Clason
f4cff3077b build(deps): bump tree-sitter to v0.24.7 2025-01-12 19:52:39 +01:00
Riley Bruins
bd4ca22d03 feat(treesitter)!: don't parse tree in get_parser() or start()
**Problem:** `vim.treesitter.get_parser()` and `vim.treesitter.start()`
both parse the tree before returning it. This is problematic because if
this is a sync parse, it will stall the editor on large files. If it is
an async parse, the functions return stale trees.

**Solution:** Remove this parsing side effect and leave it to the user
to parse the returned trees, either synchronously or asynchronously.
2025-01-12 08:10:49 -08:00
Riley Bruins
45e606b1fd feat(treesitter): async parsing
**Problem:** Parsing can be slow for large files, and it is a blocking
operation which can be disruptive and annoying.

**Solution:** Provide a function for asynchronous parsing, which accepts
a callback to be run after parsing completes.

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Co-authored-by: VanaIgr <vanaigranov@gmail.com>
2025-01-12 08:10:47 -08:00
Riley Bruins
3fdc430241 perf(treesitter): cache queries strongly
**Problem:** Query parsing uses a weak cache which is invalidated
frequently

**Solution:** Make the cache strong, and invalidate it manually when
necessary (that is, when `rtp` is changed or `query.set()` is called)

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2025-01-12 16:44:24 +01:00
Christian Clason
40bf23adaf build(deps): bump wasmtime to v25.0.3 2025-01-12 12:57:07 +01:00
Christian Clason
bf58b757c4 vim-patch:9.1.1007: filetype: various ignore are not recognized
Problem:  filetype: various ignore are not recognized
Solution: detect rg/docker/npm/vvsce ignore files as 'gitgnore' filetype
          (Wu, Zhenyu)

Not only prettier, but many programs also support ignore files (like rg,
docker, npm, vscode). So use the gitignore filetype for them due to same syntax

closes: vim/vim#16428

8cbe2e0a0a

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-01-12 12:01:24 +01:00
zeertzjq
1a8a48d7e5
vim-patch:9.1.1003: [security]: heap-buffer-overflow with visual mode (#31971)
Problem:  [security]: heap-buffer-overflow with visual mode when
          using :all, causing Vim trying to access beyond end-of-line
          (gandalf)
Solution: Reset visual mode on :all, validate position in gchar_pos()
          and charwise_block_prep()

This fixes CVE-2025-22134

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-5rgf-26wj-48v8

c9a1e257f1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-12 00:25:57 +00:00
zeertzjq
37316fbac6
vim-patch:9.1.1005: completion text is highlighted even with no pattern found (#31973)
Problem:  completion text is highlighted even with no pattern found
Solution: use ins_compl_leader_len() instead of checking
          compl_leader.length (glepnir)

closes: vim/vim#16422

9fddb8ae77

Co-authored-by: glepnir <glephunter@gmail.com>
2025-01-12 08:04:25 +08:00
zeertzjq
88dca6a835
vim-patch:partial:9598a63: runtime(doc): add package-<name> helptags for included packages (#31972)
Improve how to find the justify package

closes: vim/vim#16420

9598a6369b

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Peter Benjamin <petermbenjamin@gmail.com>
2025-01-12 07:43:58 +08:00
Gregory Anders
a119aae4d3
feat(diagnostic)!: filter diagnostics by severity before passing to handlers (#30070)
BREAKING CHANGE: This changes the list of diagnostics that are passed to
a diagnostic handler. If a handler is already filtering by severity
itself then this won't break anything, since the handler's filtering
will become a no-op. But handlers which depend on receiving the full
list of diagnostics may break.

Note that diagnostics are only filtered if the handler's configuration
has the `severity` option set. If `severity` is not set, the handler
still receives the full list of diagnostics.
2025-01-11 12:54:43 -06:00
Christian Clason
9e0d40f7e4 vim-patch:668e9f2: runtime(filetype): don't detect string interpolation as angular
fixes: vim/vim#16375

668e9f2403

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-11 11:20:19 +01:00
dundargoc
6a425e7045 docs: misc
Co-authored-by: Axel <axelhjq@gmail.com>
Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
Co-authored-by: Daiki Noda <sys9kdr@users.noreply.github.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Jean-Jacq du Plessis <1030058+jj-du-plessis@users.noreply.github.com>
Co-authored-by: Juan Giordana <juangiordana@gmail.com>
Co-authored-by: Lincoln Wallace <locnnil0@gmail.com>
Co-authored-by: Matti Hellström <hellstrom@scm.com>
Co-authored-by: Steven Locorotondo <steven.locorotondo@justeattakeaway.com>
Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: ifish <fishioon@live.com>
2025-01-11 10:34:12 +01:00
zeertzjq
c060a6ea64
vim-patch:9.1.1001: ComplMatchIns highlight hard to read on light background (#31958)
Problem:  ComplMatchIns highlight hard to read on light background
          (after v9.1.0996)
Solution: define the highlighting group cleared, it should be configured in
          colorschemes separately (glepnir)

closes: vim/vim#16414

ad409876d9

Co-authored-by: glepnir <glephunter@gmail.com>
2025-01-11 09:08:01 +08:00
zeertzjq
df45b336f5
vim-patch:695522d: runtime(vim): Update base-syntax, highlight literal string quote escape (#31957)
Match the '' escape sequence in literal strings.  These were previously
ending the current string and starting another concatenated literal
string.

closes: vim/vim#16415

695522dea3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-01-11 08:27:50 +08:00
glepnir
fbe546e25d
vim-patch:9.1.0996: ComplMatchIns may highlight wrong text (#31931)
Problem:  ComplMatchIns may highlight wrong text
Solution: don't highlight in case of fuzzy match,
          skip-highlight when not inserting anything
          (glepnir)

closes: vim/vim#16404

e890887b80
2025-01-10 23:58:45 +00:00
Christian Clason
dcaf9a60e9 vim-patch:51754c8: runtime(editorconfig): set omnifunc to syntaxcomplete func
closes: vim/vim#16419

51754c8a49

Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-01-11 00:44:06 +01:00
Guilherme Soares
aa2b44fbb0
fix(treesitter): don't return error message on success #31955
Problem:
The `vim.treesitter.language.add` function returns
a error message even when it succeeds.

Solution:
Don't return error message on success.
2025-01-10 14:46:19 -08:00
luukvbaal
37c77ab46b
fix(messages): attaching/detaching ext_messages causes asserts #31952
Problem:  Assert hit related to message kind, which is reset after a
          ext_messages UI is forcibly detached, so the assertion is
          expectedly false. Assert hit related to message grid variables
          after an ext_messages UI attaches while message grid is scrolled.
Solution: Don't check message kind assertion if no ext_messages UI is
          attached. Flush message grid when first/last ext_messages UI
          attaches/detaches.
2025-01-10 14:43:45 -08:00
Riley Bruins
cb02c20569 refactor(treesitter.foldexpr): remove unused parse_injections parameter 2025-01-10 22:06:35 +00:00
Justin M. Keyes
0717dfbfaf
refactor(api): deprecate nvim_notify #31938
Problem:
The `nvim_notify` API (note: unrelated to `vim.notify()` Lua API) was
not given any real motivation in https://github.com/neovim/neovim/pull/13843

There are, and were, idiomatic and ergonomic alternatives already.

Solution:
Deprecate `nvim_notify`.
2025-01-10 11:42:04 -08:00
zeertzjq
b06f42b502
vim-patch:df4a7d7: runtime(tiasm): use correct syntax name tiasm in syntax script (#31942)
vim-patch:df4a7d7: runtime(tiasm):  use correct syntax name tiasm in syntax script

closes: vim/vim#16416

df4a7d7617

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-01-10 17:17:34 +08:00
Luuk van Baal
87610d82db fix(decor): set invalid flag for end of invalidated paired marks 2025-01-10 08:14:38 +01:00
zeertzjq
a37784ad83
vim-patch:9.1.1000: tests: ruby tests fail with Ruby 3.4 (#31940)
Problem:  tests: ruby tests fail with Ruby 3.4
Solution: adjust expected output for Ruby 3.4
          (Yee Cheng Chin)

Vim's Ruby tests relied on explicit matching of output texts which are
fragile in design. Ruby 3.4 has changed the output slightly (using
'name' instead of `name', and also using more spaces in dictionary
printouts). Modify the Vim tests to be less fragile to such changes.

closes: vim/vim#16411

ebea31e454

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-01-10 08:04:02 +08:00
zeertzjq
846a2019c0
vim-patch:9.1.0999: Vim9: leaking finished exception (#31939)
Problem:  leaking finished exception
          (after v9.1.0984)
Solution: use finish_exception to clean up caught exceptions
          (Yee Cheng Chin)

In Vimscript, v:exception/throwpoint/stacktrace are supposed to reflect
the currently caught exception, and be popped after the exception is
finished (via endtry, finally, or a thrown exception inside catch).
Vim9script does not handle this properly, and leaks them instead. This
is clearly visible when launching GVim with menu enabled.  A caught
exception inside the s:BMShow() in menu.vim would show up when querying
`v:stacktrace` even though the exception was already caught and handled.

To fix this, just use the same functionality as Vimscript by calling
`finish_exception` to properly restore the states. Note that this
assumes `current_exception` is always the same as `caught_stack` which
believe should be the case.

Added tests for this. Also fix up test_stacktrace to properly test the
stack restore behavior where we have nested exceptions in catch blocks
and to also test the vim9script functionality properly.

- Also, remove its dependency on explicitly checking a line number in
  runtest.vim which is a very fragile way to write tests as any minor
  change in runtest.vim (shared among all tests) would require changing
  test_stacktrace.vim. We don't actually need such granularity in the
  test.

closes: vim/vim#16413

2051af1642

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-01-10 08:03:44 +08:00
Justin M. Keyes
7c00e0efbb
docs: misc #31867 2025-01-09 09:26:45 -08:00
Riley Bruins
0c296ab224
feat(docs): "yxx" runs Lua/Vimscript code examples #31904
`yxx` in Normal mode over a Lua or Vimscript code block section will execute the code.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-01-09 08:36:16 -08:00
Famiu Haque
1e47aa677a
fix(api): deprecated API nvim_get_option does not validate option name #31919
Problem:
Deprecated API `nvim_get_option()` doesn't validate the option name,
which leads to an assertion failure.

Solution:
Validate option name in `nvim_get_option()`.

Ref: #31894
2025-01-09 07:32:27 -08:00
Justin M. Keyes
5135a23219
Merge #31900 from luukvbaal/nvim_echo 2025-01-09 06:36:29 -08:00
bfredl
dcaf8bef08
Merge pull request #31844 from bfredl/iter_crash
fix(decoration): fix crash when on_lines decor provider modifies marktree
2025-01-09 13:37:28 +01:00
Luuk van Baal
5c92b40b4b feat(api): deprecate nvim_out/err_write(ln) 2025-01-09 13:35:42 +01:00
Luuk van Baal
ead5683ff9 feat(api): add err field to nvim_echo() opts
Problem:  We want to deprecate `nvim_err_write(ln)()` but there is no
          obvious replacement (from Lua). Meanwhile we already have
          `nvim_echo()` with an `opts` argument.
Solution: Add `err` argument to `nvim_echo()` that directly maps to
          `:echoerr`.
2025-01-09 13:35:40 +01:00
bfredl
6dd7fcaafd
Merge pull request #31898 from bfredl/termbomb
fix(terminal): don't crash on unprintable chars
2025-01-09 13:35:25 +01:00
bfredl
f8c8a245aa fix(terminal): don't crash on unprintable chars
fixes #31897
2025-01-09 11:22:00 +01:00
bfredl
33ff546b50 fix(decoration): fix crash when on_lines decor provider modifies marktree
If a "on_lines" callback changes the structure of the marktree, the
iterator (which is used for an entire window viewport) might now
point to invalid memory. Restore the iterator to the beginning of the
line in this case.

fixes #29484
2025-01-09 11:17:42 +01:00
zeertzjq
3f0adf90de
vim-patch:9.1.0998: filetype: TI assembly files are not recognized (#31929)
Problem:  filetype: TI assembly files are not recognized
Solution: inspect '*.sa' and assembly files and detect TI assembly
          files, include filetype plugin and syntax script for TI
          assembly files (Wu, Zhenyu)

closes: vim/vim#15827

4f73c07abf

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-01-09 17:30:26 +08:00
Christian Clason
d740a4274d vim-patch:8ab1819: runtime(xf86conf): add section name OutputClass to syntax script
References:
https://man.archlinux.org/man/xorg.conf.5#DESCRIPTION

closes: vim/vim#16397

8ab1819df6

Co-authored-by: Jan-Arvid Harrach <jharrach@tutanota.com>
2025-01-09 08:07:30 +01:00
zeertzjq
5f85e78db3
vim-patch:9.1.0997: too many strlen() calls in drawscreen.c (#31927)
Problem:  too many strlen() calls in drawscreen.c
Solution: refactor drawscreen.c and remove calls to strlen(),
          make get_keymap_str() (in screen.c) return string length
          instead of TRUE/FALSE (John Marriott).

a21240b97d

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-01-09 12:49:45 +08:00