9136 Commits

Author SHA1 Message Date
38aac21083 fix: type of nvim_echo 2025-07-01 12:57:37 +01:00
f731766474 Merge #34715 vim.version improvements 2025-07-01 04:19:42 -07:00
af6b3d6fec vim-patch:a5b744e: runtime(vim): Update base-syntax, improve :syn-sync line defaults (#34719)
Set minlines and maxlines to 100 and 200 respectively.  Set these after
the script interface syntax files have been loaded to ensure the values
set in those are overridden.

fixes vim/vim#17580
closes: vim/vim#17614

a5b744ef93

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-30 23:29:54 +00:00
773075b2bc feat(vim.version): add vim.version.intersect()
Problem: No way to compute intersection of two version ranges, which is
useful when computing version range that fits inside several reference
ranges.

Solution: Add `vim.version.intersect()`.
2025-06-30 20:59:44 +03:00
649ff924d9 fix(vim.version): improve construction of '<=a.b.c' and '>a.b.c' ranges
Problem: `vim.version.range('<=a.b.c')` is not precise when it comes to
its right hand side. This is due to version ranges using exclusive right
hand side. While `vim.version.range('>a.b.c')` is not precise when it
comes to its left hand side because left hand sides are inclusive.

Solution: For '>=a.b.c' increase `to` from 'a.b.c' to the smallest
reasonable version that is bigger than 'a.b.c'. For '<a.b.c' do the same
for `from`.
More proper solution is an explicit control over inclusivity of version
range sides, but it has more side effects and requires design decisions.
2025-06-30 20:59:12 +03:00
4034476dd3 doc(vim.version): options formatting #34716 2025-06-30 09:55:29 -07:00
aeb8bca12d feat(vim.version): make tostring() return human-readable version range
Problem: `tostring()` applied to version range doesn't return
human-readable text with information about the range.

Solution: Add `__tostring()` method.
2025-06-30 16:08:56 +03:00
561021bacd docs(vim.version): document vim.VersionRange as a dedicated class 2025-06-30 16:08:30 +03:00
f7c939fa7a fix(exrc): exrc knows its own location (#34638)
fix(exrc): lua exrc files know their location

Problem:
'exrc' files are inherently bound to their location / workspace and
therefore require to "know" their location on the filesystem. However,
currently using `debug.getinfo(1, 'S')` returns `"<nvim>"`.

Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
2025-06-29 10:19:10 -05:00
2f95abddfa refactor(health): use vim.system():wait() #34702
Problem:
- The ripgrep probe still used the legacy `vim.fn.system()`

Solution:
- Replace `vim.fn.system()` with `vim.system({rg_path, '-V'}):wait()`
2025-06-29 14:56:44 +00:00
63a7b92e58 vim-patch:1fa3f0c: runtime(doc): fix :vmap example to avoid unwanted spaces with JJ (#34695)
fixes: vim/vim#17621
closes: vim/vim#17623

1fa3f0c215

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-29 08:01:12 +08:00
bff7d3fd9f fix(tutor): cannot find tutors in pack/*/start/* #34689
Problems:
- Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`)
- This means that the tutor plugin cannot find the tutors in pack/*/start/*

Solution:
- Use nvim_list_runtime_paths() instead of &rtp
2025-06-28 09:40:24 -07:00
f1f106be3d vim-patch:9.1.1421: tests: need a test for the new-style tutor.tutor (#34267)
Problem:  tests: need a test for the new-style tutor.tutor, patch
          9.1.1384 broke the expected positions for the signs
Solution: Update all number keys in tutor.tutor.json to match the
          correct line numbers in tutor.tutor, replace tabs by spaces,
          add a screen-dump test to verify it does not regress
          (Pham Bình An)

closes: vim/vim#17416

a541f1de2b
2025-06-28 07:42:51 +00:00
c752016976 vim-patch:0312527: runtime(pandoc): sync syntax script with upstream
closes: vim/vim#17598

03125277e9

Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com>
2025-06-28 00:13:57 +02:00
4ee2e365a5 fix(lsp): fix workspace diagnostic request to follow spec (#34674)
* fix(lsp): fix workspace diagnostic request to follow spec

* refactor(lsp): add type annotation
2025-06-27 19:17:41 +00:00
f2988e05db feat(extui): don't enter pager for routed message #34679
Problem:  Messages routed to the pager to be shown in full, enter the
          pager automatically, yielding another "press-q-prompt".

Solution: Only enter the pager when requested explicitly. Otherwise,
          close the pager on the next typed mapping, unless that mapping
          entered the pager.
2025-06-27 12:13:01 -07:00
bfe42c84de perf(extui): delay creating windows, buffers and parser (#34665)
Problem:  vim._extui unconditionally creates windows, buffers and the
          Vimscript cmdline highlighter when it is first loaded.
Solution: Schedule first creation of the window so that first redraw
          happens sooner (still need to create at least the cmdline
          window asap as it can have a different highlight through
          hl-MsgArea; thus further delaying until the first event that
          needs a particular target seems redundant). Load the cmdline
          highlighter on the first cmdline_show event.
2025-06-27 15:54:32 +02:00
e518666f1d vim-patch:5d14da3: runtime(diff): fix regex for matching no-eol match
closes: vim/vim#17610

5d14da3690

Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
2025-06-27 09:56:07 +02:00
2b4c1127ad feat(ui): emit "msg_clear" event after clearing the screen (#34035)
Problem:  ext_messages cannot tell when the screen was cleared, which is
          needed to clear visible messages. An empty message is also
          never emitted, but clears messages from the message grid.
Solution: Repurpose the "msg_clear" event to be emitted when the screen
          was cleared. Emit an empty message with the `empty` kind to
          hint to a UI to clear the cmdline area.
2025-06-26 22:27:21 +00:00
6005bc68b2 fix(lsp): include context for each client in multi-handler results (#34669) 2025-06-26 15:18:20 -04:00
f0c0c24ed7 fix(lsp/health): always use vim.inspect to show root_markers (#34667)
In https://github.com/neovim/neovim/pull/34092 we changed the
healthcheck to display root markers as a concatenated list if the first
item in root_markers is a string (not a table). However, this does not
solve the general case, because root_markers can contain a string as the
first element, but a table as the 2nd element.

Because root_markers has a more complex structure we should always just
display it using vim.inspect, rather than adding a special case for when
all items are a string.
2025-06-26 10:22:45 -05:00
5d06eade25 feat(defaults): map "grt" to LSP type_definition #34642 2025-06-26 06:24:13 -07:00
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
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
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
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
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
835f11595f feat(lsp): support annotated text edits (#34508) 2025-06-23 06:30:49 -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
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
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
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
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