Commit Graph

27041 Commits

Author SHA1 Message Date
Jaehwang Jung
4607807f9f fix(treesitter): don't update fold if tree is unchanged
Problem:
Folds are opened when the visible range changes even if there are no
modifications to the buffer, e.g, when using zM for the first time. If
the parsed tree was invalid, on_win re-parses and gets empty tree
changes, which triggers fold updates.

Solution:
Don't update folds in on_changedtree if there are no changes.
2023-09-13 08:51:54 +01:00
Lewis Russell
1f551e068f fix(treesitter): fixup for InspectTree
Fixes #25120
2023-09-12 15:55:40 +01:00
Sergey Slipchenko
bc67cf3ccd
feat(gen_help_html): add anchors to help tags #25112
Fixes #21911

Co-authored by: wispl
2023-09-12 04:51:38 -07:00
Lewis Russell
7a76fb8547 fix(treesitter): remove more double recursion
Do not call `for_each_child` in functions that are already recursive.
2023-09-12 12:21:42 +01:00
bfredl
1c4a93b591
Merge pull request #13243 from bfredl/intersection
feat(extmark): support highlighting and querying multiline ranges
2023-09-12 11:16:35 +02:00
bfredl
b04286a187 feat(extmark): support proper multiline ranges
The removes the previous restriction that nvim_buf_set_extmark()
could not be used to highlight arbitrary multi-line regions

The problem can be summarized as follows: let's assume an extmark with a
hl_group is placed covering the region (5,0) to (50,0) Now, consider
what happens if nvim needs to redraw a window covering the lines 20-30.
It needs to be able to ask the marktree what extmarks cover this region,
even if they don't begin or end here.

Therefore the marktree needs to be augmented with the information covers
a point, not just what marks begin or end there. To do this, we augment
each node with a field "intersect" which is a set the ids of the
marks which overlap this node, but only if it is not part of the set of
any parent. This ensures the number of nodes that need to be explicitly
marked grows only logarithmically with the total number of explicitly
nodes (and thus the number of of overlapping marks).

Thus we can quickly iterate all marks which overlaps any query position
by looking up what leaf node contains that position. Then we only need
to consider all "start" marks within that leaf node, and the "intersect"
set of that node and all its parents.

Now, and the major source of complexity is that the tree restructuring
operations (to ensure that each node has T-1 <= size <= 2*T-1) also need
to update these sets. If a full inner node is split in two, one of the
new parents might start to completely overlap some ranges and its ids
will need to be moved from its children's sets to its own set.
Similarly, if two undersized nodes gets joined into one, it might no
longer completely overlap some ranges, and now the children which do
needs to have the have the ids in its set instead. And then there are
the pivots! Yes the pivot operations when a child gets moved from one
parent to another.
2023-09-12 10:38:23 +02:00
L Lllvvuu
6b5f44817e fix(languagetree): remove double recursion in LanguageTree:parse
`LanguageTree:parse` is recursive, and calls
`LanguageTree:for_each_child`, which is also recursive.

That means that, starting from the third level (child of child of root),
nodes will be parsed twice.

Which then means that if the tree is N layers deep, there will be ~2^N
parses even if the branching factor is 1.

Now, why was the tree deepening with each character inserted? And why
did this only regress in #24647? These are mysteries for another time.

Fixes: #25104
2023-09-12 09:12:53 +02:00
Christian Clason
3849cc9c18 build(deps): bump luajit to HEAD - 8af63f992 2023-09-12 09:01:52 +02:00
Christian Clason
6c1b7535fe build(deps): bump tree-sitter to HEAD - 46af27796 2023-09-12 09:01:38 +02:00
Christian Clason
a9369e4b65 vim-patch:62145db91b10
syntax(i3config): improved i3config highlighting (vim/vim#13054)

62145db91b

Co-authored-by: Josef Litoš <54900518+JosefLitos@users.noreply.github.com>
2023-09-12 08:19:22 +02:00
zeertzjq
aab06edc63
vim-patch:f787ee8451a1 (#25103)
runtime(doc): Add g:c_syntax_for_h to filetype-overrule docs

closes: vim/vim#13074

f787ee8451

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-09-12 07:48:40 +08:00
zeertzjq
4b6023be7c
vim-patch:596ad66d1ddb (#25102)
runtime(doc): documentation updates

This is a collection of various improvements to the help pages

closes vim/vim#12790

596ad66d1d

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Houl <anwoku@yahoo.de>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
2023-09-12 07:37:05 +08:00
Jaehwang Jung
65738202f8
fix(decorations): better approximation of botline #24794
Problem:
* The guessed botline might be smaller than the actual botline e.g. when
  there are folds and the user is typing in insert mode. This may result
  in incorrect treesitter highlights for injections.
* botline can be larger than the last line number of the buffer, which
  results in errors when placing extmarks.

Solution:
* Take a more conservative approximation. I am not sure if it is
  sufficient to guarantee correctness, but it seems to be good enough
  for the case mentioned above.
* Clamp it to the last line number.

Co-authored-by: Lewis Russell <me@lewisr.dev>
2023-09-11 12:29:39 -07:00
Sergey Slipchenko
f859d16aea
fix(tests): set SHELL=sh #24941
Problem:
Some tests fail with $SHELL=fish #6172
Related: https://github.com/neovim/neovim/pull/6176

Solution:
Replace "echo -n" with "printf", because "echo" in sh may be provided
as a shell builtin, which does not accept an "-n" flag to avoid a
trailing newline (e.g. on macos). "printf" is more portable (defined by
POSIX) and it does not output a trailing newline by itself.
Fixes #6172

TODO:
Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354
Checked by running `:terminal ./build/bin/tty-test` from Nvim with
`shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains
about "process does not own the terminal". With `shell=sh` it doesn't complain. And
unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`.

    FAILED   test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode
    test/functional/terminal/tui_spec.lua:1024: Row 1 did not match.
    Expected:
      |*tty ready                                         |
      |*{1: }                                                 |
      |*                                                  |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*process does not own the terminal                 |
      |*                                                  |
      |*[Process exited 2]{1: }                               |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1024: in function <test/functional/terminal/tui_spec.lua:1017>

    FAILED   test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors
    test/functional/terminal/tui_spec.lua:1567: Row 1 did not match.
    Expected:
      |*{1:t}ty ready                                         |
      |                                                  |
      |*                                                  |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*{1:p}rocess does not own the terminal                 |
      |                                                  |
      |*[Process exited 2]                                |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1567: in function <test/functional/terminal/tui_spec.lua:1551>
2023-09-11 10:01:00 -07:00
Lewis Russell
676e1d4900 refactor(usercmd.c): reduce scope of locals 2023-09-11 11:40:15 +01:00
bfredl
1d259724a9
Merge pull request #25083 from bfredl/memlinetype
refactor(memline): cleanup typedefs for memline structs
2023-09-11 10:47:23 +02:00
bfredl
616a9bac32
Merge pull request #24901 from faergeek/more-intuitive-cursor-update
fix(api): more intuitive cursor updates in nvim_buf_set_text
2023-09-11 10:45:45 +02:00
Christian Clason
60e5d0fbcc vim-patch:9.0.1891: No runtime support for Mojo
Problem:  No runtime support for Mojo
Solution: Add basic filetype and syntax plugins

closes: vim/vim#13062
closes: vim/vim#13063

0ce2c594d0

Co-authored-by: Mahmoud Abduljawad <mahmoud@masaar.com>
2023-09-11 10:05:54 +02:00
Christian Clason
60a39ada1b vim-patch:e7833e73471a
runtime(masm): add support for AVX-2 and AVX-512 (vim/vim#13061)

e7833e7347

Co-authored-by: Wu Yongwei <wuyongwei@gmail.com>
2023-09-11 10:05:54 +02:00
Christian Clason
ba1db8751c vim-patch:066103307534
runtime(scala): Fix Scala highlighting string literal as type param (vim/vim#13070)

Since https://docs.scala-lang.org/sips/42.type.html which is implemented
in Scala 2.13 and in Scala 3 it possible to use string literals as
singleton types. So code like
```
someFunc["abc"]
```
is valid. Currently this code is not hightlighted correctly and worse if
there is an unclosed `(` in the string it breaks the formating in the
rest of the file.

I also submitted this patch to the mentioned project for this runtime
file: https://github.com/derekwyatt/vim-scala/pull/173 But there are no
commits there over the last 2 years and no response in the week since I
created it. Also the last change to the Scala syntax file:
https://github.com/vim/vim/pull/9594 is yet to be backported to that
repo. Therefore I am opening this PR as well to get some feedback on how
to proceed to get this fixed.

0661033075

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
2023-09-11 10:05:54 +02:00
zeertzjq
4258f4d53c
ci(cirrus): use FreeBSD 13.2 (#24684) 2023-09-11 12:41:53 +08:00
Sergey Slipchenko
d22172f36b
fix(api): more intuitive cursor updates in nvim_buf_set_text
Fixes #22526
2023-09-11 08:16:03 +04:00
zeertzjq
c8c73b26f3
Merge pull request #25093 from zeertzjq/vim-9.0.1893
vim-patch:9.0.{1893,1894}
2023-09-11 11:46:40 +08:00
zeertzjq
e8d25675a2 vim-patch:9.0.1894: CI: trailing whitespace in tests
Problem:  CI: trailing white space in tests
Solution: clean up the trailing white space

e5f7cd0a60

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-11 11:16:50 +08:00
zeertzjq
6484f338a4 vim-patch:9.0.1893: CI: strptime test fails on BSD14
Problem:  CI: strptime test fails on BSD14
Solution: Skip the test

983d808674

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-11 11:16:50 +08:00
zeertzjq
2b475cb5cc
fix(mouse): click on 'statuscolumn' with 'rightleft' (#25090) 2023-09-11 08:29:33 +08:00
Sergey Slipchenko
af0684f0d5
test: unignore test which froze sourcehut (#25067) 2023-09-11 05:53:05 +08:00
bfredl
8d17e470f4 refactor(memline): cleanup typedefs for memline structs
These were used interchangedly by the struct name and the typedef name.
Use standard pattern type names and use these consistently
2023-09-10 19:15:04 +02:00
bfredl
a03e00a353
Merge pull request #24875 from bfredl/memfilemap
refactor(memfile): change mf_trans and mf_hash from ad-hoc hashtable to Map
2023-09-10 19:10:29 +02:00
dundargoc
06d48f6aa6 ci(codeql): add concurrency to cancel unnecessary jobs early 2023-09-10 17:56:45 +02:00
dundargoc
b6b70ae199 ci: install stylua from their releases
It's quicker to grab the .zip file rather than using homebrew.
2023-09-10 16:23:21 +02:00
dundargoc
9f8f287c61 build: remove luarocks
Luarocks is no longer needed after
25e51d393a.
2023-09-10 15:32:47 +02:00
bfredl
bf36b0f8ec refactor(mch): last mch_ function/macro hits the dust
Also remove some stray comments.
2023-09-10 13:09:44 +02:00
bfredl
87cde88c41 refactor(memfile): change mf_trans and mf_hash from ad-hoc hashtable to Map
Memfile used a private implementation of an open hash table with intrusive collision chains, but there is
no reason to assume the standard khash_t based Map won't work just fine.

Yes, we are taking full ownership and maintenance over memline and memfile.
No one is going to maintain it for us.

Trust the plan.
2023-09-10 13:09:44 +02:00
Christian Clason
e99a3fd25d build(deps): bump luajit to HEAD - 5a18d4582 2023-09-10 12:48:52 +02:00
bfredl
59d9f2413b
Merge pull request #25071 from bfredl/coxpcall
build(lua): vendor coxpcall
2023-09-10 12:35:32 +02:00
Christian Clason
1027b2881a vim-patch:733bbcde776e
runtime(nasm): updated syntax file

733bbcde77

Co-authored-by: Andrii Sokolov <andriy145@gmail.com>
2023-09-10 11:52:48 +02:00
bfredl
25e51d393a build(lua): vendor coxpcall
Do not require luarocks on PUC lua CI just because of this single lua file
2023-09-10 11:43:37 +02:00
Grace Petryk
5e3cf9fb4b
feat(lsp): improve control over placement of floating windows (#24494) 2023-09-10 10:02:23 +02:00
dundargoc
bb38c066a9 fix: fix compiler warning from clang 2023-09-09 23:42:06 +02:00
Sergey Slipchenko
87db6d894a fix(deps): make sure --force-config takes effect
Fixes #24881

--force-config passed to luarocks' configure script is only taken into
account in case "make install" is used afterwards.

But if "make bootstrap" is used then this flag has no effect. And it can
actually copy an existing config on the system to the new installation.
That existing config can have a different version of Lua set by default.
In which case luarocks will install packages for that version instead of
the one used in tests. And trying to run tests then will fail because of
missing packages.
2023-09-09 18:41:36 +02:00
dundargoc
6e26964e0e revert: "ci: trigger tests when pushing"
This reverts commit e71c7898ca.

Triggering jobs on users own fork turned out to be not that useful, and
only necessary in rare moments. It's easier to adjust the CI scripts if
the users wants CI results before creating a pull request. It also
reduces the complexity of the CI code.
2023-09-09 15:21:46 +02:00
dundargoc
5acd850117 ci(release): remove unnecessary full clone 2023-09-09 14:22:14 +02:00
Sergey Slipchenko
c422722b2e
fix(rpc): fix hang with channel closed while waiting for response 2023-09-09 19:40:09 +08:00
bfredl
d4e80a051e
Merge pull request #25039 from glepnir/fix_hl
fix(highlight): add create param in nvim_get_hl api function
2023-09-09 13:01:40 +02:00
zeertzjq
420b94eeec
Merge pull request #25058 from zeertzjq/vim-9.0.1886
vim-patch:9.0.{1877,partial:1886}
2023-09-09 18:33:38 +08:00
zeertzjq
b9d9cd7742 vim-patch:partial:9.0.1886: Various Typos
Problem:  Various Typos
Solution: Fix Typos

This is a collection of typo related commits.

closes: vim/vim#12753
closes: vim/vim#13016

ee17b6f70d

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com>
Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
2023-09-09 17:58:32 +08:00
zeertzjq
bc09fc04b8 vim-patch:9.0.1877: missing test for patch 9.0.1873
Problem:  missing test for patch 9.0.1873
Solution: add a test trying to exchange windows

Add a test, making sure that switching windows is not allowed when
textlock is active, e.g. when running `:s/<pat>/\=func()/`

18d2709aa1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-09 17:53:01 +08:00
glepnir
8afb3a49c0 fix(highlight): add create param in nvim_get_hl 2023-09-09 17:15:58 +08:00
dundargoc
b7734c4ec8
ci: remove container solution for the linux runner
This will fix the failing release job.

Ubuntu 18.04 is incompatible with checkout action version 4, which
requires glibc 2.28+. This will bump the minimum glibc version required
to use the release versions to 2.31. People requring the older releases
can find them at https://github.com/neovim/neovim-releases.
2023-09-09 10:36:42 +02:00