Commit Graph

28092 Commits

Author SHA1 Message Date
Gregory Anders
a3b3978474 feat(diagnostics): support numhl and linehl for diagnostic signs 2023-12-13 09:56:10 -06:00
Gregory Anders
39112c72dd docs(diagnostic): fix typo in example 2023-12-13 09:43:27 -06:00
Gregory Anders
29d5ff6ac4 fix(diagnostic): check for sign namespace instead of sign group 2023-12-13 09:30:13 -06:00
Raphael
8122470f83
refactor(diagnostic): set sign by using extmark (#26193)
after sign implementation refactor by using extmark, we can use
`nvim_buf_set_extmark` to set diagnostic sign instead use `sign_define`
2023-12-13 08:19:53 -06:00
Gregory Anders
e527842211
fix(termcap): only call callback for requested capabilities (#26546)
If multiple XTGETTCAP requests are active at once (for example, for
requesting the Ms capability and truecolor capabilities), then the
TermResponse autocommand may fire for capabilities that were not
requested. Instead, make sure that the provided callback is only called
for capabilities that were actually requested.
2023-12-13 08:14:30 -06:00
zeertzjq
d65c6a0baf
vim-patch:9.0.2159: screenpos() may crash with neg. column (#26542)
Problem:  screenpos() may crash with neg. column
Solution: validate and correct column

closes: vim/vim#13669

ec54af4e26
2023-12-13 06:17:50 +08:00
Will Hopkins
69ffbb76c2
feat(iter): add Iter.take (#26525) 2023-12-12 14:27:24 -06:00
Gregory Anders
1907abb4c2
fix(stream): do not close handle if it is already closing (#26537)
uv_close asserts that a handle is not already closing. We can guard
against this assertion failure by manually checking the handle's closing
status ourselves.
2023-12-12 13:19:46 -06:00
dundargoc
2c96f1c4f0 docs: move minimum reproduction template from wiki to repo
Instead of a markdown file, just use a lua file instead that users can
use directly.
2023-12-12 18:32:45 +01:00
dundargoc
5ad5f034ca docs: inline wiki page Deps.md into MAINTAIN.md 2023-12-12 18:21:33 +01:00
dundargoc
5ad3ed40ec docs: inline wiki page Refactoring.md into MAINTAIN.md 2023-12-12 18:19:26 +01:00
zeertzjq
b40170f7a3
fix(lua): memory leak when using invalid syntax with exists() (#26530) 2023-12-12 20:34:02 +08:00
Raphael
1d4a5cd185
feat(eval): exists() function supports checking v:lua functions (#26485)
Problem:  Vimscript function exists() can't check v:lua functions.
Solution: Add support for v:lua functions to exists().
2023-12-12 19:06:22 +08:00
bfredl
e69834744b
Merge pull request #26486 from glepnir/fix_linebyte
fix(eval): use no_ff instead of ffdos as condition
2023-12-12 11:57:56 +01:00
glepnir
d95e3a4c9c fix: use no_ff instead of ffdos as condition
Problem: line2byte behavior is changed after commit b051b13. It no
longer return `-1` on empty buffer.

Solution: use `nof_ff` instead of `!ff_dos` as condition. Then
compatible behavior of line2byte() is restored.
2023-12-12 13:49:04 +08:00
Jaehwang Jung
2d33a766a1
fix(extmarks): U changed_bytes after extmark_splice (#26501)
See also: https://github.com/neovim/neovim/pull/26364
2023-12-12 11:08:25 +08:00
zeertzjq
a9fbba81d5
test(treesitter/fold_spec): fix flakiness (#26524) 2023-12-12 10:44:17 +08:00
zeertzjq
b76cc974b9
fix(tui): don't forget to update cursor visibility (#26523) 2023-12-12 09:44:46 +08:00
Lewis Russell
8097b4a725
Merge pull request #26506 from tomtomjhj/tsfold
fix(treesitter): improve vim.treesitter.foldexpr
2023-12-11 19:30:53 +00:00
Jaehwang Jung
6f75facb9d fix(treesitter): improve vim.treesitter.foldexpr
* Collect on_bytes and flush at the invocation of the scheduled callback
  to take account of commands that triggers multiple on_bytes.
* More accurately track movement of folds so that foldexpr returns
  reasonable values even when the scheduled computation is not run yet.
* Start computing folds from the line above (+ foldminlines) the changed
  lines to handle the folds that are removed due to the size limit.
* Shrink folds that end at the line at which another fold starts to
  assign proper level to that line.
* Use level '=' for lines that are not computed yet.
2023-12-12 02:29:59 +09:00
Jaehwang Jung
7c6f9690f7 fix(treesitter): fix indexing in foldexpr 2023-12-12 02:29:59 +09:00
Jaehwang Jung
b88d1fb15f test(treesitter): more foldexpr tests 2023-12-12 02:29:59 +09:00
luukvbaal
6d698c86d0
fix(coverity): unhandled retval for marktree_itr_get_overlap() #26518
buf_signcols_validate_range() is only called in a buffer with signs, in
which the marktree is thus non-empty. Also remove a redundant comment,
condition and variable.

    *** CID 470331:  Error handling issues  (CHECKED_RETURN)
    /src/nvim/decoration.c: 824 in buf_signcols_validate_range()
    818
    819       // Allocate an array of integers holding the overlapping signs in the range.
    820       assert(row2 >= row1);
    821       int *overlap = xcalloc(sizeof(int), (size_t)(row2 + 1 - row1));
    822
    823       // First find the number of overlapping signs at "row1".
    >>>     CID 470331:  Error handling issues  (CHECKED_RETURN)
    >>>     Calling "marktree_itr_get_overlap" without checking return value (as is done elsewhere 4 out of 5 times).
    824       marktree_itr_get_overlap(buf->b_marktree, currow, 0, itr);
    825       while (marktree_itr_step_overlap(buf->b_marktree, itr, &pair)) {
    826         if (!mt_invalid(pair.start) && pair.start.flags & MT_FLAG_DECOR_SIGNTEXT) {
    827           overlap[0]++;
    828         }
    829       }
2023-12-11 08:16:35 -08:00
Christian Clason
c95b9a32f8 build(deps): bump luajit to HEAD - ff204d035 2023-12-11 10:29:46 +01:00
Jongwook Choi
3692fd4c87
feat(gen_lsp.lua): validate CLI args #26514
- Improve CLI argument parsing, rejects invalid argument and commands as
  early as possible. Also prints USAGE in the command line.
- No longer allows `--<outfile>`, use `--out <outfile>` instead.
- Print a little bit of verbose messages to better know what's going on
  rather than remaining silent at all times.
- Add type annotation `gen_lsp._opt` to avoid type warnings.
2023-12-11 01:10:00 -08:00
dundargoc
529498685b
Merge pull request #26458 from famiu/refactor/options/optionindex 2023-12-10 16:26:08 +01:00
Christian Clason
c675e51c2f docs(news): very, very minorly
* fix garbled item for new treesitter injection format
* add missing item for new `vim.lpeg` and `vim.re`
* use taglinks where possible
* remove redundant "Added" and "Removed" from items
2023-12-10 14:28:07 +01:00
Famiu Haque
a34cc1a44d
refactor(options): define kOptIndexCount
Add a macro to indicate the option count so that we can iterate through the options[] table more clearly. This also removes the need for having an option with NULL fullname at the end of `options[]`.
2023-12-10 19:20:28 +06:00
zeertzjq
096211a87b
test: make text-only snapshots work (#26494) 2023-12-10 07:06:48 +08:00
zeertzjq
31fbd38066
ci: fix PR labeler 2023-12-10 06:40:51 +08:00
zeertzjq
ec3c569dd8
Merge pull request #26490 from zeertzjq/screen-repeat
test: avoid repeated screen lines in expected states
2023-12-09 22:33:31 +08:00
zeertzjq
1037ce2e46 test: avoid repeated screen lines in expected states
This is the command invoked repeatedly to make the changes:

    :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-12-09 22:15:02 +08:00
zeertzjq
5e43630a26 test: allow avoiding repeated screen lines in expected states
Allow a "*count" suffix in a screen line to repeat the screen line for
"count" times.

The change is made to Screen:expect() and Screen:get_snapshot() instead
of Screen:render() so that screen expectations generated using code can
still work and test failures can still be readable.

A snapshot is now also printed on failure so that there is no need to
run the test again with Screen:snapshot_util().
2023-12-09 22:14:50 +08:00
dundargoc
8be24fed8f build: remove config-specific find_package search for libuv
Having two separate find_package calls makes it harder to maintain.
2023-12-09 14:55:37 +01:00
dundargoc
dd81e1e334 ci: refactor CI files
Mostly rename file and variable names to be more consistent. This makes
it easier to locate them in the "Actions" tab on github.
2023-12-09 14:14:38 +01:00
Famiu Haque
bf3bc1cec9
refactor(options): convert opt_idx variables to OptIndex 2023-12-09 17:54:43 +06:00
Famiu Haque
6346987601
refactor(options): reduce findoption() usage
Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over.

Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
2023-12-09 17:54:43 +06:00
zeertzjq
29aa4dd10a
vim-patch:61e984e212ed (#26484)
runtime(doc): link cmdline completion to to |wildcards| and fix typos (vim/vim#13636)

The docs for cmdline completion doesn't mention that [abc] is considered
a wildcard, and |wildcards| contains more detailed information, so just
link to it.

Also fix some typos in other help files.

61e984e212
2023-12-09 15:35:45 +08:00
zeertzjq
2ebd328a79
refactor: format casting of negative number better (#26482) 2023-12-09 11:36:11 +08:00
Gregory Anders
c651fb3042
refactor(tui): use synchronized updates around actual buf flush (#26478)
Rather than writing the synchronized update begin and end sequences into
the TUI's internal buffer (where it is later flushed to the TTY), write
these sequences directly to the TTY before and after the TUI's internal
buffer is itself flushed to the TTY.

This guarantees that a synchronized update is always used when we are
actually sending data to the TTY. This means we do not need to keep
track of the TUI's "dirty" state (any sequences which affect the TUI
state will be written in the TUI's internal buffer, which is now
guaranteed to only ever be written when a synchronized update is
active).
2023-12-09 10:44:16 +08:00
zeertzjq
f45bf44176
vim-patch:ff0baca86523 (#26476)
runtime(syntax): unlet b:filetype_in_cpp_family for cpp & squirrel

Update runtime/syntax/cpp.vim and runtime/syntax/squirrel.vim to unlet
b:filetype_in_cpp_family as it remains set even after updating the ft of
a file manually or through a modeline, not allowing c specific keywords
to be highlighted.

Since the variable b:filetype_in_cpp_family is only used by the c.vim
syntax script, unlet it directly after sourcing the c.vim runtime file
instead of at the end of the script.

Also update the last Change Header for both files.

closes: vim/vim#13650

ff0baca865

Co-authored-by: laburnumT <laburnumtec@gmail.com>
2023-12-09 07:45:31 +08:00
zeertzjq
b8e227b621
vim-patch:9.0.2154: The option[] array is not sorted (#26475)
Problem:  The options[] array is not sorted alphabetically.
Solution: Sort it alphabetically.  Add a test.  Avoid unnecessary loop
          iterations in findoption().

closes: vim/vim#13648

Cherry-pick Test_set_one_column() change from patch 8.2.0432.

f48558e10a
2023-12-09 07:18:21 +08:00
dundargoc
9706ee59d0 ci: bump actions/labeler from 4 to 5 2023-12-08 22:13:07 +01:00
dundargoc
f707ce76ac ci: remove python workaround
The provider tests seems to work now without this workaround.
2023-12-08 22:00:49 +01:00
Maria José Solano
a1bdf2852d
fix(snippet): remove misleading comment about TM_FILENAME_BASE (#26465) 2023-12-08 21:23:46 +01:00
Luuk van Baal
2289ca273c perf(column): avoid counting when max signs are removed from a range 2023-12-08 15:42:18 +00:00
zeertzjq
808fbe67a8
test(tui_spec): update cursor_address test for flush start (#26464) 2023-12-08 11:42:17 +08:00
zeertzjq
999e167a52
fix(tui): start flush earlier (#26463)
Problem:  TUI flush (start sync or hide cursor) only starts on a "flush"
          event, which is too late.
Solution: Start the next flush when anything will be drawn.
2023-12-08 10:25:38 +08:00
zeertzjq
3bb5d2f219
test: use termopen() instead of :terminal more (#26462) 2023-12-08 08:00:27 +08:00
Gregory Anders
5e3c1b976a
test: fix Windows tests failures (#26461) 2023-12-08 06:58:03 +08:00