Commit Graph

33378 Commits

Author SHA1 Message Date
Sergei Slipchenko
7a051a4c38 fix(diagnostics): avoid jumping to diagnostics in deleted ranges #35088
Problem:
diagnostic extmark used for positioning continues to exist after
deleting a range containing it, so it's possible to jump to a
next/previous diagnositc, which isn't visible in any way, including not
being shown via `open_float`.

Solution:
enable `invalidate` flag when setting an extmark to be able to filter
out diagnostics based on `invalid` flag when looking for next/previous
diagnostic to jump to.
2025-07-28 05:24:10 +00:00
Siddhant Agarwal
5151f635ca feat: serverlist({peer=true}) returns peer addresses #34806
Problem:
serverlist() only lists servers that were started by the current Nvim.

Solution:
Look for other Nvim servers in stdpath("run").
2025-07-27 21:40:04 -07:00
Maria José Solano
d08b265111 feat(lsp): enable document_color by default #35086 2025-07-27 17:11:28 -07:00
TheBlob42
628d569a59 fix(snippet): jumping backwards to choice node (#35062)
Avoid duplicate text when jumping back to a choice node. Set cursor to
end of tabstop range and prioritize current choice in completion items.
2025-07-27 16:10:00 -04:00
TheBlob42
dff78f580d fix(snippet): setting end_right_gravity (#35061)
When right_gravity is set to true for deactivating tabstop expansion we
have to set end_right_gravity to false to avoid expanding the tabstop
region on the right side. Vice versa for activating tabstop expansion
again.
2025-07-27 12:19:01 -07:00
Maria José Solano
afebbd0f34 fix(lsp): don't override config.title in vim.lsp.buf.signature_help() #35075 2025-07-26 19:47:28 -07:00
Jaehwang Jung
b4ba27c238 fix(lsp): codelens extmark line out of range (#35070)
Problem:
When setting extmark for a codelens after it's asynchronously resolved,
the line may have been removed, raising "invalid 'line': out of range"
error. This is a regression from #34888.

Solution:
Re-introduce the line count check.
2025-07-26 12:58:51 -07:00
Christian Clason
8a7bfdc079 build(deps): bump luajit to 871db2c84 2025-07-26 11:54:09 +02:00
bfredl
af5ac7c7ea fix(unittests): use -1ULL to mean UNSIGNED MATH.MAX 2025-07-26 11:54:09 +02:00
zeertzjq
5de2ec76a3 fix(cmdline): :checkhealth completion with multiple args (#35060) 2025-07-26 07:04:32 +08:00
Sergei Slipchenko
0a113013fb fix(diagnostics): position diagnostics using extmarks #34014
Problem:
Diagnostic positions are not being updated after text changes, which
means `vim.diagnostic.open_float` and `vim.diagnostic.jump` will work
with outdated positions when text is changed until diagnostics are
updated again (if ever).

Solution:
Create extmarks in `vim.diagnostic.set` and use their positions for
`vim.diagnostic.open_float` and `next_diagnostic` (used by
`vim.diagnostic.jump`, `vim.diagnostic.get_next` and
`vim.diagnostic.get_prev`).
2025-07-25 07:56:50 -07:00
Mike
e4a100a1e1 fix(diagnostics): extend conversion support from/to quickfix format (#34006)
Use uppercase to check severity
Mark quickfix items as valid when converting from diagnostics
Support nr/code attribute between formats
2025-07-25 08:14:00 -05:00
zeertzjq
1f7432a272 vim-patch:714671d: runtime(misc): use :hor :term to ensure new term window is split horizontally (#35064)
Problem:  :term splits new window above in vim, but in nvim it change
          the buffer for current window
Solution: :hor term to ensure consistent splitting for Vim and Neovim

closes: vim/vim#17822

714671de35

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-07-25 18:44:56 +08:00
phanium
e512efe369 fix(extui): attempt to perform arithmetic on field 'last_emsg' (#35047)
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-07-24 11:45:41 +00:00
zeertzjq
6190b6bc1d Merge pull request #35023 from janlazo/vim-9.1.1453
vim-patch:8.2.{2905,2906,2927},9.0.{2023,2042},9.1.{63,1453}
2025-07-24 12:29:07 +08:00
Jan Edmund Lazo
3e655d3e42 vim-patch:9.1.0063: GTK code can be improved
Problem:  GTK code can be improved
Solution: Improve GTK code for initial Wayland support
          (lilydjwg)

related: vim/vim#9639

94ff09a093

vim-patch:9.1.1453: tests: Test_geometry() may fail

Problem:  tests: Test_geometry() may fail
          (Gary Johnson)
Solution: allow a slightly smaller value when checking the number of
          lines.

fixes: vim/vim#17491

e965b7ac5f

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: lilydjwg <lilydjwg@gmail.com>
2025-07-23 23:35:44 -04:00
Yochem van Rosmalen
35af766de6 refactor(lua): use vim.system #34707 2025-07-23 20:03:30 -07:00
Sathya Pramodh
54b8c99e51 feat: ":restart +cmd" #34788
Problem:
":restart" always executes ":qall" to exit the server.

Solution:
Support ":restart +cmd" so the user can control the command
used to exit the server.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-07-23 19:45:31 -07:00
Yochem van Rosmalen
0dcdd65dcc fix(shada): check return value is 0
Problem:
Vimscript functions return number to signal ok/error. Lua doesn't
convert these to be falsey.

Solution:
Explicitly check if the return value is 0.
2025-07-23 13:57:27 +02:00
Yochem van Rosmalen
61c4a6b3a9 refactor(shada): switch plugin/shada.vim to Lua #34725 2025-07-23 04:04:05 -07:00
zeertzjq
95dfb063da fix(clipboard): correct blockwise register width computation (#35038) 2025-07-23 10:46:15 +08:00
glepnir
4fe51dfdae fix(iter): ArrayIter:last returns nil when filtered to empty #34697
Problem: After filtering out all elements, ArrayIter:last still returns a stale element.
Solution: Add check for self._head == self._tail and return nil early.

Fix #34696
2025-07-22 17:40:24 -07:00
zeertzjq
1685c44dd4 Merge pull request #35032 from zeertzjq/vim-61cec2e
vim-patch: doc updates
2025-07-23 06:57:37 +08:00
zeertzjq
e28aee0c72 vim-patch:774fe9d: runtime(doc): remove mention of ftp.vim.org
fixes: vim/vim#17819

774fe9d8fc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-23 06:28:35 +08:00
zeertzjq
d6704148bc vim-patch:5711d76: runtime(doc): Tweak documentation style
closes: vim/vim#17824

5711d76818

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-23 06:28:35 +08:00
zeertzjq
c93091395b vim-patch:61cec2e: runtime(doc): Fix typo in :help help-summary
fixes: vim/vim#17816
closes: vim/vim#17823

61cec2e761

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Alain Mosnier <alain@wanamoon.net>
2025-07-23 06:28:35 +08:00
Phạm Bình An
d591275db7 docs: update usr_02.txt #35031
Problem:
- There is reference to gVim in the usr_02.txt file, even though Nvim
  has no built-in GUI.
- `:h help-summary` has a section about optional features (e.g.
  `+conceal`) even though such thing does not exist in Nvim (`:h
  +conceal` will give E149 error).

Solution:
- Remove reference to gVim.
- Replace the section about optional features with a section about Lua.
2025-07-22 15:27:36 -07:00
zeertzjq
9377db2545 vim-patch:9.1.1576: cannot easily trigger wildcard expansion (#35022)
Problem:  cannot easily trigger wildcard expansion
Solution: Introduce wildtrigger() function
          (Girish Palya)

This PR introduces a new `wildtrigger()` function.

See `:h wildtrigger()`

`wildtrigger()` behaves like pressing the `wildchar,` but provides a
more refined and controlled completion experience:

- Suppresses beeps when no matches are found.
- Avoids displaying irrelevant completions (like full command lists)
  when the prefix is insufficient or doesn't match.
- Skips completion if the typeahead buffer has pending input or if a
  wildmenu is already active.
- Does not print "..." before completion.

This is an improvement on the `feedkeys()` based autocompletion script
given in vim/vim#16759.

closes: vim/vim#17806

b486ed8266

While at it, also make Ctrl-Z trigger search completion.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-23 06:12:50 +08:00
Riley Bruins
8b5d8dfc73 fix(lsp): support containerName in symbol requests #35029
The field is present for SymbolInformation and WorkspaceSymbol.
2025-07-22 17:30:16 +00:00
luukvbaal
9fc985bc98 feat(ui2): more predictable routing #35028
Problem:  Routing based on message kinds can be perceived as unpredictable.
Solution: Implement phase 1 of #34281, always showing the full message
          in a window dismissed on any user input when it does not fit
          in the 'cmdheight'. Also show spill "[+n]" indicator if needed.
2025-07-22 15:32:17 +00:00
Sean Dewar
4fadc21e38 fix(window): disallow closing autocmd window in other tabpage
Problem: unlike win_close, win_close_othertab could be used to close the
autocommand window from a different tabpage. This causes aucmd_restbuf to close
the wrong window, potentially causing a crash.

Solution: disallow closing it. Also replace a deprecated use of exc_exec in the
test file.

Fixes #21409.
2025-07-22 13:36:33 +01:00
Sean Dewar
0bef1c88f3 fix(api): do not allow opening float to closing buffer
Problem: no check for nvim_open_win opening a new floating window into a closing
buffer, which can lead to crashes.

Solution: call check_split_disallowed; opening a new float semantically splits
from a window, so the same problems as regular splits apply. Also restore the
error if switch_win_noblock in win_set_buf fails (may not be possible to hit
this, but win_set_buf can silently succeed there since #31595).

As the lock check applies to curbuf (not the target buffer) this may feel a bit
restrictive, though this isn't different to how things like ":split" or
nvim_open_win with "split = true" works when targeting a different buffer. Only
checking the target buffer's lock will cause issues if win_set_buf doesn't end
up in the target buffer for whatever reason.

Maybe we could consider checking the lock of the buffer after win_set_buf and
close the window if it's locked (maybe a bit fiddly, especially as closing a
window can fail...), or make the open + switch operation more atomic, like how
Vim does for its popup windows..?

It also used to be the case that win_set_buf would set an error if autocommands
sent us to a different buffer than what was requested, but #31595 appears to
have also changed that... I haven't touched that here.
2025-07-22 13:36:33 +01:00
Sean Dewar
9813c00dd3 fix(window): restore b_nwindows if win_close_othertab keeps window
Problem: can't accurately know if close_buffer directly (e.g: not via autocmds)
decremented b_nwindows. This can cause crashes if win_close_othertab decides to
keep the window after calling close_buffer (if it did not free the buffer), as
b_nwindows may remain out-of-sync.

Solution: change the return value of close_buffer to accurately depict whether
it decremented b_nwindows. Check it in win_close_othertab to avoid a crash.

Similar issues may exist in other places that call close_buffer, but I've not
addressed those here (not to mention only one other place even checks its return
value...)
2025-07-22 13:36:33 +01:00
Sean Dewar
1d2d6e31a7 test(tabclose): remove deprecated calls, use testnvim helpers 2025-07-22 13:36:33 +01:00
Sean Dewar
05a83265f9 fix(autocmd): fire TabClosed after freeing tab page
Problem: TabClosed is fired after close_buffer is called (after b_nwindows is
decremented) and after the tab page is removed from the list, but before it's
freed. This causes inconsistencies such as the removed tabpage having a valid
handle and functions like nvim_tabpage_get_number returning nonsense.

Solution: fire it after free_tabpage. Try to maintain the Nvim-specific
behaviour of setting `<amatch>` to the old tab page number, and the
(undocumented) behaviour of setting `<abuf>` to the buffer it was showing
(close_buffer sets w_buffer to NULL if it was freed, so it should be OK pass it
to apply_autocmds_group, similar to before).
2025-07-22 13:36:33 +01:00
Sean Dewar
3a36df9b13 fix(window): handle closing the only non-float in other tabpage
Problem: No check for closing the only non-floating window in a non-current
tabpage that contains floats. This can lead to a tabpage that contains only
floats, causing crashes.

Solution: Copy the relevant check from win_close to win_close_othertab. Fix some
uncovered issues.

Closes #34943
Fixes #31236

Co-authored-by: glepnir <glephunter@gmail.com>
2025-07-22 13:36:33 +01:00
Justin M. Keyes
b0e8b0a35f Merge #34853 from ribru17/diag_related_docs
feat(lsp): diagnostic related documents support
2025-07-22 00:38:46 -04:00
Jan Edmund Lazo
7c38f428f4 vim-patch:9.0.2023: need more tests for :cq
Problem:  need more tests for :cq
Solution: Add more tests, including wraparound on linux

ba9aed4497

vim-patch:9.0.2042: Test_cq_zero_exmode fails without channel feature

Problem:  Test_cq_zero_exmode fails without channel feature
Solution: Make the test check the channel feature

closes: vim/vim#13365

c290009e99

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-21 21:33:01 -04:00
Jan Edmund Lazo
9a5b3a39f3 vim-patch:8.2.2905: no error when defaults.vim cannot be loaded
Problem:    No error when defaults.vim cannot be loaded.
Solution:   Add an error message. (Christian Brabandt, closes vim/vim#8248)

1d3a14ecf0

Neovim doesn't support defaults.vim.
N/A test but this should "help" reduce patch rejections.

vim-patch:8.2.2906: ASAN reports errors for test_startup

Problem:    ASAN reports errors for test_startup for unknown reasons.
Solution:   Temporarily disable the new test.

a5787c3742

vim-patch:8.2.2927: test commented out because it fails with ASAN

Problem:    Test commented out because it fails with ASAN.
Solution:   Only skip the test when running with ASAN.

a83d06026d

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-21 21:33:01 -04:00
Riley Bruins
371aa1c566 feat(lsp): diagnostic related documents support 2025-07-21 16:11:24 -07:00
Riley Bruins
1d8e9b5d07 fix(lsp): store result id for unchanged diagnostic reports
**Problem:** For unchanged document diagnostic reports, the `resultId`
is ignored completely, even though it should still be saved for the
request (in fact, the spec marks it as mandatory for unchanged reports,
so it should be extra important).

**Solution:** Always store the `resultId`.
2025-07-21 16:11:15 -07:00
zeertzjq
ea2d226df6 Merge pull request #34894 from janlazo/vim-8.1.0857
vim-patch:8.1.{770,857,914,977,1004,1526,1551,1565,1584,1629,1641,1703,1728,1730,1736,1802,1853,1891,2127,2200},8.2.3922,9.0.{546,928},9.1.1382
2025-07-21 12:02:05 +08:00
zeertzjq
8ee82da3cf vim-patch:1f6faff: runtime(doc): mention the "pipefail" shell option (#35016)
related: vim/vim#17787

1f6faff912

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-21 07:54:31 +08:00
zeertzjq
2795df7aac Merge pull request #35015 from zeertzjq/vim-9.1.1571
vim-patch:9.1.{1571,1573}: CmdlineChanged triggered to often
2025-07-21 07:53:54 +08:00
zeertzjq
22d1fb8c01 vim-patch:9.1.1573: Memory leak when pressing Ctrl-D in cmdline mode
Problem:  Memory leak when pressing Ctrl-D in cmdline mode
          (after 9.1.1571).
Solution: Free prev_cmdbuff before assigning to it.
          (zeertzjq).

Existing tests already cover this. This change fixes the CI failure.

closes: vim/vim#17807

c02bef26fd
2025-07-21 07:16:55 +08:00
zeertzjq
bbc368dfce vim-patch:9.1.1571: CmdlineChanged triggered to often
Problem:  The CmdlineChanged event was firing unnecessarily, even when
          the command line's content hadn't actually changed.

Solution: I've added a check to compare the command-line buffer's state
          before and after key processing. The `CmdlineChanged` event
          now only triggers if the buffer's contents are genuinely
          different (Girish Palya).

closes: vim/vim#17803

239c4e4abe

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-21 07:15:51 +08:00
Jan Edmund Lazo
85bd0b6a03 vim-patch:8.1.1891: functions used in one file are global
Problem:    Functions used in one file are global.
Solution:   Add "static". (Yegappan Lakshmanan, closes vim/vim#4840)

5843f5f37b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
f2d92ba6ca refactor: fixup! vim-patch:8.1.0877: new buffer
https://github.com/neovim/neovim/pull/9674 removed switch_to_win_for_buf().
This vim-patch removed the last relevant usage of find_win_for_buf()
Vim uses switch_to_win_for_buf() only for if_py_both.
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
b79ed66e4a vim-patch:8.1.1736: viminfo support is spread out
Problem:    Viminfo support is spread out.
Solution:   Move more viminfo code to viminfo.c. (Yegappan Lakshmanan,
            closes vim/vim#4717)  Reorder code to make most functions static.

c3328169d5

735aa4c4c8 was the partial port for
the typedefs.
This patch completes the viminfo->shada port.

- get_shada_parameter()
- find_shada_parameter()

Other patches below are N/A.

vim-patch:8.1.1728: wrong place for command line history viminfo support

Problem:    Wrong place for command line history viminfo support.
Solution:   Move it to viminfo.c.

5f32ece459

vim-patch:8.1.1730: wrong place for mark viminfo support

Problem:    Wrong place for mark viminfo support.
Solution:   Move it to viminfo.c. (Yegappan Lakshmanan, closes vim/vim#4716)

1e78e69680

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
6a97eb332a refactor: fixup! vim-patch:8.2.4881: "P" in Visual
7978660efb removed all uses of ff:

```diff
-yankreg_T *get_y_previous(void)
-{
-  return y_previous;
-}
-
-void set_y_previous(yankreg_T *yreg)
-{
-  y_previous = yreg;
-}
```
2025-07-20 18:37:13 -04:00