Commit Graph

31598 Commits

Author SHA1 Message Date
Gregory Anders
819337a13f test: use esc sequences in vterm unit tests 2025-01-16 16:41:37 -06:00
Gregory Anders
6f0bde11cc feat(terminal): add support for kitty keyboard protocol
This commit adds basic support for the kitty keyboard protocol to
Neovim's builtin terminal. For now only the first mode ("Disambiguate
escape codes") is supported.
2025-01-16 16:41:08 -06:00
luukvbaal
bbf36ef8ef
fix(cmdline): prevent cmdline_show events after exiting cmdline #32033
Problem:  If a (vim.ui_attach) cmdline_hide callback triggers a redraw,
          it may cause cmdline_show events for an already exited cmdline.
Solution: Avoid emitting cmdline_show event when ccline.cmdbuff is
          already NULL. Unset ccline.cmdbuff before emitting cmdline_hide.
2025-01-15 06:55:21 -08:00
luukvbaal
5cc93ef472
fix(marks): revise metadata for start mark of revalidated pair #32017
Problem:  Metadata may be revised for end mark of a revalidated pair.
Solution: Revise metadata for start mark of a revalidated pair.
2025-01-15 02:38:45 -08:00
Evgeni Chasnovski
09bcb31068
fix(docs): replace yxx mappings with g== #31947
Problem:
`yx` uses "y" prefix, which shadows a builtin operator.

Solution:
Use `g=` (in the form of `g==` currently), drawing from precedent of
CTRL-= and 'tpope/vim-scriptease'.
2025-01-15 02:36:00 -08:00
Justin M. Keyes
9552fe7ef9
Merge #32013 from luukvbaal/shellkind 2025-01-15 02:23:44 -08:00
Justin M. Keyes
3ee63edc1b
Merge #32001 from MariaSolOs/consistent-namespaces 2025-01-15 02:01:44 -08:00
Andrew Braxton
0a7e4e9e5f
fix(lsp): vim.lsp.enable(...,false) does not disable #32002
Problem:
Per the documentation, passing `false` as the `enable` parameter of
`vim.lsp.enable()` should disable the given LSP(s), but it does not work
due to a logic error.

Specifically, `enable == false and nil or {}` will always evaluate to
`{}` because `nil` is falsy.

Solution:
Correct the conditional statement.
2025-01-15 01:58:36 -08:00
Luuk van Baal
d55b17e2b4 fix(messages): verbose kind for nvim_echo()
Problem:  No "verbose" kind for nvim_echo() opts->verbose.
Solution: Pass NULL "kind" to indicate no new kind.
2025-01-15 10:51:55 +01:00
Luuk van Baal
5bae80899d feat(messages): add :!cmd shell message kinds
Also print stderr error messages with ErrorMsg highlight group.
2025-01-15 10:51:52 +01:00
Christian Clason
bc69f27237 vim-patch:045564d: runtime(colors): Update colorschemes, include new unokai colorscheme
- new unokai colorscheme (similar/inspired by monokai)
- the rest: add explicit PopupSelected link to PmenuSel

closes: vim/vim#16443

045564d0a7

Co-authored-by: Maxim Kim <habamax@gmail.com>
2025-01-15 09:48:55 +01:00
Maria José Solano
575f4bc7d5 docs: document namespace/augroup convention 2025-01-14 21:25:25 -08:00
Maria José Solano
09e01437c9 refactor: use nvim.foo.bar format for autocommand groups 2025-01-14 21:25:25 -08:00
zeertzjq
a78eddd541
vim-patch:9.1.1015: Coverity complains about dereferencing NULL value (#32020)
Problem:  Coverity complains about dereferencing NULL value
Solution: Check that cms2 is not null

closes: vim/vim#16438

1ac53b84ad

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-01-15 12:05:00 +08:00
Maria José Solano
850084b519 refactor: use nvim.foo.bar format for namespaces 2025-01-14 19:55:29 -08:00
Mike
611ef35491
feat(vim.fs): find(), dir() can "follow" symlinks #31551
Problem:
vim.fs.dir(), vim.fs.find() do not follow symlinks.

Solution:
- Add "follow" flag.
- Enable it by default.
2025-01-14 16:39:17 -08:00
Gregory Anders
e8a6c1b021
fix(lsp): schedule call to vim.lsp.start for async root_dir (#31998)
When `root_dir` is a function it can (and often will) call the provided
callback function in a fast API context (e.g. in the `on_exit` handler
of `vim.system`). When the callback function is executed we should
ensure that it runs vim.lsp.start on the main event loop.
2025-01-14 08:19:54 -06:00
Gregory Anders
f1c45fc7a4
feat(terminal): support theme update notifications (DEC mode 2031) (#31999) 2025-01-14 08:18:59 -06:00
bfredl
7eabc8899a
Merge pull request #31932 from bfredl/termtab
fix(getchar): do not simplify keycodes in terminal mode
2025-01-14 14:46:34 +01:00
luukvbaal
25d8c3a5ad
feat(api): nvim_open_win() relative to tabline and laststatus #32006
Problem:  Anchoring a floating window to the tabline and laststatus is
          cumbersome; requiring autocommands and looping over all
          windows/tabpages.
Solution: Add new "tabline" and "laststatus" options to the `relative`
          field of nvim_open_win() to place a window relative to.
2025-01-14 05:02:46 -08:00
Christian Clason
e8ddb7a469 vim-patch:30377e0: runtime(lyrics): support milliseconds in syntax script
The following tool creates LRC files using three fractional digits after
the seconds (i.e. milliseconds).

References:
https://github.com/magic-akari/lrc-maker
https://lrc-maker.github.io/

closes: vim/vim#16436

30377e0fe0

Co-authored-by: Denilson Sá Maia <denilsonsa@gmail.com>
2025-01-14 13:23:02 +01:00
zeertzjq
69ad6b12ec
vim-patch:9.1.1010: filetype: VisualCode setting file not recognized (#32003)
Problem:  filetype: VisualCode setting file not recognized
Solution: detect json files in VSCode config directory as jsonc filetype
          (Konfekt)

closes: vim/vim#16400

c200f53cbb

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-01-14 18:55:06 +08:00
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