3736 Commits

Author SHA1 Message Date
cf0f90fe14 feat(async): add vim._async
Problem: no easy built-in way to do async

Solution: add `vim._async`
2025-07-04 15:53:29 +03:00
bb75610d99 vim-patch:9.1.1507: symlinks are resolved on :cd commands (#34758)
Problem:  File paths change from symlink to target path after :cd command
          when editing files through symbolic links
Solution: Add "~" flag to 'cpoptions' to control symlink resolution.
          When not included (default), symlinks are resolved maintaining
          backward compatibility. When included, symlinks are preserved
          providing the improved behavior. (glepnir)

related: neovim/neovim#15695
closes: vim/vim#17628

4ade668fb6
2025-07-04 05:44:39 +00:00
f01419f3d5 feat(runtime): accept predicates in take and skip (#34657)
Make `vim.iter():take()` and `vim.iter():skip()`
optionally accept predicates to enable takewhile
and skipwhile patterns used in functional
programming.
2025-07-03 08:12:24 -05:00
fc1be07d28 vim-patch:9.1.1504: filetype: numbat files are not recognized
Problem:  filetype: numbat files are not recognized
Solution: detect *.nbt files as numbat filetype (0xadk)

References:
- https://github.com/sharkdp/numbat
- https://github.com/sharkdp/numbat/tree/master/numbat/modules

closes: vim/vim#17643

20eb68a8f2

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
0a14ac3261 vim-patch:9.1.1503: filetype: haxe files are not recognized
Problem:  filetype: haxe files are not recognized
Solution: detect *.hx files as haxe filetype (0xadk)

References:
- https://haxe.org/
- https://code.haxe.org/category/beginner/hello-world.html

closes: vim/vim#17644

b46e3aa0fa

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
18cfbf8fb2 vim-patch:9.1.1502: filetype: quickbms files are not recognized
Problem:  filetype: quickbms files are not recognized
Solution: detect *.bms files as quickbms filetype
          (0xadk)

Reference:
- https://aluigi.altervista.org/quickbms.htm

closes: vim/vim#17645

fdcdded4d5

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
da42f99eb4 vim-patch:9.1.1501: filetype: flix files are not recognized
Problem:  filetype: flix files are not recognized
Solution: detect *.flix files as flix filetype
          (0xadk)

References:
- https://flix.dev/
- https://doc.flix.dev/introduction.html

closes: vim/vim#17646

b211916e0a

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
168bf0024e fix(treesitter): ensure TSLuaTree is always immutable
Problem:

The previous fix in #34314 relies on copying the tree in `tree_root` to
ensure the `TSNode`'s tree cannot be mutated. But that causes the
problem where two calls to `tree_root` return nodes from different
copies of a tree, which do not compare as equal. This has broken at
least one plugin.

Solution:

Make all `TSTree`s on the Lua side always immutable, avoiding the need
to copy the tree in `tree_root`, and make the only mutation point,
`tree_edit`, copy the tree instead.
2025-07-02 17:05:17 +01:00
4eebc46930 fix(vim.system): env=nil passes env=nil to uv.spawn
731e616a79 made it so passing `{env = nil, clear_env = true }` would
pass `{env = {}}` to `vim.uv.spawn`.

However this is not what `clear_env` is (arguably) supposed to do.
If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use
the default environment. Adding `clear_env = true` simply prevents
`NVIM` (the base environment) from being added.

Fixes #34730
2025-07-02 17:01:29 +01:00
807bc00dd6 fix(lsp): use vim.notify with action-less showMessage requests (#34720) 2025-07-01 17:13:58 +00:00
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
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
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
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
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
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
40c61bf205 refactor(lsp): use vim.lsp.buf_request_all internally (#34604) 2025-06-23 13:15:25 -04:00
835f11595f feat(lsp): support annotated text edits (#34508) 2025-06-23 06:30:49 -07:00
cfb4d3d2f2 docs(treesitter): fix parameter list for Query:iter_matches (#34553) 2025-06-22 10:38:00 +00: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
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
3594c213a7 fix(diagnostics): validate opts.signs #34565 2025-06-18 10:26:28 -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
cb2367a1e2 docs: api, misc 2025-06-18 12:13:55 +02:00
c8e54bf49d docs: deprecate <sfile> 2025-06-18 12:12:23 +02:00
17c18efbe5 fix(lsp): support v:count in selection_range() #34551
Co-authored-by: Yi Ming <ofseed@foxmail.com>
2025-06-17 14:10:57 -07:00
496691f985 docs: vim.fs.dir.Opts type #34546
Follow the pattern of vim.fs.find.Opts
2025-06-17 07:14:25 -07:00
e74753a221 fix(docs): callback annotation for vim.ui.input #34507 2025-06-17 06:37:27 -07:00
cd06e0c9d6 fix(lsp): include client ID when receiving unknown fold kind (#34535) 2025-06-16 19:36:06 -07:00