Commit Graph

29071 Commits

Author SHA1 Message Date
zeertzjq
881f5e5917
vim-patch:9.1.0199: Not enough tests for the slice() function (#27991)
Problem:  Not enough tests for the slice() function.
Solution: Test with multibyte chars, and in both Legacy and Vim9 script.
          Update docs to be clearer about how it treats composing chars.
          (zeertzjq)

closes: vim/vim#14275

ad38769030
2024-03-23 16:33:53 +08:00
zeertzjq
2955c921ce
fix(filetype): use unexpanded file name (#27931)
When the edited file is a symlink, the unexpanded file name is needed to
to achieve the same behavior as the autocommand pattern matching in Vim.
Neither args.file nor args.match are guaranteed to be unexpanded, so use
bufname() instead.
2024-03-23 11:46:23 +08:00
zeertzjq
a629888427
Merge pull request #27987 from zeertzjq/vim-8.2.2318
vim-patch:8.2.{2318,2605}
2024-03-23 08:26:57 +08:00
zeertzjq
d443b438f6 vim-patch:8.2.2605: Vim9: string index and slice does not include composing chars
Problem:    Vim9: string index and slice does not include composing chars.
Solution:   Include composing characters. (issue vim/vim#6563)

0289a093a4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-03-23 08:10:17 +08:00
zeertzjq
e4a23b6e0b vim-patch:8.2.2318: Vim9: string and list index work differently
Problem:    Vim9: string and list index work differently.
Solution:   Make string index work like list index. (closes vim/vim#7643)

e7525c5520

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-03-23 08:07:05 +08:00
zeertzjq
a44ac26c75
vim-patch:76d62985c1ff (#27985)
runtime(vim): Update base-syntax, remove old unused syntax groups. (vim/vim#14146)

Remove old unused syntax groups.

- vimRegion, vimPattern and vimKeyword removed in Vim 5.3.
- vimAuSyntax, vimAutoCmdOpt, vimAutoSet and vimStatement removed in 5.6.

The following were linked in :hi commands but never defined with :syn
and, most likely, never used:
 - vimHLMod introduced in 5.0.
 - vimKeycode and vimKeycodeError introduced in 5.4.
 - vimElseif introduced in 5.6.
 - vimFold introduced in 6.4.
 - vimOperStar (and vimoperStar) introduced in 9.0.

76d62985c1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-23 06:43:25 +08:00
Jaehwang Jung
849d82b80b
fix(lsp): handle stale bufnr on LspRequest autocmd trigger (#27981)
continuation of https://github.com/neovim/neovim/pull/24013
2024-03-22 17:46:01 +01:00
zeertzjq
dc110cba3c
Merge pull request #26970 from famiu/refactor/options/set_option_direct
refactor(options): remove `set_string_option_direct()`
2024-03-22 09:14:42 +08:00
zeertzjq
15c6909bb1
vim-patch:35e6f4ca27c8 (#27973)
runtime(vim): Update base-syntax, improve function definition highlighting (vim/vim#14203)

Improve function definition highlighting.

- Match bang and function modifiers - abort etc.
- Only match valid scope modifiers.
- Match listing commands.
- Don't match ex commands in function names.
- Split function syntax groups into :func and :def subgroups.
- Match Vim9-script parameter and return types.
- Limit legacy-script and Vim9-script comments to :func and :def
  definitions, respectively.

35e6f4ca27

Omit the vimFunctionError change as it's a whitespace-only change and
will likely be superseded by later patches.

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-22 07:31:43 +08:00
zeertzjq
50b2499306
Merge pull request #27971 from zeertzjq/vim-9.1.0192
vim-patch:9.1.{0192,0195}: drop: don't rewind when editing the same file
2024-03-22 06:28:55 +08:00
zeertzjq
dabc44d15c vim-patch:9.1.0195: memleak with ex_drop, NULL dereference
Problem:  memleak with ex_drop(), NULL dereference
          (zeertzjq)
Solution: revert back to ex_rewind(), use curbuf instead of buf

fixes: vim/vim#14246
closes: vim/vim#14251

85a769d466

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-03-22 06:04:37 +08:00
zeertzjq
271879dd49 vim-patch:9.1.0192: drop: don't rewind when editing the same file
Problem:  :drop tries to :rewind the argumentlist, which results in E37
          (after v9.1.0046)
Solution: instead of calling ex_rewind(), call open_buffer() only when
          re-using the initial empty buffer

fixes: vim/vim#14219
closes: vim/vim#14220

978178823b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-03-22 06:04:37 +08:00
zeertzjq
774455dc37
vim-patch:9.1.0194: gcc complains about uninitialized var (#27970)
Problem:  gcc complains about uninitialized var
          (Tony Mechelynck)
Solution: initialize to NULL

9eb236f455

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-03-22 06:04:11 +08:00
bfredl
2289ecd22e
Merge pull request #27969 from famiu/refactor/misc/xctz
refactor(misc): use MSVC compiler builtin for `xctz()`
2024-03-21 21:29:11 +01:00
Famiu Haque
1dde678757
refactor(misc): use MSVC compiler builtin for xctz()
Problem: `xctz()` uses a fallback algorithm for MSVC, even though a compiler builtin exists.

Solution: Make `xctz()` use the compiler builtin for MSVC compiler.
2024-03-22 01:43:53 +06:00
bfredl
563a369a1b
Merge pull request #27961 from bfredl/rpccrash
fix(rpc): do not crash when no input is consumed
2024-03-21 17:09:06 +01:00
bfredl
8921d56053 fix(rpc): do not crash when no input is consumed
fixes #23781

Co-authored-by: glacambre <code@lacamb.re>
2024-03-21 15:52:28 +01:00
Famiu Haque
58cc66ee1f
test(options): add test for 'modified' 2024-03-21 19:40:13 +06:00
Famiu Haque
2214f9c19d
refactor(options): remove set_string_option_direct()
Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options.

Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
2024-03-21 15:41:14 +06:00
Famiu Haque
5aa8c02a9d
refactor(options): add direct flag to set_option() 2024-03-21 15:41:14 +06:00
Famiu Haque
10ab135adf
refactor(options): restructure set_option 2024-03-21 15:21:01 +06:00
Evgeni Chasnovski
734848dc1a feat(colorscheme): add semantic tokens modifiers to builtin color scheme 2024-03-21 09:01:37 +01:00
Evgeni Chasnovski
45032a941d docs(lsp): describe semantic tokens highlight groups with more details
Problem: Description of highlight groups for LSP semantic tokens can be
  more up to date and useful.
  Right now it misses several actually defined highlight groups and
  presents information about Vim highlight groups they are linked to.
  This is both outdated (they link to tree-sitter `@` groups now) and
  redundant (users can see this information with `:Inspect` over the
  group name itself).

Solution: Synchronize the list of groups with specification and provide
  actionable descriptions.
2024-03-21 09:01:37 +01:00
zeertzjq
c1c6c1ee12
vim-patch:9.1.0190: complete_info() returns wrong order of items (#27955)
Problem:  complete_info() returns wrong order of items
          (after v9.0.2018)
Solution: Revert Patch v9.0.2018
          (Girish Palya)

bug fix: complete_info() gives wrong results

1) complete_info() reverses list of items during <c-p>
2) 'selected' item index is wrong during <c-p>
3) number of items returnd can be wrong

Solution:
- Decouple 'cp_number' from 'selected' index since they need not be
  correlated
- Do not iterate the list backwards
- Add targeted tests

Regression introduced by 69fb5afb3b
Following are unnecessary commits to patch problems from above:
fef6630166
daef8c7437

All the tests from above commits are retained though.

fixes: vim/vim#14204
closes: vim/vim#14241

8950bf7f8b

Remove EMPTY_IF_NULL() as it has been unnecessary since #12673.

Co-authored-by: Girish Palya <girishji@gmail.com>
2024-03-21 07:50:12 +08:00
Christian Clason
cfc9fcc91f vim-patch:2708c0b5854f
runtime(deb822sources): Add minimal ftplugin (vim/vim#14240)

Set comment related options and avoid automatic line wrapping.

2708c0b585

Co-authored-by: James McCoy <jamessan@jamessan.com>
2024-03-20 22:01:40 +01:00
luukvbaal
c72d877c33
fix(cmdline): wrong 'incsearch' highlighting after :redraw (#27947)
Problem:  Calling :redraw from a timer callback clears 'incsearch' highlighting.
Solution: Re-apply 'incsearch' highlighting if the screen was updated.
2024-03-20 21:59:04 +08:00
Justin M. Keyes
7549845e8d
Merge #27930 nvim_create_buf fixes 2024-03-20 06:15:38 -07:00
Lewis Russell
47388614cb refactor(treesitter): handle coverity warnings better 2024-03-20 12:22:54 +00:00
Lewis Russell
0f85aeb478 fix(treesitter): treecursor regression
- Also address some coverity warnings

Fixes #27942
2024-03-20 10:56:16 +00:00
zeertzjq
9765efb40f
test(ui/messages_spec): unskip msg_puts_printf test on Unix CI (#27941)
It no longer fails on Unix CI.
2024-03-20 08:02:50 +08:00
zeertzjq
37db3d97ea
vim-patch:ec21bafc135a (#27939)
runtime(vim): Update base-syntax, disallow '.' at start of menu item names (vim/vim#14232)

Disallow '.' at the start of a menu item name.

This is the menu path separator character and should be escaped with a
'\' in this case.

Partially fixes vim/vim#14230.  "popup" is still incorrectly matched as the Ex
command.

ec21bafc13

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-20 07:04:31 +08:00
Christian Clason
4694ce6877
vim-patch:9.1.0188: filetype: no support for Vento files (#27935)
Problem:  Vento files are not recognized.
Solution: Recognize *.vto files as filetype "vento" (wrapperup)

Vento is a templating engine https://vento.js.org/

closes: vim/vim#14229

9f26e5a9bc

Co-authored-by: wrapperup <wrapperup4@gmail.com>
2024-03-20 05:31:44 +08:00
Christian Clason
e39d9636af build(deps): bump vimdoc parser to v2.5.1 2024-03-19 20:44:05 +01:00
Lewis Russell
597d4c63bd refactor(treesitter): reorder functions 2024-03-19 18:40:08 +00:00
Lewis Russell
aca6c93002 refactor(treesitter): simplify argument checks for userdata 2024-03-19 16:16:54 +00:00
Sean Dewar
6091df6b7a
fix(api): nvim_create_buf assert fails if autocmds set &swapfile
Problem: assertion failure in nvim_create_buf if buflist_new autocommands open
a swapfile when "scratch" is set.

Solution: block autocommands when setting up the buffer; fire them later
instead.

Note that, unlike buflist_new, I don't check if autocommands aborted script
processing; the buffer is already created and configured at that point, so might
as well return the handle anyway.

Rather than repeat try_{start,end} and {un}block_autocmds for each relevant
operation, just do it at the start and near the end. This means that, if
TermResponse fires from unblock_autocmds for whatever reason, it can see the
buffer in an already configured state if we didn't bail due to an error (plus
it's probably a bit cleaner this way).
2024-03-19 16:13:52 +00:00
Sean Dewar
d5c23d72a5
fix(api): nvim_create_buf leaks memory if buffer is loaded early
Problem: memory leak in nvim_create_buf if buflist_new autocommands load the
new buffer early.

Solution: do not open a memfile in that case.
2024-03-19 15:43:08 +00:00
Lewis Russell
aca2048bcd refactor(treesitter): redesign query iterating
Problem:

  `TSNode:_rawquery()` is complicated, has known issues and the Lua and
  C code is awkwardly coupled (see logic with `active`).

Solution:

  - Add `TSQueryCursor` and `TSQueryMatch` bindings.
  - Replace `TSNode:_rawquery()` with `TSQueryCursor:next_capture()` and `TSQueryCursor:next_match()`
  - Do more stuff in Lua
  - API for `Query:iter_captures()` and `Query:iter_matches()` remains the same.
  - `treesitter.c` no longer contains any logic related to predicates.
  - Add `match_limit` option to `iter_matches()`. Default is still 256.
2024-03-19 14:24:59 +00:00
zeertzjq
16a416cb3c
fix(terminal): don't pass incomplete UTF-8 sequence to libvterm (#27922) 2024-03-19 16:56:51 +08:00
Christian Clason
c30ebb17f6 fix(treesitter): document more standard highlight groups
Problem: Not all standard treesitter groups are documented.

Solution: Document them all (without relying on fallback); add default
link for new `*.builtin` groups to `Special` and `@keyword.type` to
`Structure`. Remove `@markup.environment.*` which only made sense for
LaTeX.
2024-03-19 09:41:16 +01:00
Christian Clason
5e875ae8d0 feat(treesitter): update Markdown parsers and queries to v0.2.1 2024-03-19 09:41:16 +01:00
Christian Clason
ff6092b4ee feat(treesitter): update Bash parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Christian Clason
8a3385dde7 feat(treesitter): update Python parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Christian Clason
1384bebd5a feat(treesitter): update query parser to v0.2.0 2024-03-19 09:41:16 +01:00
Christian Clason
987dff6713 feat(treesitter): update Vimdoc parser and queries to v2.4.0 2024-03-19 09:41:16 +01:00
Christian Clason
20dcbaaaf8 feat(treesitter): update Vim parser and queries to v0.4.0 2024-03-19 09:41:16 +01:00
Christian Clason
aca4ad430b feat(treesitter): update Lua parser and queries to v0.1.0 2024-03-19 09:41:16 +01:00
Christian Clason
8dda630ae9 feat(treesitter): update C parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Christian Clason
ac99a0810e build(deps): bump tree-sitter to v0.22.2
release notes:
* https://github.com/tree-sitter/tree-sitter/releases/tag/v0.22.0
* https://github.com/tree-sitter/tree-sitter/releases/tag/v0.22.1
* https://github.com/tree-sitter/tree-sitter/releases/tag/v0.22.2
2024-03-19 09:41:16 +01:00
dundargoc
187ae67735 build: introduce variable DEPS_IGNORE_SHA for skipping dependency hash check
This will reduce friction as developers no longer need to provide a hash
when testing out different commits.

To skip the hash check, set `DEPS_IGNORE_SHA` to `TRUE` in
`cmake.deps/CMakeLists.txt`.
2024-03-19 08:52:03 +01:00