Commit Graph

28557 Commits

Author SHA1 Message Date
Maximilian Fricke
70a0049296
fix(runtime): source c ftplugins in correct order (#27377) 2024-02-08 07:42:16 +08:00
zeertzjq
5785c32f11
fix(lsp): set fallback client name properly 2024-02-08 07:34:38 +08:00
Lewis Russell
59cf827f99 refactor(lsp): move client code to a regular Lua class
Problem:
  The LSP client code is implemented as a complicated closure-class
  (class defined in a single function).

Solution:
  Move LSP client code to a more conventional Lua class and move to a
  separate file.
2024-02-07 19:48:37 +00:00
VanaIgr
cca8a78ea2
perf: improve utf_char2cells() performance (#27353)
`utf_char2cells()` calls `utf_printable()` twice (sometimes indirectly,
through `vim_isprintc()`) for characters >= 128. The function can be
refactored to call to it only once.

`utf_printable()` uses binary search on ranges of unprintable characters
to determine if a given character is printable. Since there are only 9
ranges, and the first range contains only one character, binary search
can be replaced with SSE2 SIMD comparisons that check 8 ranges at a
time, and the first range is checked separately. SSE2 is enabled by
default in GCC, Clang and MSVC for x86-64.

Add 3-byte utf-8 to screenpos_spec benchmarks.
2024-02-07 15:03:45 +08:00
zeertzjq
6725565258
fix(event-loop): process input before events (#27358)
Problem:
When nvim_input is followed immediately by non-fast events on RPC, both
events and input are available after the polling done by the os_inchar()
in state_enter(), but state_enter() then chooses to process events even
if input is available, which is inconsistent with state_handle_k_event()
that stops processing events once input is available.

Solution:
Also check for available input after the os_inchar() in state_enter().
2024-02-07 12:11:22 +08:00
altermo
c0b99bb1de
feat(treesitter): show root nodes in :InspectTree (#26944)
Co-authored-by: altermo <>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-02-06 14:51:53 -06:00
Lewis Russell
c4417ae70c fix(doc): prevent doxygen confusion 2024-02-06 15:29:01 +00:00
zeertzjq
0db6946b39
fix(column): handle w_redr_statuscol at end filler lines (#27365)
There doesn't seem to be an easy solution that doesn't involve a goto.
Also remove duplicate assignment in win_line().
2024-02-06 23:01:44 +08:00
dundargoc
7f4627fe48 ci(release): bump mac runner version to macos-12 2024-02-06 14:57:19 +01:00
Lewis Russell
3be2536ca0 fix(lsp): send back diagnostic tags to the server
Fixes: #27318
2024-02-06 12:35:31 +00:00
zeertzjq
7fa84f32e7
vim-patch:9.1.0079: LineNrAbove/Below highlighting wrong on wrapped lines (#27363)
Problem:  LineNrAbove and LineNrBelow background wrong on wrapped lines.
Solution: Update number column also for wrapped part of a line.
          (zeertzjq)

closes: vim/vim#13974

ebfd856cfd

Cherry-pick test_number.vim changes from patch 9.0.0626.
2024-02-06 20:18:23 +08:00
dundargoc
63b810c9d8
docs: small fixes (#27213)
Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com>
2024-02-06 19:30:02 +08:00
Christian Clason
9a761019da vim-patch:f7f33e3719c8
runtime(dosbatch): improve '::' comment highlighting

Added a syntax region for command blocks so that the highlighting of
`::` comments in them can be controlled.  The `dosbatch_colons_comment`
variable now controls if all `::` comments in a code block are
highlighted as comments or errors.  A `::` comment at the end of a
command block is always highlighted as an error.

This re-enables the highlighting of `::` comments in `.bat` files as
requested in vim/vim#13666, while allowing control of highlighting them in
command blocks requested in vim/vim#11778 and first attempted in vim/vim#11980.

related: vim/vim#11980
fixes: vim/vim#13666

f7f33e3719

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Mike Williams <mikew@globalgraphics.com>
2024-02-06 11:42:15 +01:00
zeertzjq
a945a31e76
vim-patch:9.1.0077: Unnecessary call to redraw_for_cursorline() in nv_mousescroll() (#27359)
Problem:  The call to redraw_for_cursorline() in nv_mousescroll() is
          unnecessary because redraw_for_cursorline() only sets redraw
          type to UPD_VALID, and all code paths in do_mousescroll()
          already set redraw type to at least UPD_VALID.
Solution: Remove call to redraw_for_cursorline() in nv_mousescroll().
          (zeertzjq)

closes: vim/vim#13979

3f1b5312e0
2024-02-06 18:05:06 +08:00
zeertzjq
d6fac187f1
test(tui_spec): prevent race between nvim_input and nvim_paste (#27356) 2024-02-06 14:05:49 +08:00
zeertzjq
f6042d5c30
test: add test for 'foldcolumn' with cmdwin (#27355) 2024-02-06 11:44:53 +08:00
Sean Dewar
b3bda2f043
fix(tui): space_buf overflow when clearing screen (#27352)
Problem: `tui->space_buf` may be smaller than the width of the TUI or widest
grid, causing an overflow when calling `tui_grid_clear` if `print_spaces` is
called from `clear_region` (clears the TUI's screen since #23428).

Solution: resize `space_buf` to be wide enough to fit the TUI or widest grid.

Didn't bother shrinking the allocation if the max widths decrease.
2024-02-06 01:13:35 +00:00
Gregory Anders
abfcdd9bf4
Merge pull request #27295 from wookayin/feat/inspecttree
feat(treesitter): use 0-based indexing to show ranges in `:InspectTree`
2024-02-05 15:59:25 -06:00
Jongwook Choi
f4a3c32631 test(treesitter): add test cases for inspect_tree
Co-authored-by: altermo <107814000+altermo@users.noreply.github.com>
2024-02-05 16:23:22 -05:00
Jongwook Choi
a478bf936b feat(treesitter): use 0-based indexing to show ranges in :InspectTree
Problem:

- `:InspectTree` was showing node ranges in 1-based indexing, i.e., in
  vim cursor position (lnum, col). However, treesitter API adopts
  0-based indexing to represent ranges (Range4). This can often be
  confusing for developers and plugin authors when debugging code
  written with treesiter APIs.

Solution:

- Change to 0-based indexing from 1-based indexing to show node ranges
  in `:InspectTree`.

- Note: To make things not complicated, we do not provide an option or
  keymap to configure which indexing mode to use.
2024-02-05 16:23:22 -05:00
Maria José Solano
0e9a33572d fix(lsp): handle adjacent snippet tabstops 2024-02-05 15:03:46 +00:00
Lewis Russell
43661a0abf
Merge pull request #27328 from wookayin/fix/lsp-tagfunc 2024-02-05 10:35:25 +00:00
zeertzjq
d184933cdc
fix(redraw): update Visual selection properly with splits (#27343) 2024-02-05 15:34:17 +08:00
zeertzjq
35ffe58ea4
fix(inccommand): update topline after moving cursor (#27341) 2024-02-05 12:13:21 +08:00
zeertzjq
18e62c1bdb
perf(redraw): only redraw Visual area when cursor has moved (#27340) 2024-02-05 11:08:52 +08:00
Christian Clason
1ed6b9cd2c build(deps): bump luajit to HEAD - 0d313b243 2024-02-04 20:58:14 +01:00
altermo
6c8387067d fix(treesitter): inspect-tree remember opts on buf change 2024-02-04 15:53:29 +00:00
Christian Clason
1d5f86f694 vim-patch:9.1.0076: luau config file not detected
Problem:  luau config file not detected
          (lopy)
Solution: Detect it as jsonc
          (lopy)

fixes: vim/vim#13960
closes: vim/vim#13970

de7f5bde6c

Co-authored-by: lopy <70210066+lopi-py@users.noreply.github.com>
2024-02-04 11:14:40 +01:00
Raphael
21df0cdb88
vim-patch:9.1.0075: insert completion not correct when adding new leader (#27332)
Problem:  insert completion not correct when adding new leader
Solution: Reset compl_curr_match to compl_shown_match
          (glepnir)

closes: vim/vim#13957

cbb46b4398
2024-02-04 11:12:31 +08:00
zeertzjq
cd3399f6bd
vim-patch:7c5aeaffa2be (#27327)
runtime(vim): Update syntax file (vim/vim#13969)

Improve string interpolation highlighting.

Use the vimSep group to highlight interpolation braces as vimOperParen
has no highlighting of its own and employs vimSep via matchgroup.

Add vimNumber to the interpolation group's contained list.

7c5aeaffa2

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-04 07:09:54 +08:00
zeertzjq
c8055c4a8d
Merge pull request #27326 from zeertzjq/vim-9.1.0073
vim-patch:9.1.{0073,0074}
2024-02-04 07:05:03 +08:00
Jongwook Choi
b92b9be85d test(lsp): add test cases for vim.lsp.tagfunc
Problem: There is no test case for vim.lsp.tagfunc; so CI was unable to
catch the infinite loop bug (#27325).

Solution: Add test cases for vim.lsp.tagfunc().
2024-02-03 18:01:12 -05:00
Jongwook Choi
f487e5af01 fix(lsp): fix infinite loop on vim.lsp.tagfunc
Problem: vim.lsp.tagfunc() causes an infinite loop.

This is a bug happened while introducing deferred loading.

Solution: Rename the private module to `vim.lsp._tagfunc`.
2024-02-03 17:47:56 -05:00
zeertzjq
80d7e7e5bf vim-patch:9.1.0074: did_set_breakat() should be in optionstr.c
Problem:  did_set_breakat() should be in optionstr.c as 'breakat' is a
          string option.
Solution: Move did_set_breakat() to optionstr.c.
          (zeertzjq)

closes: vim/vim#13958

eac3fdcfa0
2024-02-04 06:46:15 +08:00
zeertzjq
60701f4fff vim-patch:9.1.0073: Looping over modifier_keys_table unnecessarily
Problem:  Looping over modifier_keys_table[] unnecessarily with only
          MOD_MASK_ALT or MOD_MASK_CMD, as modifier_keys_table[] only
          contains MOD_MASK_SHIFT and MOD_MASK_CTRL, and the loop won't
          do anything.
Solution: Remove MOD_MASK_ALT and MOD_MASK_CMD from the condition.
          (zeertzjq)

closes: vim/vim#13963

0c989e4a3a
2024-02-04 06:46:09 +08:00
zeertzjq
c559ab0ae6
feat: update unicode tables (#27317) 2024-02-04 06:28:51 +08:00
dundargoc
2e982f1aad refactor: create function for deferred loading
The benefit of this is that users only pay for what they use. If e.g.
only `vim.lsp.buf_get_clients()` is called then they don't need to load
all modules under `vim.lsp` which could lead to significant startuptime
saving.

Also `vim.lsp.module` is a bit nicer to user compared to
`require("vim.lsp.module")`.

This isn't used for some nested modules such as `filetype` as it breaks
tests with error messages such as "attempt to index field 'detect'".
It's not entirely certain the reason for this, but it is likely it is
due to filetype being precompiled which would imply deferred loading
isn't needed for performance reasons.
2024-02-03 16:53:41 +01:00
Raphael
51702e0aea
refactor(strcase_save): optimize memory allocation (#27319)
Problem: Double xmalloc usage led to excess memory allocations.
Solution: Switch to xrealloc to adjust memory as needed, minimizing allocations.
2024-02-03 15:29:05 +08:00
zeertzjq
6709f7f8f1
fix(keycodes): simplify S- properly when D- is present (#27316) 2024-02-03 11:05:38 +08:00
zeertzjq
9ab9cde2ca
vim-patch:partial:9.0.1196: code is indented more than necessary (#27315)
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11813)

e857598896

Skip list_alloc_with_items().

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-03 10:22:11 +08:00
zeertzjq
1f40b4e222
vim-patch:9.0.1105: code is indented too much (#27314)
Problem:    Code is indented too much.
Solution:   Use an early return. (Yegappan Lakshmanan, closes vim/vim#11756)

87c1cbbe98

Omit free_eval_tofree_later(): Vim9 script only.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-03 09:42:04 +08:00
zeertzjq
be1d09c427
fix(drawline): missing NUL termination when drawing TAB (#27307) 2024-02-02 22:31:57 +08:00
zeertzjq
fffc0e942d
test(old): correct path to .valgrind.supp (#27306) 2024-02-02 22:24:37 +08:00
zeertzjq
9b7cf4f0be
fix(vim.system): don't process non-fast events during wait() (#27300)
Problem:
Processing non-fast events during SystemObj:wait() may cause two pieces
of code to interfere with each other, and is different from jobwait().

Solution:
Don't process non-fast events during SystemObj:wait().
2024-02-02 21:52:01 +08:00
zeertzjq
e98decf9a6
feat(quickfix): support -q - to read 'errorfile' from stdin (#27303)
Note that this only works when stdin is a pipe.
2024-02-02 21:17:37 +08:00
Christian Clason
1bf645918e vim-patch:9204f39580bd
runtime(fortran): update syntax (vim/vim#13953)

* runtime (Fortran) update syntax
* runtime (Fortran) small fix

9204f39580

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-02-02 08:59:49 +01:00
luukvbaal
4a1ad676ce
feat(ex_cmds): no error on :lua with {range} and {code} (#27290)
Problem:  Erroring when both {range} and {code} are supplied to
          :lua is inconvenient and may break mappings.
Solution: Don't error, ignore {range} and execute {code} when both
          are supplied.
2024-02-02 13:14:10 +08:00
zeertzjq
1405e5c8c1
refactor(runtime): remove nvimMap and nvimUnmap syntax groups (#27298)
They are no longer needed as they are covered by vimMap and vimUnmap.
Also fix some other mistakes and missing changes.
2024-02-02 10:45:15 +08:00
zeertzjq
302fa5f7db
Merge pull request #27297 from zeertzjq/vim-e3e3934bb182
vim-patch:69866449ddb2,e3e3934bb182
2024-02-02 07:09:56 +08:00
zeertzjq
11acbd6df4 vim-patch:e3e3934bb182
runtime(vim): Update syntax file (vim/vim#13948)

Improve string escape sequence and special key matching.

e3e3934bb1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-02 06:46:11 +08:00