Commit Graph

28581 Commits

Author SHA1 Message Date
Maria José Solano
0fe86f7e24 feat(lsp): add opts paramater to vim.lsp.codelens.refresh 2024-02-08 20:24:40 -08:00
ite-usagi
32b49448b2
feat(tutor): add Japanese tutor #27268
Add Japanese Tutor
2024-02-08 14:43:18 -08:00
Tomasz N
f0e61e6d92
fix(lsp): rename fails on missing parent directory #27291
Problem:
If a rename results in a path that has missing parent directory(s), it
will fail.

Solution:
Do a recursive mkdir before attempting the rename.
2024-02-08 13:06:54 -08:00
bfredl
52b6a9a93b
Merge pull request #27391 from bfredl/arenarock
refactor(api): refactor more api functions to use arena return
2024-02-08 18:54:00 +01:00
Lewis Russell
451bc50d40 feat(lsp): deprecate severity_limit
Problem:
  `vim.lsp.diagnostic.on_diagnostic` accepts an undocumented severity_limit
  option which is widely used.

Solution:
  Deprecate it in favour of `{min = severity}` used in `vim.diagnostic`.
  Since this is undocumented, the schedule for removal is accelerated to
  0.11.
2024-02-08 16:58:49 +00:00
Robert O'Shea
5c36701228
docs(install): add more Linux install instructions #27350 2024-02-08 06:55:53 -08:00
Lewis Russell
2f6d5588f3 Revert "fixup! add benchmark"
This reverts commit b0bff57a3b.
2024-02-08 14:55:09 +00:00
Lewis Russell
b0bff57a3b fixup! add benchmark 2024-02-08 14:54:36 +00:00
bfredl
af5beac1bd refactor(api): refactor more api functions to use arena return
Currently having two separate memory strategies for API return values is
a bit unnecessary, and mostly a consequence of converting the hot spot
cases which needed it first. But there is really no downside to using
arena everywhere (which implies also directly using strings which are
allocated earlier or even statically, without copy).

There only restriction is we need to know the size of arrays in advance,
but this info can often be passed on from some earlier stage if it is
missing.

This collects some "small" cases. The more complex stuff will get a PR
each.
2024-02-08 14:40:34 +01:00
Jongwook Choi
d0e9e36a78 refactor(treesitter): {start,stop} are optional in Query:iter_* methods
Document that the `start` and `stop` parameters in
`Query:iter_captures()` and `Query:iter_matches()` are optional.

The tree-sitter lib has been bumped up to 0.20.9, so we also no longer
need "Requires treesitter >= 0.20.9".
2024-02-08 12:42:19 +00:00
Jongwook Choi
800134ea5e refactor(treesitter): typing for Query, TSQuery, and TSQueryInfo
- `TSQuery`: userdata object for parsed query.

- `vim.treesitter.Query`: renamed from `Query`.
  - Add a new field `lang`.

- `TSQueryInfo`:
  - Move to `vim/treesitter/_meta.lua`, because C code owns it.
  - Correct typing for `patterns`, should be a map from `integer`
    (pattern_id) to `(integer|string)[][]` (list of predicates or
    directives).

- `vim.treesitter.QueryInfo` is added.
  - This currently has the same structure as `TSQueryInfo` (exported
    from C code).
  - Document the fields (see `TSQuery:inspect`).

- Add typing for `vim._ts_parse_query()`.
2024-02-08 12:40:16 +00:00
zeertzjq
8b21fe83da
Merge pull request #27388 from zeertzjq/vim-9.1.0082
vim-patch:9.1.{0082,0083}: redrawing can be improved
2024-02-08 19:37:41 +08:00
zeertzjq
da3facb7ee vim-patch:9.1.0083: Redrawing can be improved when deleting lines with 'number'
Problem:  Redrawing can be improved when inserting/deleting lines with 'number'.
Solution: Only redraw the number column of lines below changed lines.
          Add a test as this wasn't previously tested.
          (zeertzjq)

closes: vim/vim#13985

ae07ebc04b
2024-02-08 19:20:07 +08:00
zeertzjq
1c2b9e8dd8 vim-patch:9.1.0082: Redrawing can be improved when deleting lines with 'cursorline'
Problem:  Redrawing can be improved when deleting lines with 'cursorline'.
Solution: Use smarter invalidation and adjustment.  Remove unnecessary
          UPD_VALID as it is already set at the top of the loop.  Make
          the test for vim/vim#4862 fail without the fix.
          (zeertzjq)

closes: vim/vim#13986

7ce34c9a94
2024-02-08 19:20:07 +08:00
Lewis Russell
1f9da3d083 refactor(lsp): tidy up logging 2024-02-08 11:11:46 +00:00
zeertzjq
2a7c4aca42
vim-patch:b8170143c8f8 (#27387)
runtime(doc): further improve docs about List/Blob += operator

closes: vim/vim#13990

b8170143c8
2024-02-08 19:07:31 +08:00
nikolightsaber
b162adbb7c
feat(api): pass 0 to nvim_get_chan_info for current channel (#27321)
Getting current channel info was kind of annoying via RPC. Two
functions had to be called:
1. `nvim_get_api_info` which returns `[channel_id, meta_data]`.
  - This results in `channel_id = api.nvim_get_api_info()[0]`.
  - Here the meta_data is sent but never used.
2. Finally call `nvim_get_chan_info(channel_id)`.

This commit reduces the need for `nvim_get_api_info` as passing 0
returns current channel info.
2024-02-08 18:59:31 +08:00
bfredl
3f2d543ee8
Merge pull request #27284 from bfredl/unkeydict
refactor(api): use keydict and arena for more api return values
2024-02-08 11:43:27 +01:00
bfredl
ca2635adf9 refactor(generators): style of generating and generated lua dispatch code 2024-02-08 11:14:01 +01:00
bfredl
f9d81c43d2 refactor(api): use keydict and arena for more api return values
Implement api_keydict_to_dict as the complement to api_dict_to_keydict

Fix a conversion error when nvim_get_win_config gets called from lua,
where Float values "x" and "y" didn't get converted to lua numbers.
2024-02-08 11:14:01 +01:00
Christian Clason
02cc84b4d9 build(deps): bump libuv to v1.48.0 2024-02-08 10:19:50 +01:00
zeertzjq
24d26b4cd1
Merge pull request #27379 from zeertzjq/vim-9.1.0080
vim-patch:partial:9.1.0080,c9c2e2d2ff44
2024-02-08 08:50:42 +08:00
zeertzjq
ceed5739e0 vim-patch:c9c2e2d2ff44
runtime(doc): Clarify list-concatenation a bit more

Make doc list-concatenation more clear as for += and extend().

1. describe `+=` for list-concatenation more accurately
2. add `extend()` example for list-concatenation
3. Fix CI errors for missing helptags reference |+=|

closes: vim/vim#13983

c9c2e2d2ff

Co-authored-by: qeatzy <qeatzy@users.noreply.github.com>
2024-02-08 08:09:01 +08:00
zeertzjq
d75022d205 vim-patch:partial:9.1.0080: unexpected error for modifying final list using +=
Problem:  unexpected error for modifying final list using += operator
          (Ernie Rael)
Solution: Allow List value modification of a final variable using +=
          operator
          (Yegappan Lakshmanan)

fixes: vim/vim#13745
fixes: vim/vim#13959
closes: vim/vim#13962

1af35631f8

Only port eval.txt changes.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-08 08:08:18 +08:00
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