Commit Graph

33225 Commits

Author SHA1 Message Date
76de3e2d07 docs(api): document types using LuaCATS types
- Render Lua types in api.txt.

- Added `DictAs(name)` API type which acts the same as `Dict` (no parens)
  when generating the dispatchers, but acts the same as `Dict(name)`
  when generating docs.

- Added `Tuple(...)` API type which is the treated the as `Array` for
  generating the dispatchers, but is used to document richer types.

- Added `Enum(...)` API type to better document enums

- Improve typing of some API functions.

- Improve c_grammar to properly parse API types and replace string pattern
  logic in the parsers.

- Removed all the hardcoded type overrides in gen_eval_files.lua
2025-06-26 13:54:04 +01:00
3eaa6c5a66 fix(lsp): add RequestFailed error code constant #34645
Also remove `serverErrorStart/End` as [the spec](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#errorCodes)
says that they're deprecated and don't even represent a real error code.
2025-06-26 02:23:31 -07:00
b40e658717 fix(column): missing redraw with virt_lines_leftcol (#34650)
Problem:  Missing number column redraw with virt_lines_leftcol.
Solution: Set virt_line_index to -1 when skipping a virtual line.
2025-06-26 05:16:19 +00:00
f0757ee590 refactor(ui.c): deduplicate validation logic #34647 2025-06-26 00:15:04 +00:00
e5dae58704 vim-patch:037c32e: runtime(vim): Update base-syntax, match unamed register alias (#34648)
The unamed register may be referenced as both @" and @@.

Remove the unused vimPlainRegister syntax group.

fixes: vim/vim#17603.
closes: vim/vim#17605

037c32e428

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-26 00:14:31 +00:00
c730374d44 vim-patch:fa0b069: runtime(doc): improve documentation style in editing.txt (#34646)
Usually, Vim's document provides example code after explanations.
However some part of the editing.txt doesn't follow the style, therefore
this commit modifies it so that it follows the usual style.

closes: vim/vim#17607

fa0b069728

Co-authored-by: mityu <mityu.mail@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-26 00:02:53 +00:00
731e616a79 fix(vim.system): clear_env=true gives an invalid env to uv.spawn #33955
Problem:
In setup_env, some needed logic is bypassed when clear_env=true.

Solution:
Drop the early return in setup_env().

Co-authored-by: BirdeeHub <birdee@localhost>
2025-06-25 15:15:19 -07:00
4369d7d9a7 fix(ui)!: decouple ext_messages from message grid #27963
Problem:  ext_messages is implemented to mimic the message grid
          implementation w.r.t. scrolling messages, clearing scrolled
          messages, hit-enter-prompts and replacing a previous message.
          Meanwhile, an ext_messages UI may not be implemented in a way
          where these events are wanted. Moreover, correctness of these
          events even assuming a "scrolled message" implementation
          depends on fragile "currently visible messages" global state,
          which already isn't correct after a previous message was
          supposed to have been overwritten (because that should not only
          happen when `msg_scroll == false`).

Solution: - No longer attempt to keep track of the currently visible
            messages: remove the `msg_ext(_history)_visible` variables.
            UIs may remove messages pre-emptively (timer based), or never
            show messages that don't fit a certain area in the first place.
          - No longer emit the `msg(_history)_clear` events to clear
            "scrolled" messages. This opens up the `msg_clear` event to
            be emitted when messages should actually be cleared (e.g.
            when the screen is cleared). May also be useful to emit before
            the first message in an event loop cycle as a hint to the UI
            that it is a new batch of messages (vim._extui currently
            schedules an event to determine that).
          - Set `replace_last` explicitly at the few callsites that want
            this to be set to true to replace an incomplete status message.
          - Don't store a "keep" message to be re-emitted.
2025-06-25 08:25:40 -07:00
0694ca8822 fix: map wincmd instead of remap #34635
Same issue: a59b052857
2025-06-25 06:33:58 -07:00
684be736c1 ci: bump luals to 3.15.0 2025-06-25 12:27:00 +02:00
5ae41ddde3 feat(prompt): prompt_getinput() gets current input #34491
Problem:
Not easy to get user-input in prompt-buffer before the user submits the
input. Under the current system user/plugin needs to read the buffer
contents, figure out where the prompt is, then extract the text.

Solution:
- Add prompt_getinput().
- Extract prompt text extraction logic to a separate function
2025-06-24 12:42:16 -07:00
efd0fa55c8 fix(cmdline): validate 'incsearch' cursor for "cmdline_show" redraw (#34630)
Problem:  "cmdline_show" event may be emitted with an invalid cursor
          position, causing a redraw that will clear the match highlight.
Solution: Mark the cursor position as valid so that a "cmdline_show"
          callback that updates the screen does not clear the match highlight.
2025-06-24 16:37:51 +02:00
25000be845 fix(prompt): "%" prefix repeated on newlines with formatoptions+=r #34584
Problem:
With `formatoptions+=r`, the prompt prefix "%" is treated as
comment-start (because of global default 'comments' option contains
"%"), so it gets added to the start of the line when a new line
is input in a prompt.

Solution:
Unset the 'comments' option in prompt buffers by default.
2025-06-24 06:52:24 -07:00
5871d26779 fix(autocmd): 'cmdheight' OptionSet with valid window grids (#34619)
Problem:  OptionSet autocmd emitted with invalid grids after entering
          tabpage with different 'cmdheight'.
Solution: First call `tabpage_check_windows()` before changing 'cmdheight'.
          Add a test that exercises the `vim._extui` cmdline.
2025-06-24 10:25:46 +02:00
6b6a4518c2 vim-patch:159d392: runtime(java): Complement the recognition of type parameter sections
In addition to matching type parameter sections of generic
classes and records and interfaces, match such sections of
generic methods and constructors.  As before, opt for it by
defining "g:java_highlight_generics"; the diamond form still
does not qualify for this kind of recognition.

And make section patterns agree with one another in syntax
items.

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.5
https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.4.4
https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.8.4

159d392427

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-06-24 10:23:00 +02:00
7f3249fa0d vim-patch:9.1.1476: missing out-of-memory checks in cmdexpand.c (#34624)
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add missing out-of-memory checks, re-order code
          (John Marriott)

This commit does the following:
- in cmdline_pum_create() add out-of-memory check call of ALLOC_MULT()
- in expand_cmdline() move check for out-of-memory to cover both
  assignments of file_str
- in nextwild() don't free `p2` until after it's last use.

closes: vim/vim#17592

1be5b375c4

N/A patch:
vim-patch:9.1.1474: missing out-of-memory check in mark.c

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-06-24 07:51:20 +08:00
69c379dc44 fix(quickfix): use correct lnume when appending (#34611)
Problem: ml_get error when updating quickfix buffer with nvim_buf_attach
Solution: use correct lnume parameter in changed_lines for append mode

Fix #34610
2025-06-23 23:48:55 +00:00
92883b918c vim-patch:a931371: runtime(vim): Update base-syntax, match OR operator in :echo and :execute (#34623)
Don't match the OR operator in expressions as a trailing bar.

closes: vim/vim#17533

a931371694

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 23:17:43 +00:00
40c61bf205 refactor(lsp): use vim.lsp.buf_request_all internally (#34604) 2025-06-23 13:15:25 -04:00
6942dec9b2 fix(health): highlight group conflicts with help #34616 2025-06-23 09:23:27 -07:00
fb5a51e775 fix(tui): avoid memory leak and compiler warning on Windows (#34225)
Problem:  On Windows, the value of `term` is overwritten without freeing
          the old allocated value, which may lead to a memory leak.
	  GCC also gives a "incompatible pointer type" warning about
	  passing `*term` to os_tty_guess_term().
Solution: Don't override the old allocated value, and copy the guessed
          value to `term` if its old value is NULL.
2025-06-23 22:07:52 +08:00
835f11595f feat(lsp): support annotated text edits (#34508) 2025-06-23 06:30:49 -07:00
a5c55d200b fix(cmd): bar "|" not allowed after :fclose #34613
Problem: `:fclose` command failed when used with trailing `|` bar.
Solution: Add `TRLBAR` flag to fclose command to support trailing bar.
2025-06-23 05:41:31 -07:00
462f7aaa8e vim-patch:a9b95c3: runtime(doc): remove wrong documentation of the :digraph command (#34608)
fixes: vim/vim#17583

a9b95c3d33

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-23 09:06:38 +08:00
534ec8d447 vim-patch:9.1.1475: completion: regression when "nearest" in 'completeopt' (#34607)
Problem:  completion: regression when "nearest" in 'completeopt'
Solution: fix compare function (Girish Palya)

closes: vim/vim#17577

cd68f21f60

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-23 07:56:47 +08:00
30f650420b Merge pull request #34606 from zeertzjq/vim-99b9847
vim-patch: Vim syntax updates
2025-06-23 07:44:26 +08:00
233014f3ed vim-patch:dcff497: runtime(vim): Update base-syntax, match bare mark ranges
Remove unmatchable :normal {mark,register} matches. The arg to :normal
is now handled separately and contained marks and registers are no
longer matched.

closes: vim/vim#17571

dcff497373

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 07:23:21 +08:00
69ef85a533 vim-patch:99b9847: runtime(vim): Update base-syntax, fix Vim9 :import expression comment handling
The required space in Vim9 continuation comments (#\ comment) was
accidentally removed in commit 6acca4b as trailing whitespace.

closes: vim/vim#17573

99b9847bd8

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 07:22:53 +08:00
cfb4d3d2f2 docs(treesitter): fix parameter list for Query:iter_matches (#34553) 2025-06-22 10:38:00 +00:00
ee2fc31b36 vim-patch:9.1.1473: inconsistent range arg for :diffget/diffput (#34588)
Problem:  inconsistent range arg for :diffget/diffput
Solution: fix the range specification, place the cursor for :diffput and
          :diffget consistently on the last line (Yee Cheng Chin)

Previously, `:<range>diffget` only allowed using 1 or above in the range
value, making it impossible to use the command for a diff block at the
beginning of the file. Fix the range specification so the user can now
use 0 to specify the space before the first line. This allows
`:0,$+1diffget` to work to retrieve all the changes from the other file
instead of missing the first diff block. Also do this for `:diffput`.

Also, make `:diffput` work more similar to `:diffget`. Make it so that
if the cursor is on the last line and a new line is inserted in the
other file, doing `:diffput` will select that diff block below the line,
just like `:diffget` would.

Also clean up the logic a little bit for edge cases and for handling
line matched diff blocks better.

closes: vim/vim#17579

d75ab0cbf5

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-06-22 08:00:17 +08:00
0980617c0d build(msvc): suppress msvc build warning for different enum types (#34591)
Problem: Currently our CI is failing due to msvc warning 5287. This
warning tells us that we are performing a binary expression with enums
of two different types. In this case however, this is clearly intended
and valid.

Solution: Suppress warning 5287 on the line this occurs.
2025-06-22 06:54:51 +08:00
d0aedd36df fix(extui): set 'modifiable', 'noswapfile' for buffers (#34582)
Problem:  UI buffers may be 'unmodifiable' and use a 'swapfile'.
Solution: Set the 'modifiable' and 'noswapfile' options.

Co-authored-by:phanium <91544758+phanen@users.noreply.github.com>
2025-06-20 17:32:07 +02:00
cacb4ceeb4 test(prompt): nvim_paste in prompt buffer #34583 2025-06-20 07:07:27 -07:00
927dc3c2c4 vim-patch:476b65e: runtime(doc): mention using <script> instead of <sfile> in :autocmd (#34580)
fixes: vim/vim#17569

476b65ebac
2025-06-19 23:08:01 +00:00
528381587b refactor(lsp): redesign LSP folding state #34469 2025-06-19 06:23:40 -07:00
0dc900d744 fix(lsp): clear document_color autocmds #34573
**Problem:** When enabling document_color multiple times for the same
buffer (or when toggling it on and off), duplicate autocmds are created
since the previous ones are not cleared.

**Solution:** Clear the appropriate buffer-local autocmds when
enabling/disabling document color functionality.
2025-06-19 03:48:12 -07:00
150513a163 fix(lsp) type annotation for vim.lsp.Config.cmd #34574
The type annotation for `vim.lsp.ClientConfig.cmd` was changed,
but the update was not propagated to `vim.lsp.Config`.
2025-06-19 03:35:13 -07:00
487112d674 vim-patch:9.1.1468: filetype: bright(er)script files are not recognized
Problem:  filetype: bright(er)script files are not recognized
Solution: detect *.bs files as brighterscript filetype and *.brs as
          brightscript filetype, include filetype plugins (Riley Bruins)

closes: vim/vim#17566

03e5ee25fd

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:38 +02:00
2379fb053a vim-patch:8b92af6: runtime(hgcommit): set comments and commentstring options in filetype plugin
closes: vim/vim#17480

8b92af645c

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:26 +02:00
255f313cf6 vim-patch:736cd18: runtime(ishd): set comments and commentstring options in filetype plugin
closes: vim/vim#17490

736cd18671

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:26 +02:00
f038213617 vim-patch:e4c157b: runtime(nroff,groff): update commentstyle in filetype plugins
closes: vim/vim#17516

e4c157b9c1

Co-authored-by: jtmr05 <62111562+jtmr05@users.noreply.github.com>
2025-06-19 11:10:26 +02:00
fb8dba413f vim-patch:9.1.1467: too many strlen() calls (#34572)
Problem:  too many strlen() calls
Solution: Change expand_env() to return string length
          (John Marriott)

This commit does the following changes:
- In expand_env_esc():
  - return the length of the returned dst string.
  - refactor to remove some calls to STRLEN() and STRCAT()
  - add check for out-of-memory condition.
- Change call sites in various source files to use the return value

closes: vim/vim#17561

fff0132399

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-06-19 02:21:33 +00:00
8ed6f00ab0 vim-patch:9.1.1471: completion: inconsistent ordering with CTRL-P (#34571)
Problem:  completion: inconsistent ordering with CTRL-P
          (zeertzjq)
Solution: reset compl_curr_match when using CTRL-P (Girish Palya)

fixes: vim/vim#17425
closes: vim/vim#17434

5fbe72edda

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-19 09:24:13 +08:00
0456d75517 vim-patch:8311e7d: runtime(vim): fix incorrect highlighting of User autocmds (#34570)
There is no pattern after the user event name. The user event name is
the pattern.

closes: vim/vim#17568

8311e7d6b4
2025-06-18 23:49:15 +00:00
3594c213a7 fix(diagnostics): validate opts.signs #34565 2025-06-18 10:26:28 -07:00
8e17b72094 docs: vim_diff.txt #34502
Problem:
- Missing some important Vim features
- Since Nvim 0.5, package.path and package.cpath don't include
  `'runtimepath'` (thought `require()` can still find modules in
  `runtimepath`)

Closes #33938

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-06-18 06:19:00 -07:00
5cf135f9a0 vim-patch:9.1.1466: filetype: not all lex files are recognized
Problem:  filetype: not all lex files are recognized
Solution: detect *.ll as lex, llvm or lifelines filetype, depending on
          the content (Eisuke Kawashima)

closes: vim/vim#17560

48295111e5

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-18 14:37:06 +02:00
32f30c4874 feat(lsp): pass resolved config to cmd() #34550
Problem:
In LSP configs, the function form of `cmd()` cannot easily get the
resolved root dir (workspace). One of the main use-cases of a dynamic
`cmd()` is to be able to start a new server  whose binary may be located
*in the workspace* ([example](https://github.com/neovim/nvim-lspconfig/pull/3912)).

Compare `reuse_client()`, which also receives the resolved config.

Solution:
Pass the resolved config to `cmd()`.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-06-18 04:52:17 -07:00
aa8c86e8f3 Merge #34541 docs 2025-06-18 03:46:28 -07:00
237bb9cb59 docs(ui): type annotations for options #33983 2025-06-18 03:20:18 -07:00