Commit Graph

6905 Commits

Author SHA1 Message Date
Tim Pope
4541189052 fix(lsp): support workspace/configuation with no section 2024-02-17 17:53:49 -05:00
bfredl
2accf24805 fix(decorations): crash with revised mark with changed decoration flags
fixes #27211
2024-02-17 18:22:35 +01:00
zeertzjq
848fc8ede8
test: more tests for nvim_eval_statusline "fillchar" (#27502) 2024-02-17 08:45:35 +08:00
luukvbaal
5fd1bac65e
fix(api): don't use stl 'fillchar' for "use_statuscol_lnum" (#27501)
Problem:  nvim_eval_statusline() uses "stl" from 'fillchars' with "use_statuscol_lnum".
Solution: Reorder "fillchar" else chain.
2024-02-17 07:44:31 +08:00
Thomas Vigouroux
bd5008de07
fix(treesitter): correctly handle query quantifiers (#24738)
Query patterns can contain quantifiers (e.g. (foo)+ @bar), so a single
capture can map to multiple nodes. The iter_matches API can not handle
this situation because the match table incorrectly maps capture indices
to a single node instead of to an array of nodes.

The match table should be updated to map capture indices to an array of
nodes. However, this is a massively breaking change, so must be done
with a proper deprecation period.

`iter_matches`, `add_predicate` and `add_directive` must opt-in to the
correct behavior for backward compatibility. This is done with a new
"all" option. This option will become the default and removed after the
0.10 release.

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: MDeiml <matthias@deiml.net>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-02-16 11:54:47 -06:00
zeertzjq
51ea753747
fix(genvimvim): generate prefixed boolean options properly (#27487) 2024-02-16 13:27:42 +08:00
zeertzjq
c1fa8789c1 vim-patch:9.1.0112: Remove undo information, when cleaning quickfix buffer
Problem:  When the quickfix buffer has been modified an autocommand
          may invalidate the undo stack (kawarimidoll)
Solution: When clearing the quickfix buffer, also wipe the undo stack

fixes: vim/vim#13905
closes: vim/vim#13928

f0d3d4a426

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-16 07:18:06 +08:00
bfredl
d60412b18e refactor(eval): use arena when converting typvals to Object
Note: this contains two _temporary_ changes which can be reverted
once the Arena vs no-Arena distinction in API wrappers has been removed.
Both nlua_push_Object and object_to_vim_take_luaref() has been changed
to take the object argument as a pointer. This is not going to be
necessary once these are only used with arena (or not at all) allocated
Objects.

The object_to_vim() variant which leaves luaref untouched might need to
stay for a little longer.
2024-02-15 10:42:06 +01:00
Christian Clason
0a51e7626a vim-patch:9.1.0111: filetype: no support for bats files
The '*.bats' file type is for Bash Automated Testing System (BATS)
scripts. BATS scripts are Bash with a special '@test' extension but they
otherwise work with Vim's bash filetype.

See https://github.com/bats-core/bats-core

closes: vim/vim#14039

d00fb4b3a2

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
d0599b0ed9 vim-patch:9.1.0110: filetype: add 'Config.in' filetype detection
The 'Config.in' file type is for Buildroot configuration files.
Buildroot Config.in files use the same Kconfig backend as the Linux
kernel's Kconfig files.

Buildroot also has other filename variants that follow "Config.in.*",
they are used to distinguish multiple Config.in files in the same
directory.

See https://buildroot.org/downloads/manual/manual.html#_literal_config_in_literal_file

closes: vim/vim#14038

5f20f050ef

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
7ed75d410a vim-patch:9.1.0109: filetype: no support for its files
Problem:  filetype: no support for its files
Solution: Add detection for *.its files as dts file type
          (Brandon Maier)

The '*.its' file type is for U-Boot Flattened Image Trees (FIT) which
use the flattened devicetree format.

See https://github.com/u-boot/u-boot/blob/master/doc/usage/fit/source_file_format.rst#terminology

closes: vim/vim#14037

cf1d65e060

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
4f07ad7786 vim-patch:9.1.0108: filetype: no support for dtso files
Problem:  filetype: no support for dtso files
Solution: Add detection for *.dtso files as dts file type
          (Markus Schneider-Pargmann)

*.dtso files are devicetree overlay files which have the same syntax as dts or dtsi files.

closes: vim/vim#14026

b1700fb33f

Co-authored-by: Markus Schneider-Pargmann <msp@baylibre.com>
2024-02-15 10:01:16 +01:00
zeertzjq
31b3c62845 vim-patch:9.1.0106: Visual highlight hard to read with 'termguicolors'
Problem:  Visual highlight hard to read with 'termguicolors'
          (Maxim Kim)
Solution: Set Visual GUI foreground to black (with background=light)
          and lightgrey (with background=dark)
          (Maxim Kim)

fixes: vim/vim#14024
closes: vim/vim#14025

34e4a05d02

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 10:50:29 +08:00
Tomasz N
d09957e0a0
fix(lsp): rename: load and list new buffer if attached to window (#27408) 2024-02-14 21:11:29 +01:00
zeertzjq
a376d979bd
fix(extmarks): redraw line on adding/removing conceal (#27463) 2024-02-14 07:51:04 +08:00
zeertzjq
b2f7a3aaad
vim-patch:9.1.0105: Style: typos found (#27462)
Problem:  Style: typos found
Solution: correct them
          (zeertzjq)

closes: vim/vim#14023

e71022082d
2024-02-14 06:39:47 +08:00
Lewis Russell
9f8c96240d refactor(lsp): resolve the config-client entanglement
Previously the LSP-Client object contained some fields that are also
in the client config, but for a lot of other fields, the config was used
directly making the two objects vaguely entangled with either not having
a clear role.

Now the config object is treated purely as config (read-only) from the
client, and any fields the client needs from the config are now copied
in as additional fields.

This means:
- the config object is no longet normalised and is left as the user
  provided it.
- the client only reads the config on creation of the client and all
  other implementations now read the clients version of the fields.

In addition, internal support for multiple callbacks has been added to
the client so the client tracking logic (done in lua.lsp) can be done
more robustly instead of wrapping the user callbacks which may error.
2024-02-13 14:49:20 +00:00
bfredl
1a3a8d903e refactor(lua): use a keyset for vim.diff opts parsing 2024-02-13 11:54:44 +01:00
bfredl
0353dd3029 refactor(lua): use Arena when converting from lua stack to API args
and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.

NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.

as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
2024-02-13 11:54:44 +01:00
Jongwook Choi
89135cff03 fix(loader): remove cyclic dependency on vim.fs (when --luamod-dev)
Problem: Loading `vim.fs` via the `vim.loader` Lua package loader will
result in a stack overflow due to a cyclic dependency. This may happen
when the `vim.fs` module isn't byte-compiled, i.e. when `--luamod-dev`
is used (#27413).

Solution: `vim.loader` depends on `vim.fs`. Therefore `vim.fs` should
be loaded in advance.
2024-02-13 10:29:22 +00:00
zeertzjq
4860cc5bdc
vim-patch:9.1.0101: upper-case of German sharp s should be U+1E9E (#27449)
Problem:  upper-case of ß should be U+1E9E (CAPITAL LETTER SHARP S)
          (fenuks)
Solution: Make gU, ~ and g~ convert the U+00DF LATIN SMALL LETTER SHARP S (ß)
          to U+1E9E LATIN CAPITAL LETTER SHARP S (ẞ), update tests
          (glepnir)

This is part of Unicode 5.1.0 from April 2008, so should be fairly safe
to use now and since 2017 is part of the German standard orthography,
according to Wikipedia:
https://en.wikipedia.org/wiki/Capital_%E1%BA%9E#cite_note-auto-12

There is however one exception: UnicodeData.txt for U+00DF
LATIN SMALL LETTER SHARP S does NOT define U+1E9E LATIN CAPITAL LETTER
SHARP S as its upper case version. Therefore, toupper() won't be able
to convert from lower sharp s to upper case sharp s (the other way
around however works, since U+00DF is considered the lower case
character of U+1E9E and therefore tolower() works correctly for the
upper case version).

fixes: vim/vim#5573
closes: vim/vim#14018

bd1232a1fa

Co-authored-by: glepnir <glephunter@gmail.com>
2024-02-13 07:38:12 +08:00
zeertzjq
86458dde0e
vim-patch:9.1.0103: 'breakindentopt' "min" not correct with 'signcolumn' (#27451)
Problem:  'breakindentopt' "min" works incorrectly with 'signcolumn'.
Solution: Use win_col_off() and win_col_off2().
          (zeertzjq)

closes: vim/vim#14014

f0a9d65e0a
2024-02-13 07:33:24 +08:00
zeertzjq
2493fd020d
vim-patch:9.1.0102: settabvar() may change the last accessed tabpage (#27450)
Problem:  settabvar() may change the last accessed tabpage.
Solution: Save and restore lastused_tabpage.
          (zeertzjq)

closes: vim/vim#14017

b47fbb4083
2024-02-13 07:27:27 +08:00
Justin M. Keyes
0185152802
refactor(tests): get channel id via nvim_get_chan_info #27441
Minor "best practices" nudge.
2024-02-12 05:50:39 -08:00
bfredl
210ec3b7a9
Merge pull request #27348 from fredizzimo/fsundvik/fix-ext-hlstate
fix: crashes with large msgpack messages
2024-02-12 14:33:34 +01:00
zeertzjq
2d9e063a63
fix(extmarks): redraw pre-undo position (#27437)
Problem:
Virtual text not redrawn properly after undo moves its extmark.

Solution:
Redraw the moved extmark's pre-undo position.
2024-02-12 21:24:28 +08:00
Raphael
4682f158a0
vim-patch:9.1.0098: CompleteChanged not triggered when new leader added without matches (#27436)
Problem:  CompleteChanged not triggered when new leader added causing
          no matching item in the completion menu
Solution: When completion is active but no items matched still trigger
          CompleteChanged event
          (glepnir)

closes: vim/vim#13982

0d3c0a66a3

Fix #15077
2024-02-12 14:57:13 +08:00
zeertzjq
929e1b7f1c
perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)
Invalidation of most w_valid flags isn't needed when adding or removing
virtual text below cursor.
2024-02-12 13:02:27 +08:00
luukvbaal
5a4e0b837f
fix(column): use a single path for sign sorting (#27431)
Problem:  #25826 added a (duplicate) sign comparison function, which was
modified and strayed from the original in #27418.
Solution: Merge the two functions and add a display test that actually
tests for this order in addition to the legacy tests.
2024-02-12 06:41:44 +08:00
zeertzjq
9605cfe06c
vim-patch:9.1.0097: 'breakindent' behaves inconsistently with 'list' and splits (#27432)
Problem:  'breakindent' behaves inconsistently with 'list' and splits.
Solution: Use 'listchars' from the correct window and handle caching
          properly. Move cheaper comparisons to the top.
          (zeertzjq)

closes: vim/vim#14008

efabd7c8d4
2024-02-12 06:34:16 +08:00
VanaIgr
3faedb0509
refactor(indent): refactor computing of a string's indent size (#27252)
The `get_indent_str_vtab()` function currently calls `tabstop_padding()`
every time a tab is encountered (unless tabstops aren't used).
`tabstop_padding()` either does a division by 'tabstop' If 'vartabstop'
is not set, or iterates through the 'vartabstop' list to find current
tab width. 

Since the virtual column only increases, we can keep track of where the
next tabstop would be, and update this information once it was reached.

`get_indent_str_vtab()` also depends on 'listchars' "tab" value from the
current window, even though it may be called for a line from the same
buffer in a different window. In most cases, it is called with tabstops
enabled (last argument was `false`), so I split the function into one
that uses tabstops and the other that doesn't.

I removed `get_indent_str()` since I couldn't find any calls to it.
2024-02-12 04:17:15 +08:00
Lewis Russell
ed1b66bd99
refactor(lsp): move more code to client.lua
The dispatchers used by the RPC client should be defined in the client,
so they have been moved there. Due to this, it also made sense to move
all code related to client configuration and the creation of the RPC
client there too.

Now vim.lsp.start_client is significantly simplified and now mostly
contains logic for tracking open clients.

- Renamed client.new -> client.start
2024-02-11 12:37:20 +00:00
zeertzjq
ca258db156
fix(messages): clear new lines when increasing 'cmdheight' (#27421) 2024-02-11 18:12:56 +08:00
Trevor Arjeski
170c890dca
feat(shortmess): "q" flag fully hides recording message (#27415)
When "q" is set in 'shortmess' it now fully hides the "recording @a" message
when you are recording a macro instead of just shortening to "recording". This
removes duplication when using reg_recording() in the statusline.

Related #19193
2024-02-11 07:39:39 +08:00
zeertzjq
4948fa42ef
test(ui/mouse_spec): make sure click is processed (#27412) 2024-02-10 12:57:40 +08:00
Raphael
7ab003ec79
vim-patch:9.1.0087: Restoring lastused_tabpage too early in do_arg_all() (#27411)
Problem:  Restore lastused_tabpage too early in do_arg_all() function it
          will change later in the function.
Solution: Restore lastused_tabpage a bit later, when being done with
          tabpages (glepnir)

closes: vim/vim#13992

2975a54f28
2024-02-10 12:21:31 +08:00
zeertzjq
ba23d109ba
test: add test for scroll wheel at right-click menu (#27409) 2024-02-10 11:54:26 +08:00
Pablo Arias
8e739af064
fix(startup): multiprocess startuptime #26790
Problem:
Since 2448816956, the --startuptime report shows
two blocks of data. The TUI process and its embedded nvim process write to the
file concurrently, which may interleave the two startup sequences into the same
timeline.

Solution:
Report each process as a separate section in the same file.
1. Each process buffers the full report.
2. After startup is finished, the buffer is flushed (appended) to the file.

Fix #23036
Sample report:

    --- Startup times for process: Primary/TUI ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.428  000.422: event init
    000.728  000.301: early init
    ...
    005.880  000.713: init highlight
    005.882  000.002: --- NVIM STARTED ---

    --- Startup times for process: Embedded ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.409  000.403: event init
    000.557  000.148: early init
    000.633  000.077: locale set
    ...
    014.383  000.430: first screen update
    014.387  000.003: --- NVIM STARTED ---
2024-02-09 14:56:52 -08:00
zeertzjq
3f419d84fb
vim-patch:9.1.0088: TextChanged not triggered for :norm! commands (#27405)
Problem:  TextChanged not triggered for :norm! commands
          (machakann, after v9.0.2031)
Solution: Only reset curbuf->b_last_changedtick if TextChangedI
          was triggered in insert mode (and not blocked)

Note: for unknown reasons, the test fails on Windows (but seems to work
fine when running interactively)

fixes: vim/vim#13967
closes: vim/vim#13984

c9e79e5284

Cherry-pick test_autocmd.vim change from patch 8.2.4149.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-10 06:53:26 +08:00
zeertzjq
0d4d3e4325
vim-patch:9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak' (#27404)
Problem:  Visual hl wrong when it ends before multibyte 'showbreak'.
          (lacygoil)
Solution: Use vcol_sbr instead of adding n_extra.
          (zeertzjq)

fixes: vim/vim#11272
closes: vim/vim#13996

df23d7f4bd

Bug doesn't apply to Nvim.
2024-02-10 06:53:10 +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
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
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
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
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
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