Commit Graph

27065 Commits

Author SHA1 Message Date
Maria José Solano
6debb18523
refactor(treesitter): remove duplicated diagnostic code (#24976)
* refactor(treesitter): remove duplicated diagnostic code

* fixup!: fix type errors

* fixup!: add type namespace
2023-09-15 20:45:40 +01:00
Gregory Anders
73c71ed95c
docs(MAINTAIN): Add note about deprecation policy exceptions (#25159)
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-09-15 09:32:47 -05:00
zeertzjq
35e50d79c6
fix(extmarks): overlay virt_text position after 'showbreak' (#25175)
Also make virt_text_hide work properly.
2023-09-15 20:30:50 +08:00
Ilia Choly
f5a09f1b03
fix: invoke changed_bytes when rewriting <Tab> char #25125
When tabstop and shiftwidth are not equal, tabs are inserted as individual
spaces and then rewritten as tab characters in a second pass. That second pass
did not call changed_bytes which resulted in events being omitted.

Fixes #25092
2023-09-15 03:45:51 -07:00
Maria José Solano
28233bcb49
refactor(treesitter): rename "preview" => "edit" #25161
"Edit" more closely describes the generic application than "Preview", though
the buffer contents don't (yet) map to an actual file on disk.

https://github.com/neovim/neovim/pull/24703#discussion_r1321719133
2023-09-15 03:10:55 -07:00
dundargoc
2d9e7a33f4
test(windows): unskip working tests (#25153)
Also simplify home detection with os_homedir()
2023-09-15 16:33:26 +08:00
zeertzjq
a6e4793baf
fix(extmarks): draw virt_text below diff filler lines properly (#25170)
fix(extmarks): draw virt_text properly below diff filler lines
2023-09-15 15:56:52 +08:00
Christian Clason
fe2fa98460 build(deps): bump luajit to HEAD - 7a77a3cd8 2023-09-15 09:10:00 +02:00
zeertzjq
b65cd7ff1a
fix(extmarks): fix wrong virt_text position after wrapped TAB (#25168) 2023-09-15 14:54:42 +08:00
zeertzjq
b52bd8a2de
fix(extmarks): properly handle virt_text on next screen line (#25166)
TODO: virt_text_hide doesn't work for the first char on a wrapped screen
line, and it's not clear how to fix that.
2023-09-15 12:35:27 +08:00
zeertzjq
9ec0ecb222
refactor(drawline): remove unnecessary inline virt checks (#25163) 2023-09-15 07:17:13 +08:00
Gregory Anders
2e92065686
docs: replace <pre> with ``` (#25136) 2023-09-14 08:23:01 -05:00
LW
9fc321c976
refactor(treesitter): deprecate for_each_child #25118
The name for_each_child is misleading and caused bugs.
After #25111, #25115, there are no more usages of `for_each_child` in Nvim.

In the future if we want to restore this functionality we can consider a
generalized vim.traverse(node, key, visitor) function.
2023-09-14 03:36:16 -07:00
L Lllvvuu
a4743487b7 fix(treesitter): language.add - only register parser if it exists
Fixes: #24531
2023-09-14 10:36:09 +01:00
dundargoc
eecddd2416 build(lint): use stylua without add_glob_target
add_glob_target is our custom method to figure out whether a work needs
to be done or not. This works as expected most of the time, but causes a
problem with stylua.

Stylua makes the decision that if a file is explicitly passed to be
formatted, then it will format the file even if the file is set to be
ignored in .styluaignore. This behavior breaks add_glob_target with
seemingly no easy workaround.
More information: https://github.com/JohnnyMorganz/StyLua/issues/751

Instead, what we can do is call stylua as you would in the command line.
This will make stylua work as expected. The downside is that we no
longer get a free "is this work necessary" detection, meaning that
stylua will be run each time `make lint` is called, regardless if it's
necessary or not. For longer lint tasks such as uncrustify and
clang-tidy this would be disastrous, but this is an acceptable tradeoff
since stylua is very quick.
2023-09-14 09:58:50 +02:00
Mathias Fußenegger
a49924a318
feat(lsp): remove notify from vim.lsp.buf_detach_client (#25140)
Closes https://github.com/neovim/neovim/issues/19838
2023-09-14 08:40:53 +02:00
dundargoc
a6e74c1f0a
docs: fix typos and other small fixes (#25005)
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com>
Co-authored-by: XTY <xty@xty.io>
Co-authored-by: Empa <emanuel@empa.xyz>
Co-authored-by: kyu08 <49891479+kyu08@users.noreply.github.com>
2023-09-14 12:05:27 +08:00
zeertzjq
f5953edbac
fix(float): update position of anchored windows first (#25133) 2023-09-14 07:42:22 +08:00
bfredl
77df96f3fb
Merge pull request #25114 from bfredl/nohl
refactor(highlight): merge redundant attr_entries and attr_entry_ids
2023-09-13 22:18:51 +02:00
Christian Clason
199cf5a526 vim-patch:8b2457a38198
runtime(swayconfig): improve syntax highlighting (vim/vim#13060)

* syntax(swayconfig): improved highlighting
* syntax(swayconfig): adapt to i3config structure

8b2457a381

Co-authored-by: Josef Litoš <54900518+JosefLitos@users.noreply.github.com>
2023-09-13 17:23:45 +02:00
Christian Clason
2dd5e472df vim-patch:fc93594d562d
runtime(rust): sync rust runtime files with upstream (vim/vim#13075)

fc93594d56

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2023-09-13 17:23:45 +02:00
Christian Clason
b1d24ca760 vim-patch:f5356bf6751f
runtime(i3config): syntax structure cleanup (vim/vim#13080)

* syntax(i3config): improved i3config highlighting
* syntax(i3config): refactor structure

f5356bf675

Co-authored-by: Josef Litoš <54900518+JosefLitos@users.noreply.github.com>
2023-09-13 17:23:45 +02:00
Gregory Anders
27a566f3f8
feat(vimdoc): support Markdown code blocks (#25127)
Support Markdown code blocks in addition to <pre> blocks in Doxygen doc
comments.

Update doc comments in iter.lua as a test.
2023-09-13 08:38:28 -05:00
bfredl
a6d745865a refactor(highlight): merge redundant attr_entries and attr_entry_ids structs
An insert-only set now defines a monotonically increasing ordering by
itself. It can be used to both lookup the key from index, and vice versa.
2023-09-13 10:37:48 +02:00
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