Commit Graph

7969 Commits

Author SHA1 Message Date
Gregory Anders
ff93cccbc1
fix(defaults): omit extraneous info from unimpaired mapping errors (#30983) 2024-10-29 10:06:14 -05:00
zeertzjq
4a4b52dca4
vim-patch:9.1.0820: tests: Mac OS tests are too flaky (#30980)
Problem:  tests: Mac OS tests are too flaky
Solution: Increase max test timeout to 25 minutes,
          allow up to 10 retries on Mac OS runners,
          refactor runtest.vim (Milly).

closes: vim/vim#15940

baab7c0865

Co-authored-by: Milly <milly.ca@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
2024-10-29 09:08:05 +08:00
zeertzjq
60b3ccd850 vim-patch:9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline argument
Problem:  'findexpr' completion doesn't set v:fname to cmdline argument.
Solution: Set v:fname to the cmdline argument as-is (zeertzjq).

closes: vim/vim#15934

20e045f781
2024-10-29 08:20:00 +08:00
zeertzjq
6b8c3d146e vim-patch:9.1.0811: :find expansion does not consider 'findexpr'
Problem:  :find expansion does not consider 'findexpr'
Solution: Support expanding :find command argument using 'findexpr'
          (Yegappan Lakshmanan)

closes: vim/vim#15929

2f6efaccfd

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-10-29 08:20:00 +08:00
zeertzjq
378d9135e7 vim-patch:9.1.0810: cannot easily adjust the |:find| command
Problem:  cannot easily adjust the |:find| command
Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan)

closes: vim/vim#15901
closes: vim/vim#15905

aeb1c97db5

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-10-29 08:20:00 +08:00
zeertzjq
ff29fd8c6e
test(pum): add test for item selection with 'rightleft' (#30968) 2024-10-28 17:20:00 +08:00
zeertzjq
d24fb72c33
fix(pum): don't select item when clicking to the left/right (#30967)
Problem:  Selecting an item in the right-click menu when clicking to the
          left/right of it is confusing, especially in a UI that doesn't
          support 'mousemoveevent'.
Solution: Don't select an item when clicking to the left/right of the
          right-click menu.
2024-10-28 14:29:59 +08:00
Donatas
a9e725b26e
feat(diagnostics)!: sort underline severity_sort (#30898)
feat(diagnostics)!: sort underline with severity_sort

BREAKING CHANGE: underline will be applied with a higher value than `vim.hl.priorities.diagnostics`
2024-10-27 11:36:39 -05:00
Tristan Knight
25b53b593e
refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915
* deprecate old signatures
* move to new str_byteindex/str_utfindex signature
* use single-underscore name (double-underscore is reserved for Lua itself)
2024-10-26 07:38:25 -07:00
Famiu Haque
b922b7d6d7
refactor(options)!: use OptVal for option defaults #26691
Problem: We use `void *` for option default values, which is confusing and can cause problems with type-correctness. It also doesn't accomodate for multitype options. On top of that, it also leads to default boolean option values not behaving correctly on big endian systems.

Solution: Use `OptVal` for option default values.

BREAKING CHANGE:
- `:set {option}<` removes the local value for all global-local options instead of just string global-local options.
- `:setlocal {option}<` copies the global value to the local value for number and boolean global-local options instead of removing the local value.
2024-10-25 07:10:40 -07:00
zeertzjq
e4a74e986c
vim-patch:9.1.0814: mapset() may remove unrelated mapping (#30941)
Problem:  mapset() may remove unrelated mapping whose {rhs} matches the
          restored mapping's {lhs}.
Solution: only match by {lhs} when unmapping for mapset() (zeertzjq).

closes: vim/vim#15935

fdf135a052
2024-10-24 23:16:54 +00:00
Mathias Fussenegger
3c51058d76 fix(lsp): set tagstack on jump via goto methods
Follow up to https://github.com/neovim/neovim/pull/30877
Fixes https://github.com/neovim/neovim/issues/30926
2024-10-24 13:43:49 +02:00
zeertzjq
50e63c8171
fix(options): missing error check for global 'scl' and 'winhl' (#30919) 2024-10-24 10:03:38 +08:00
zeertzjq
fffcb88ad6
test(012_directory_spec): fix flakiness on Windows (#30920)
Problem:  012_directory_spec is flaky on Windows.
Solution: Use :%bwipe! instead :qall!.
2024-10-24 10:03:23 +08:00
zeertzjq
19204ebde9 test(old): remove unnecessary :setglobal skips 2024-10-24 06:56:12 +08:00
zeertzjq
6b63fe798b vim-patch:9.1.0806: tests: no error check when setting global 'briopt'
Problem:  tests: no error check when setting global 'briopt'
Solution: also parse and check global 'briopt' value (Milly)

closes: vim/vim#15911

b38700ac81

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-24 06:56:12 +08:00
zeertzjq
5436d9b3c6 vim-patch:9.1.0804: tests: no error check when setting global 'cc'
Problem:  tests: no error check when setting global 'cc'
Solution: also parse and check global 'cc' value (Milly)

closes: vim/vim#15914

a441a3eaab

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-24 06:56:12 +08:00
zeertzjq
3d2aca83de vim-patch:9.1.0803: tests: no error check when setting global 'isk'
Problem:  tests: no error check when setting global 'isk'
Solution: also parse and check global 'isk' value (Milly)

closes: vim/vim#15915

5e7a6a4a10

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-24 06:56:12 +08:00
zeertzjq
6d2cf5ad31 vim-patch:9.1.0802: tests: no error check when setting global 'fdm' to empty value
Problem:  tests: no error check when setting global 'fdm' to empty value
Solution: Also check global 'fdm' value for being empty (Milly).

closes: vim/vim#15916

142cad1f88

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-24 06:56:11 +08:00
Tristan Knight
230b0c7f02
feat(stdlib): overload vim.str_byteindex, vim.str_utfindex #30735
PROBLEM:
There are several limitations to vim.str_byteindex, vim.str_utfindex:
1. They throw given out-of-range indexes. An invalid (often user/lsp-provided)
   index doesn't feel exceptional and should be handled by the caller.
   `:help dev-error-patterns` suggests that `retval, errmsg` is the preferred
   way to handle this kind of failure.
2. They cannot accept an encoding. So LSP needs wrapper functions. #25272
3. The current signatures are not extensible.
    * Calling: The function currently uses a fairly opaque boolean value to
      indicate to identify the encoding.
    * Returns: The fact it can throw requires wrapping in pcall.
4. The current name doesn't follow suggestions in `:h dev-naming` and I think
   `get` would be suitable.

SOLUTION:
- Because these are performance-sensitive, don't introduce `opts`.
- Introduce an "overload" that accepts `encoding:string` and
  `strict_indexing:bool` params.

```lua
local col = vim.str_utfindex(line, encoding, [index, [no_out_of_range]])
```

Support the old versions by dispatching on the type of argument 2, and
deprecate that form.

```lua
vim.str_utfindex(line)                             -- (utf-32 length, utf-16 length), deprecated
vim.str_utfindex(line, index)                      -- (utf-32 index, utf-16 index), deprecated
vim.str_utfindex(line, 'utf-16')                   -- utf-16 length
vim.str_utfindex(line, 'utf-16', index)            -- utf-16 index
vim.str_utfindex(line, 'utf-16', math.huge)        -- error: index out of range
vim.str_utfindex(line, 'utf-16', math.huge, false) -- utf-16 length
```
2024-10-23 06:33:57 -07:00
Christian Clason
02749de7d5 vim-patch:9.1.0809: filetype: petalinux config files not recognized
Problem:  filetype: petalinux config files not recognized
Solution: detect 'project-spec/*.conf' files as bitbake filetype
          (Wu, Zhenyu)

References:
https://www.amd.com/en/products/software/adaptive-socs-and-fpgas/embedded-software/petalinux-sdk.html

closes: vim/vim#15926

626b6ab486

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-23 10:00:52 +02:00
zeertzjq
da45827787 vim-patch:9.1.0805: tests: minor issues in gen_opt_test.vim
Problem:  tests: minor issues in gen_opt_test.vim
Solution: fix restore value for 'undolevels', fix comment, fix
          wrong cpo value, add equality test for global-local options on
          switchback (Milly).

closes: vim/vim#15913

231480f975

Cherry-pick gen_opt_test.vim change from patch 9.1.0807.

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-23 07:38:11 +08:00
zeertzjq
c1330816dc vim-patch:9.1.0799: tests: gettwinvar()/gettabwinvar() tests are not comprehensive
Problem:  tests: gettwinvar()/gettabwinvar() tests are not comprehensive
Solution: Add more tests (Milly)

closes: vim/vim#15920

ceec8640df

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-23 07:38:10 +08:00
dundargoc
4c25e60767 test: port libvterm unit test to neovim test suite
These were imported from the v0.3.3 git tag
https://github.com/neovim/libvterm/tree/v0.3.3 and not the latest
commit. This is for compatibility reasons as the libvterm code was
imported from v0.3.3.
2024-10-22 21:20:11 +02:00
zeertzjq
8c532a9ea8
fix(options): fix 'winhl' still accepting invalid value (#30896) 2024-10-22 08:10:15 +00:00
Christian Clason
a6d1165771 vim-patch:9.1.0796: filetype: libtool files are not recognized
Problem:  filetype: libtool files are not recognized
Solution: detect '*.{lo,la,lai}' as sh filetype
          (Wu, Zhenyu)

closes: vim/vim#15751

bfe568d8c4

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-22 08:55:39 +02:00
Christian Clason
b7779aad41 vim-patch:9.1.0795: filetype: Vivado memory info file are not recognized
Problem:  filetype: Vivado memory info file are not recognized
Solution: detect '*.mmi' memory info file as xml filetype
          (Wu, Zhenyu)

References: https://docs.amd.com/r/en-US/ug1580-updatemem/MMI-File-Syntax

closes: vim/vim#15906

0887e62bce

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-22 08:55:39 +02:00
zeertzjq
1b9dafa67b
fix(options): fix :setglobal not working for 'spelloptions' (#30894) 2024-10-22 11:34:09 +08:00
zeertzjq
f663243e95
vim-patch:9.1.0797: testing of options can be further improved (#30893)
Problem:  testing of options can be further improved
Solution: split the generated option test into test_options_all.vim,
          add more test cases, save and restore values, fix use-after-free

closes: vim/vim#15894

6eca04e9f1

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-22 09:05:14 +08:00
Lewis Russell
3572319b4c feat(vim.validate): improve fast form and deprecate spec form
Problem:

`vim.validate()` takes two forms when it only needs one.

Solution:

- Teach the fast form all the features of the spec form.
- Deprecate the spec form.
- General optimizations for both forms.
- Add a `message` argument which can be used alongside or in place
  of the `optional` argument.
2024-10-21 11:32:06 +01:00
Christian Clason
6fd13eedda test(rpc): retry flaky 'vim.rpcrequest and vim.rpcnotify' test
Problem: 'vim.rpcrequest and vim.rpcnotify' is flaky on Windows.

Solution: retry it.
2024-10-21 11:24:34 +02:00
Justin M. Keyes
18b43c331d refactor: rename vim.highlight => vim.hl
Problem:
- `vim.highlight` module does not follow `:help dev-name-common`, which
  documents the name for "highlight" as "hl".
- Shorter names are usually preferred.

Solution:
Rename `vim.highlight` to `vim.hl`.

This is not a breaking change until 2.0 (or maybe never).
2024-10-21 00:54:43 +02:00
Justin M. Keyes
960fdc775a fix(lua): vim.deprecate does not support major>0 2024-10-21 00:54:42 +02:00
Mathias Fußenegger
0083e03d6f
feat(lsp)!: support multiple clients in goto methods (#30877)
Relates to:

- https://github.com/neovim/neovim/issues/30034
- https://github.com/neovim/neovim/issues/17712
- https://github.com/neovim/neovim/issues/16363

Closes:

- https://github.com/neovim/neovim/issues/26936 (but only provides bufnr
  and method)
- https://github.com/neovim/neovim/issues/22318

Might fix: https://github.com/neovim/neovim/issues/30737
2024-10-20 23:40:44 +02:00
zeertzjq
9b8907d905
feat(float): allow enabling mouse for non-focusable window (#30844)
Problem:  Cannot allow mouse interaction for non-focusable float window.
Solution: Add a "mouse" field to float window config.
2024-10-20 22:18:26 +08:00
zeertzjq
ce9a9b4700
vim-patch:9.1.0794: tests: tests may fail on Windows environment (#30874)
Problem:  tests: tests may fail on Windows environment
Solution: use shellcmdflag=/D to skip executing autorun from
          the registry (Milly)

closes: vim/vim#15900

4f5681dbdf

Cherry-pick Test_cursorhold_insert_with_timer_interrupt() change from
patch 8.2.1836.

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-20 18:02:05 +08:00
zeertzjq
ed794c9a10
vim-patch:9.1.0792: tests: Test_set_values() is not comprehensive enough (#30870)
Problem:  tests: Test_set_values() is not comprehensive enough
Solution: Add a lot more test cases (Milly)

closes: vim/vim#15892

cc15bbcbc4

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-20 08:18:38 +08:00
zeertzjq
3cf602486c
feat(terminal)!: make 'belloff' and 'visualbell' apply to terminal bell (#30859)
vim-patch:8.2.4744: a terminal window can't use the bell
vim-patch:8.2.4745: using wrong flag for using bell in the terminal

BREAKING CHANGE: Bells from :terminal are now silent by default, unless
'belloff' option doesn't contain "term" or "all".
2024-10-20 07:59:43 +08:00
zeertzjq
395f420fc6
fix(options): fix some 'belloff' flags not working properly (#30856)
Problem:  Some 'belloff' flags don't work properly.
Solution: Keep BO_ flags and p_bo_values[] in sync.
2024-10-18 14:39:27 +00:00
zeertzjq
b5e69b32d7
vim-patch: make gen_opt_test.vim work with Nvim (#30850)
Problem:  Insufficient test coverage for validation of option values.
Solution: Port Vim's gen_opt_test.vim and make it work with Nvim.

vim-patch:9.1.0760: tests: no error reported, if gen_opt_test.vim fails
vim-patch:9.1.0791: tests: errors in gen_opt_test.vim are not shown
2024-10-18 17:38:29 +08:00
Uthman Mohamed
f4b620c4e6
feat(vim.ui.open): support lemonade #30845 2024-10-18 02:22:15 -07:00
Lewis Russell
fa6ab0d909
Merge pull request #30825 from lewis6991/refactor/lsputil 2024-10-17 13:35:02 +01:00
Lewis Russell
acbc6a7f91 fix(lsp.util): inconsistent handling of offset_encoding 2024-10-17 12:52:45 +01:00
Lewis Russell
f0973d4227 feat(lsp.util): refactor symbols_to_items()
- Remove the trivial function vim.lsp.util._get_symbol_kind_name()
  and its tests.
2024-10-17 12:52:45 +01:00
zeertzjq
852954ff6d
vim-patch:9.1.0789: tests: ':resize + 5' has invalid space after '+' (#30835)
Problem:  tests: ':resize + 5' has invalid space after '+'
Solution: Correct the test (Milly)

closes: vim/vim#15884

c0cba184f5

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-17 07:28:25 +08:00
zeertzjq
f72dc2b4c8
vim-patch:9.1.0786: tests: quickfix update test does not test location list (#30828)
Problem:  tests: quickfix update test does not test location list
          (after: v9.1.0.785)
Solution: update Test_quickfix_buffer_contents to test with location
          lists (Yegappan Lakshmanan)

closes: vim/vim#15879

6a1deaf5ad

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-10-16 08:01:08 +08:00
zeertzjq
84623dbe93
vim-patch:9.1.0785: cannot preserve error position when setting quickfix list (#30820)
Problem:  cannot preserve error position when setting quickfix lists
Solution: Add the 'u' action for setqflist()/setloclist() and try
          to keep the closes target position (Jeremy Fleischman)

fixes: vim/vim#15839
closes: vim/vim#15841

27fbf6e5e8

Co-authored-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
2024-10-15 18:53:59 +08:00
Maria José Solano
e0a5c3bb58
fix(lsp): handle multiline signature help labels #30460 2024-10-15 02:36:04 -07:00
Christian Clason
74a1614772 vim-patch:9.1.0782: tests: using wrong neomuttlog file name
Problem:  tests: using wrong neomuttlog file name
Solution: use correct file name

related: vim/vim#15858

0c59c30271

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-15 08:32:29 +02:00
zeertzjq
f25ebc2290
vim-patch:9.1.0783: 'spell' option setting has problems (#30818)
Problem:  'spell' option setting has problems
Solution: correctly check for comma for 'spellfile' option,
          remove unnecessary checks, refactor slightly (Milly)

closes: vim/vim#15873

322ad0c953

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-15 09:40:54 +08:00
zeertzjq
4846bf05dc
fix(tui): avoid flushing buffer halfway an OSC 2 sequence (#30793)
Problem:  Setting title while TUI buffer is almost full may cause the
          end of a flush to be treated as a part of an OSC 2 or OSC 0
          sequence, leading to problems like invisible cursor.
Solution: Make the whole sequence to set title a unibi_ext string.
2024-10-15 07:34:13 +08:00
Christian Clason
b7e8966715 vim-patch:9.1.0781: tests: test_filetype fails
Problem:  tests: test_filetype fails (clason)
          (after v9.1.0779)
Solution: Use correct filename for neomuttlog filetype

related: vim/vim#15845

7d755d8ef3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-14 09:31:24 +02:00
Christian Clason
d04d7bf65d vim-patch:9.1.0779: filetype: neomuttlog files are not recognized
Problem:  filetype: neomuttlog files are not recognized
Solution: detect '*.neomuttdebug' file as neomuttlog filetype,
          include neomuttlog syntax script (Richard Russon)

closes: vim/vim#15858

a2aa921f76

Co-authored-by: Richard Russon <rich@flatcap.org>
Co-authored-by: AvidSeeker <avidseeker7@protonmail.com>
2024-10-14 09:31:24 +02:00
Christian Clason
15aa27bc1f vim-patch:9.1.0778: filetype: lf config files are not recognized
Problem:  filetype: lf config files are not recognized
Solution: detect lfrc files as lf filetype, include a syntax
          script for lf files (Andis Spriņķis).

References:
- https://github.com/gokcehan/lf

closes: vim/vim#15859

0f146b7925

Co-authored-by: Andis Spriņķis <spr.andis@protonmail.com>
2024-10-14 08:27:37 +02:00
zeertzjq
1189c5ce59
test(tui_spec): use Unicode in cursor_address test (#30807)
Now that #16425 is fixed, use Unicode again to reduce screen height.
Unfortunately composing chars still can't be used, as it turns out that
composing chars may be missing when sent separately from the base char
at the last char a screen line.
2024-10-14 06:10:14 +00:00
zeertzjq
a6d5e6b105
vim-patch:a420547: runtime(misc): Use consistent "Vim script" spelling (#30805)
References: https://groups.google.com/g/vim_dev/c/3Z5yM8KER2w/m/wAqws0QSEAAJ

closes: vim/vim#15863

a4205471ad

Co-authored-by: h-east <h.east.727@gmail.com>
2024-10-14 09:27:29 +08:00
zeertzjq
73309048cf vim-patch:8.2.0986: MS-Windows: functions test fails
Problem:    MS-Windows: functions test fails.
Solution:   Only simplify ///path on Unix.

c70222d12a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-10-13 18:52:46 +08:00
zeertzjq
8c8c6fb05a vim-patch:8.2.0985: simplify() does not remove slashes from "///path"
Problem:    Simplify() does not remove slashes from "///path".
Solution:   Reduce > 2 slashes to one. (closes vim/vim#6263)

fdcbe3c3fe

Omit Test_readdirex() change: changed again in patch 9.0.0323.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-10-13 18:52:46 +08:00
zeertzjq
fb74fd2954
test(autocmd/termxx_spec): properly setup TextChangedT tests (#30787) 2024-10-13 11:02:28 +08:00
zeertzjq
b56aa80a26
vim-patch:9.1.0775: tests: not enough tests for setting options (#30785)
Problem:  tests: not enough tests for setting options
Solution: Add more comprehensive tests to test_options (Milly).

closes: vim/vim#15856

484facebe4

Restore behavior of &l:option for unset local boolean options that was
accidentally changed in #26429.

Co-authored-by: Milly <milly.ca@gmail.com>
2024-10-13 08:09:53 +08:00
Christian Clason
06625f9b3a vim-patch:9.1.0777: filetype: Some upstream php files are not recognized
Problem:  filetype: Some upstream php files are not recognized
Solution: Detect more config files from the PHP source
          distribution as filetype ini (nisbet-hubbard).

closes: vim/vim#15840

367499c5c3

Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
2024-10-13 00:46:29 +02:00
zeertzjq
b0ddc1783a
vim-patch:9.1.0776: test_strftime may fail because of missing TZ data (#30780)
Problem:  test_strftime may fail because of missing TZ data
Solution: Use GMT offsets to validate timezone differences (James McCoy)

Some systems only provide timezones that follow the geographical region
naming (e.g. America/New_York) by default and require an additional
install for other names (like EST).

The GMT+<offset> format must always be honored, so use that to generate
distinct data for the test.

closes: vim/vim#15848

ea997edc7a

Co-authored-by: James McCoy <jamessan@jamessan.com>
2024-10-13 06:30:20 +08:00
Riley Bruins
e049c6e4c0
feat(ui): statusline text inherits highlights #29976
Changes apply to the winbar, statusline, and tabline text.
2024-10-12 10:57:31 -07:00
Riley Bruins
4b90952851 fix(treesitter): mark supertype nodes as named
**Problem:** Tree-sitter 0.24.0 introduced a new symbol type to denote
supertype nodes (`TSSymbolTypeSupertype`). Now, `language.inspect()`
(and the query `omnifunc`) return supertype symbols, but with double
quotes around them.

**Solution:** Mark a symbol as "named" based on it *not* being an
anonymous node, rather than checking that it is a regular node (which a
supertype also is not).
2024-10-12 09:59:44 +02:00
zeertzjq
0e42c81c7f
fix(lua): avoid recursive vim.on_key() callback (#30753) 2024-10-12 08:07:05 +08:00
bfredl
486076a0e1 fix(build): remove USE_FNAME_CASE, redundant with CASE_INSENSITIVE_FILENAME
It stands to reason, you need to "fix" case-insensitive filenames
if-and-only-if you have case-insensitive filenames.
2024-10-11 20:26:54 +02:00
Riley Bruins
d3193afc25 fix(treesitter): remove duplicate symbol names in language.inspect()
**Problems:**

- `vim.treesitter.language.inspect()` returns duplicate
  symbol names, sometimes up to 6 of one kind in the case of `markdown`
- The list-like `symbols` table can have holes and is thus not even a
  valid msgpack table anyway, mentioned in a test

**Solution:** Return symbols as a map, rather than a list, where field
names are the names of the symbol. The boolean value associated with the
field encodes whether or not the symbol is named.

Note that anonymous nodes are surrounded with double quotes (`"`) to
prevent potential collisions with named counterparts that have the same
identifier.
2024-10-11 18:15:07 +02:00
Riley Bruins
267c7525f7 feat(treesitter): introduce child_with_descendant()
This commit also marks `child_containing_descendant()` as deprecated
(per upstream's documentation), and uses `child_with_descendant()` in
its place. Minimum required tree-sitter version will now be `0.24`.
2024-10-11 17:29:45 +02:00
zeertzjq
c4762b3097
test(tui_spec): use child_exec_lua() more (#30757)
It is more readable.
2024-10-11 08:23:14 +00:00
Christian Clason
79c036747a vim-patch:9.1.0773: filetype: some Apache files are not recognized
Problem:  filetype: some Apache files are not recognized
Solution: Detect more config files from the Apache source
          distribution as filetype apache (nisbet-hubbard)

closes: vim/vim#15810

e58e9015cc

Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
2024-10-11 08:59:37 +02:00
Riley Bruins
a0e3fe5741
feat(ui): cascading style inheritance for Pmenu* highlights #29980
- `PmenuSel` and `PmenuMatch` inherit from `Pmenu`
- `PmenuMatchSel` inherits from both `PmenuSel` and `PmenuMatch`
2024-10-10 23:26:25 -07:00
zeertzjq
25665b365c
test(tui_spec): better prevent race between paste and input (#30751)
Problem:
Using a single RPC request to child server isn't enough to prevent race
between nvim_paste and nvim_input.

Solution:
Ensure both child client and child server have processed pending events
by sending an empty DCS response to the child client and waiting for
TermResponse autocommand on the child server.
2024-10-11 09:45:44 +08:00
zeertzjq
6f1601a1b9
vim-patch:9.1.0774: "shellcmdline" doesn't work with getcompletion() (#30750)
Problem:  "shellcmdline" doesn't work with getcompletion().
Solution: Use set_context_for_wildcard_arg() (zeertzjq).

closes: vim/vim#15834

85f36d61e0
2024-10-10 22:48:45 +00:00
Tomasz N
b3109084c2
fix(lsp): fix cursor position after snippet expansion (#30659)
Problem: on `CompleteDone` cursor can jump to the end of line instead of
the end of the completed word.

Solution: remove only inserted word for snippet expansion instead of everything
until eol.

Fixes #30656

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2024-10-10 11:40:03 +02:00
zeertzjq
8450752f46 vim-patch:9.1.0771: completion attribute hl_group is confusing
Problem:  Currently completion attribute hl_group is combined with
          all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
          (glepnir).

closes: vim/vim#15818

0fe17f8ffb

Co-authored-by: glepnir <glephunter@gmail.com>
2024-10-10 07:21:02 +08:00
Christian Clason
0264870c0a vim-patch:9.1.0769: filetype: MLIR files are not recognized
Problem:  filetype: MLIR files are not recognized
Solution: Detect '*.mlir' files as mlir filetype,
          include a mlir filetype plugin
          (Wu, Zhenyu)

closes: vim/vim#15826

347d43bd33

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-10-09 10:10:39 +02:00
zeertzjq
f449a38f6a
vim-patch:9.1.0770: current command line completion is a bit limited (#30728)
Problem:  current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
          function (Ruslan Russkikh).

closes: vim/vim#15823

0407d621bb

Co-authored-by: Ruslan Russkikh <dvrussk@yandex.ru>
2024-10-09 08:14:18 +08:00
zeertzjq
e98b1b0235
vim-patch:9.1.0767: A condition is always true in ex_getln.c (#30726)
Problem:  A cmdlen == 0 condition is always true as ccline.cmdlen == 0
          was already checked above (after v9.1.0766).
Solution: Remove the condition and the variable.
          (zeertzjq)

closes: vim/vim#15830

c9aa6e4f2a
2024-10-08 23:16:43 +00:00
zeertzjq
5805716ca4
vim-patch:9.1.0765: No test for patches 6.2.418 and 7.3.489 (#30713)
Problem:  No test for patches 6.2.418 and 7.3.489
Solution: Add a test.  Fix some whitespace problems in test_mapping.vim.
          Document the behavior (zeertzjq).

closes: vim/vim#15815

5df3cb2898
2024-10-07 22:51:57 +00:00
zeertzjq
376de1483e
fix(drawline): correct highlight priority with Visual selection (#30706) 2024-10-08 06:24:36 +08:00
zeertzjq
2377443cd2
vim-patch:9.1.0764: [security]: use-after-free when closing a buffer (#30705)
Problem:  [security]: use-after-free when closing a buffer
Solution: When splitting the window and editing a new buffer,
          check whether the newly to be edited buffer has been marked
          for deletion and abort in this case

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-rj48-v4mq-j4vg

51b62387be

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 10:40:44 +08:00
zeertzjq
40ec3d7bc0
vim-patch:9.1.0761: :cd completion fails on Windows with backslash in path (#30703)
Problem:  :cd completion fails on Windows with backslash in path
Solution: switch no_bslash argument to FALSE in file_pat_to_reg_pat()

Note: only fixes the problem on Windows. For Unix, we still need to
escape backslashes since those are taken as regex atoms (and could be
invalid regex atoms).

fixes: vim/vim#15643
closes: vim/vim#15808

1a31c430bb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-07 10:16:47 +08:00
Justin M. Keyes
27f3750817
feat(lsp): improve LSP doc hover rendering #30695
Problem:
- Some servers like LuaLS add unwanted blank lines after multiline
  `@param` description.
- List items do not wrap nicely.

Solution:
- When rendering the LSP doc hover, remove blank lines in each `@param`
  or `@return`.
  - But ensure exactly one empty line before each.
- Set 'breakindent'.
2024-10-06 12:20:40 -07:00
dundargoc
00d1078ede ci: bump macos runner version to macos-15 2024-10-06 16:06:28 +02:00
zeertzjq
a4ebea18f1
vim-patch:9.1.0003: Cannot build against Ruby 33 dynamically (#30683)
Problem:  Cannot build against Ruby 33 dynamically
Solution: Ruby 33 removed transient heap, so do not use
          rb_ary_transient anymore, NoMethodError format changed,
          so update test for expected error message
          (Isao Sato)

- ruby-3.3 removed transient heap for ruby/dyn

when +ruby/dyn with ruby-3.3 do command :ruby, E448 occur.
ruby-3.3 has no transient heap anymore, so disable rb_ary_transient etc.

$ LC_ALL=C VIMRUNTIME=runtime ./src/vim -u NONE -c 'ruby puts RUBY_VERSION'
"=> Error detected while processing command line:
"=> E448: Could not load library function rb_ary_detransient
"=> E266: Sorry, this command is disabled, the Ruby library could not be
    loaded.

- ruby-3.3 changed NoMethodError format:

$ rvm 3.2.2, 3.3.0-rc1 do ruby -e 'begin; nil.name; rescue => e; puts "%s : %s"%[RUBY_VERSION, e.message]; end '
=> 3.2.2 : undefined method `name' for nil:NilClass
=> 3.3.0 : undefined method `name' for nil

so loose pattern in Test_ruby_Vim_buffer_get()

closes: vim/vim#13741

443657b32b

Co-authored-by: Isao Sato <svardew@gmail.com>
2024-10-05 23:28:28 +00:00
zeertzjq
9f26bdc416
vim-patch:9.1.0759: screenpos() may return invalid position (#30681)
Problem:  screenpos() may return invalid position
          after switching buffers (Greg Hurrell)
Solution: reset w_leftcol if wrapping has been set
          after copying wrap option

fixes: vim/vim#15792
closes: vim/vim#15803

b065a10e24

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-10-06 06:49:23 +08:00
Jongwook Choi
d5ae5c84e9
feat(lua): completion for vim.fn, vim.v, vim.o #30472
Problem: Lua accessors for
- global, local, and special variables (`vim.{g,t,w,b,v}.*`), and
- options (`vim.{o,bo,wo,opt,opt_local,opt_global}.*`),

do not have command-line completion, unlike their vimscript counterparts
(e.g., `g:`, `b:`, `:set`, `:setlocal`, `:call <fn>`, etc.).

Completion for vimscript functions (`vim.fn.*`) is incomplete and does
not list all the available functions.

Solution: Implement completion for vimscript function, variable and
option accessors in `vim._expand_pat` through:

- `getcompletion()` for variable and vimscript function accessors, and
- `nvim_get_all_options_info()` for option accessors.

Note/Remark:

- Short names for options are yet to be implemented.

- Completions for accessors with handles (e.g. `vim.b[0]`, `vim.wo[0]`)
  are also yet to be implemented, and are left as future work, which
  involves some refactoring of options.

- For performance reasons, we may want to introduce caching for
  completing options, but this is not considered at this time since the
  number of the available options is not very big (only ~350) and Lua
  completion for option accessors appears to be pretty fast.

- Can we have a more "general" framework for customizing completions?
  In the future, we may want to improve the implementation by moving the
  core logic for generating completion candidates to each accessor (or
  its metatable) or through some central interface, rather than writing
  all the accessor-specific completion implementations in a single
  function: `vim._expand_pat`.
2024-10-04 06:48:31 -07:00
zeertzjq
86c5c8724b
fix(mouse): indicate X1 and X2 button clicks on statusline (#30655) 2024-10-04 21:31:28 +08:00
Justin M. Keyes
b45c50f314
docs: render @since versions, 0 means experimental #30649
An implication of this current approach is that `NVIM_API_LEVEL` should be
bumped when a new Lua function is added.

TODO(future): add a lint check which requires `@since` on all new functions.

ref #25416
2024-10-04 02:13:31 -07:00
James Trew
385fbfb3e7
docs: improve luacats support #30580
Some composite/compound types even as basic as `(string|number)[]` are
not currently supported by the luacats LPEG grammar used by gen_vimdoc.
It would be parsed & rendered as just `string|number`.

Changeset adds better support for these types.
2024-10-03 03:45:51 -07:00
glepnir
cc300e553b
vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636)
Problem:  missing change from patch v9.1.0754
Solution: use correct width for the actual item
          in pum_redraw() (glepnir)

closes: vim/vim#15786

a6d9e3c4e0
2024-10-03 09:58:15 +00:00
zeertzjq
ae0e4071a8
vim-patch:9.1.0755: quickfix list does not handle hardlinks well (#30637)
Problem:  quickfix list does not handle hardlinks well
Solution: store original file name with quickfix entry
          (Austin Chang)

Quickfix list shows entries with duplicate name if the file is opened
with the path of hard links.

The major cause is that qflist assumed that the filename passed into
`qf_add_entry` matches the filename opened with the buffer.

This patch handles this case by introduce a `qf_fname` into `qfline_S`
structure. It stores the filename from `qf_add_entry` for each quickfix
line.

closes: vim/vim#15687

2982299699

Co-authored-by: Austin Chang <austin880625@gmail.com>
2024-10-03 09:44:04 +00:00
fredizzimo
7eba016c86
fix(ui): ensure screen update before waiting for input #30576
Ensure the screen is fully updated before blocking for input. This did
not always happen before, for example when setting `cursorline
scrolloff=9999`, which lead to jerky movement when using some GUI
applications.

Because of the duality of redraw_later, this can't be done in
command-line or when waiting for "Press ENTER". In many of those cases
the redraw is expected AFTER the key press, while normally it should
update the screen immediately. So, those special cases are excluded.
2024-10-03 02:31:17 -07:00
glepnir
6a2f8958e8
vim-patch:9.1.0754: fixed order of items in insert-mode completion menu (#30619)
Problem:  fixed order of items in insert-mode completion menu
Solution: Introduce the 'completeitemalign' option with default
          value "abbr,kind,menu" (glepnir).

Adding an new option `completeitemalign` abbr is `cia` to custom
the complete-item order in popupmenu.

closes: vim/vim#14006
closes: vim/vim#15760

6a89c94a9e
2024-10-03 06:45:01 +08:00
Justin M. Keyes
bbf208784c tests: skip watch.watchdirs test on macos 14 CI
Problem:
Strange failure only in macos 14 CI

    FAILED   test/functional/lua/watch_spec.lua @ 82: vim._watch watchdirs() detects file changes
    test/functional/lua/watch_spec.lua:149: Expected objects to be the same.
    Passed in:
    (table: 0x0116023758) {
     *[1] = {
        [change_type] = 3
       *[path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/nvim_KFMvPbXk9a' }
      [2] = {
        [change_type] = 3
        [path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' } }
    Expected:
    (table: 0x010d9d6548) {
     *[1] = {
        [change_type] = 1
       *[path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' }
      [2] = {
        [change_type] = 3
        [path] = '/Users/runner/work/neovim/neovim/build/Xtest_tmpdir/nvim_KFMvPbXk9a/file' } }

    stack traceback:
            test/functional/lua/watch_spec.lua:149: in function <test/functional/lua/watch_spec.lua:82>

Solution:
Skip test for that exact version.
2024-10-02 16:41:01 +02:00
Justin M. Keyes
9e23b4e185 fix(watch): ignore nonexistent paths (ENOENT)
Problem:
The `_watch.watch()` strategy may fail if the given path does not exist:

    …/vim/_watch.lua:101: ENOENT: no such file or directory
    stack traceback:
        [C]: in function 'assert'
        …/vim/_watch.lua:101: in function <…/vim/_watch.lua:61>
        [string "<nvim>"]:5: in main chunk

- `_watch.watch()` actively asserts any error returned by `handle:start()`.
- whereas `_watch.watchdirs()` just ignores the result of `root_handle:start()`.

Servers may send "client/registerCapability" with "workspace/didChangeWatchedFiles"
item(s) (`baseUri`) which do not actually exist on the filesystem:
https://github.com/neovim/neovim/issues/28058#issuecomment-2189929424

    {
      method = "client/registerCapability",
      params = {
        registrations = { {
            method = "workspace/didChangeWatchedFiles",
            registerOptions = {
              watchers = { {
                  globPattern = {
                    baseUri = "file:///Users/does/not/exist",
                    pattern = "**/*.{ts,js,mts,mjs,cjs,cts,json,svelte}"
                  }
                },
    ...
    }

Solution:
- Remove the assert in `_watch.watch()`.
- Show a once-only message for both cases.
- More detailed logging is blocked until we have `nvim_log` / `vim.log`.

fix #28058
2024-10-02 16:41:01 +02:00
zeertzjq
0e484c2041
vim-patch:9.1.0753: Wrong display when typing in diff mode with 'smoothscroll' (#30614)
Problem:  Wrong display when typing in diff mode with 'smoothscroll'.
Solution: Use adjust_plines_for_skipcol() (zeertzjq).

closes: vim/vim#15776

47f8584a80
2024-10-01 22:55:43 +00:00
zeertzjq
1c30d86c33
fix(tabline): restore behavior of click after last tabpage (#30602)
Also correct the comments about tabpage labels in custom tabline.
2024-10-01 19:46:30 +08:00
Christian Clason
ea9d61b80d vim-patch:9.1.0749: filetype: http files not recognized
Problem:  filetype: http files not recognized
Solution: detect '*.http' as http filetype, include
          http filetype plugin (Riley Bruins)

Based on the specification found
[here](https://github.com/JetBrains/http-request-in-editor-spec/blob/master/spec.md)

closes: vim/vim#15762

de6c1d1182

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2024-10-01 07:33:08 +02:00
Lewis Russell
0fb5299e53 test: refactor exec_lua in xdiff_spec 2024-09-30 11:51:33 +01:00