Commit Graph

25184 Commits

Author SHA1 Message Date
Gregory Anders
86ff239240 refactor(treesitter): use string.format to create lines 2023-03-02 14:15:18 -07:00
Gregory Anders
2eeafc43c4 fix(treesitter): maintain cursor position when toggling anonymous nodes
When toggling anonymous nodes in the :InspectTree window, keep the
cursor fixed relative to the node within the tree. This prevents the
cursor from jumping.
2023-03-02 14:11:15 -07:00
Christian Clason
f449121764
feat(treesitter): add :InspectTree command (#22477) 2023-03-02 18:03:11 +01:00
Justin M. Keyes
b0b4c31097
refactor: rename show_tree => inspect_tree #22474
Problem:
"show" is potentially a new verb that we can avoid (there is already
"open" and "echo"). Even if we can't avoid it, the behavior of
`show_tree` fits well in the "inspect" family of functions: a way for
users to introspect/reflect on the state of Nvim.

Existing "inspect" functions:
    vim.inspect()
    vim.inspect_pos()
    vim.treesitter.inspect_language()
    nvim__inspect_cell

Solution:
Rename `show_tree` to `inspect_tree`.
2023-03-02 07:01:42 -08:00
dundargoc
a0292b4e5f
build: remove libfindmacros library (#22423)
Large parts the library weren't being used, and the parts that were was overly
abstracted for our use case. Additionally, part of its use case was to abstract
pkgconfig boilerplate, which is no longer needed as pkgconfig has been removed
in favor of relying on cmake alone in 09118052ce.
2023-03-02 10:22:41 +01:00
zeertzjq
fb1db80f5a
test(treesitter/parser_spec): correct time unit (#22471) 2023-03-02 14:42:15 +08:00
Mike
bc15b075d1
feat(vim.fs): pass path to find() predicate, lazy evaluate #22378
Problem:
No easy way to find files under certain directories (ex: grab all files under
`test/`) or exclude the content of certain paths (ex. `build/`, `.git/`)

Solution:
Pass the full `path` as an arg to the predicate.
2023-03-01 08:51:22 -08:00
Gregory Anders
014981c900
fix(lsp): only fire LspDetach for attached buffers (#22468)
If the LSP server fails to start then the client never initializes and
thus never calls its on_attach function and an LspAttach event is
never fired. However, the on_exit function still fires a LspDetach
event, so user autocommands that attempt to "clean up" in LspDetach may
run into problems if they assume that the buffer was already attached.

The solution is to only fire an LspDetach event if the buffer was
already attached in the first place.
2023-03-01 17:47:56 +01:00
zeertzjq
f25d126b18
vim-patch:8.2.{1949,2781} (#22451)
vim-patch:8.2.2781: add() silently skips when adding to null list or blob

Problem:    Add() silently skips when adding to null list or blob.
Solution:   Give an error in Vim9 script.  Allocate blob when it is NULL like
            with list and dict.

b7c21afef1

Do not implicitly change a NULL blob/dict/list to an empty one.

N/A patches for version.c:

vim-patch:8.2.1949: Vim9: using extend() on null dict is silently ignored

Problem:    Vim9: using extend() on null dict is silently ignored.
Solution:   Give an error message.  Initialize a dict variable with an empty
            dictionary. (closes vim/vim#7251)

348be7ed07

N/A because Nvim's current behavior is an error message as a locked
list/dict, which is more consistent. Ref #4615.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-03-01 23:23:39 +08:00
Mathias Fußenegger
896d672736
fix(lsp): use buffer scheme for files not stored on disk (#22407)
Sending `didOpen` with a `file` scheme causes problems with some
language servers because they expect the file to exist on disk.

See https://github.com/microsoft/language-server-protocol/pull/1679
2023-03-01 15:33:13 +01:00
zeertzjq
d66832c76d
test(ui): wait for another success with failure after success
Problem:
In a success-failure-success situation, if minimal timeout is reached
between the failure and the second success, the session is stopped
without waiting for the second success, causing the test to fail.

Solution:
Wait for another success if a failure is seen after a success.

Ref #22155 #22464
2023-03-01 20:16:57 +08:00
Jens Claes
96d3616a53
fix(lsp): callHierarchy methods also require the callHierarchyProvider (#22427) 2023-03-01 11:35:16 +01:00
zeertzjq
aa840ab566
test(termxx_spec): fix TermClose bdelete test flakiness (#22463)
Problem:
If shell-test finishes before the next RPC call, TermClose has already
been triggered, so the test fails.

Solution:
Add INTERACT argument so that shell-test keeps running.
2023-03-01 09:56:25 +08:00
zeertzjq
999fe94688
vim-patch:9.0.1365: dead test code (#22461)
Problem:    Dead test code.
Solution:   Remove code that depends on Farsi, which has been removed.
            (closes vim/vim#12084)

f0300fc7b8
2023-03-01 08:17:09 +08:00
bfredl
8bd0a9c360
Merge pull request #22429 from bfredl/hkmap
feat(edit)!: remove old c implementation of hebrew keymap
2023-02-28 19:38:38 +01:00
bfredl
cf07f2baab feat(edit)!: remove old c implementation of hebrew keymap
This feature has long been obsolete. The 'keymap' option can be used
to support language keymaps, including hebrew and hebrewp (phonetic
mapping). There is no need to keep the old c code with hardcoded
keymaps for some languages.
2023-02-28 15:14:03 +01:00
zeertzjq
f289fc4abb
Merge pull request #22456 from zeertzjq/vim-9.0.0430
vim-patch:8.2.{4668,4670},9.0.0430: cannot use repeat() with a blob
2023-02-28 21:55:55 +08:00
zeertzjq
278aeee3ae vim-patch:9.0.0430: cannot use repeat() with a blob
Problem:    Cannot use repeat() with a blob.
Solution:   Implement blob repeat. (closes vim/vim#11090)

375141e1f8

Co-authored-by: Bakudankun <bakudankun@gmail.com>
2023-02-28 21:27:43 +08:00
zeertzjq
1e513fd112 vim-patch:8.2.4670: memory allocation failures for new tab page not tested
Problem:    Memory allocation failures for new tab page not tested.
Solution:   Add tests with failing memory allocation. (Yegappan Lakshmanan,
            closes vim/vim#10067)

72bb47e38f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 21:17:42 +08:00
zeertzjq
65af424199 vim-patch:8.2.4668: buffer allocation failures insufficiently tested
Problem:    Buffer allocation failures insufficiently tested.
Solution:   Add tests for memory allocation failures. (Yegappan Lakshmanan,
            closes vim/vim#10064)

0dac1ab579

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 21:17:42 +08:00
zeertzjq
faa5d5be4b
Merge pull request #22455 from zeertzjq/vim-8.2.3438
vim-patch:8.2.{3438,3446}: blob2list(), list2blob()
2023-02-28 21:13:41 +08:00
bfredl
011b4c5c62
Merge pull request #22452 from folke/master
fix(inspect): always resolve full treesitter lang hl groups
2023-02-28 14:13:01 +01:00
bfredl
df1d15a255
Merge pull request #22454 from bfredl/lspredraw
perf(lsp): only redraw the windows containing LSP tokens
2023-02-28 14:11:27 +01:00
zeertzjq
ccac34af76 vim-patch:8.2.3446: not enough tests for empty string arguments
Problem:    Not enough tests for empty string arguments.
Solution:   Add tests, fix type check. (Yegappan Lakshmanan, closes vim/vim#8881)

820d5525ca

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 20:46:06 +08:00
zeertzjq
f6b9791212 vim-patch:8.2.3438: cannot manipulate blobs
Problem:    Cannot manipulate blobs.
Solution:   Add blob2list() and list2blob(). (Yegappan Lakshmanan,
            closes vim/vim#8868)

5dfe467432

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-28 20:46:06 +08:00
zeertzjq
3f381f4d04
Merge pull request #22453 from zeertzjq/vim-9.0.0795
vim-patch:9.0.{0795,0803,0810}: readblob() offset and size
2023-02-28 20:12:50 +08:00
bfredl
7e19cabeb1 perf(lsp): only redraw the windows containing LSP tokens
redraw! redraws the entire screen instead of just the windows with
the buffer which were actually changed.

I considered trying to calculating the range for the delta
but it looks tricky. Could a follow-up.
2023-02-28 13:11:36 +01:00
zeertzjq
7aad75e293 vim-patch:9.0.0810: readblob() returns empty when trying to read too much
Problem:    readblob() returns empty when trying to read too much.
Solution:   Return what is available.

5b2a3d77d3

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 19:52:45 +08:00
zeertzjq
4bd0611d7b vim-patch:9.0.0803: readblob() cannot read from character device
Problem:    readblob() cannot read from character device.
Solution:   Use S_ISCHR() to not check the size. (Ken Takata, closes vim/vim#11407)

43625762a9

S_ISCHR is always defined in Nvim.

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-02-28 19:52:45 +08:00
zeertzjq
bfa0bc7df0 vim-patch:9.0.0795: readblob() always reads the whole file
Problem:    readblob() always reads the whole file.
Solution:   Add arguments to read part of the file. (Ken Takata,
            closes vim/vim#11402)

11df3aeee5

Remove trailing whitespace in test as done in patch 9.0.1257.
Move the help for rand() before range().

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-02-28 19:52:45 +08:00
Justin M. Keyes
3b92776226
Merge #22382 has('gui_running') 2023-02-28 06:24:23 -05:00
Folke Lemaitre
7574d58304
fix(inspect): alwasy resolve full treesitter lang hl groups 2023-02-28 12:12:08 +01:00
zeertzjq
a87b52d328
Merge pull request #22448 from zeertzjq/vim-8.2.2780
vim-patch:8.2.{2780,2782,2783}
2023-02-28 17:13:24 +08:00
zeertzjq
55d30c459c vim-patch:8.2.2783: duplicate code for setting byte in blob, blob test may fail
Problem:    Duplicate code for setting byte in blob, blob test may fail.
Solution:   Call blob_set_append().  Test sort failure with "N".

e8209b91b9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 16:51:31 +08:00
zeertzjq
88b70e7d46 vim-patch:8.2.2782: Vim9: blob operations not fully tested
Problem:    Vim9: blob operations not fully tested.
Solution:   Make more blob tests run in Vim9 script.  Fix filter().  Make
            insert() give an error for a null blob, like add().

39211cba72

vim-patch:8.2.3284: no error for insert() or remove() changing a locked blob

Problem:    No error for insert() or remove() changing a locked blob.
Solution:   Check a blob is not locked before changing it. (Sean Dewar,
            closes vim/vim#8696)

80d7395dcf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2023-02-28 16:51:31 +08:00
zeertzjq
0ded757c31 vim-patch:8.2.2780: Vim9: for loop over blob doesn't work
Problem:    Vim9: for loop over blob doesn't work.
Solution:   Make it work.

d551d6c268

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 16:51:31 +08:00
Christian Clason
66c384d4e8
vim-patch:partial:dd60c365cd26 (#22437)
vim-patch:partial:dd60c365cd26

Update runtime files

dd60c365cd

Co-authored-by: Bram Moolenaar <Bram@vim.org>

Skip: eval.txt, repeat.txt (needs `getscriptinfo()`)
2023-02-28 09:34:27 +01:00
zeertzjq
8acb3d742c
Merge pull request #22447 from zeertzjq/vim-8.2.2777
vim-patch:8.2.{1890,2777}
2023-02-28 15:45:56 +08:00
zeertzjq
761a559dbf vim-patch:8.2.2777: Vim9: blob operations not tested in all ways
Problem:    Vim9: blob operations not tested in all ways.
Solution:   Run tests with CheckLegacyAndVim9Success().  Make blob assign with
            index work.

51e933261b

Cherry-pick related changes from patches 8.2.{0633,0634}.

N/A patches for version.c:

vim-patch:8.2.2779: memory access error in remove() for blob

Problem:    Memory access error in remove() for blob.
Solution:   Adjust length for memmove().

f7e92aae15

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 15:21:30 +08:00
zeertzjq
99faac8644 vim-patch:8.2.1890: Vim9: strange error for subtracting from a list
Problem:    Vim9: strange error for subtracting from a list.
Solution:   Check getting a number, not a string. (closes vim/vim#7167)

081db1a66d

Cherry-pick eval_addblob() and eval_addlist() from patch 8.2.0149.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 15:21:14 +08:00
zeertzjq
befb47f2e1
Merge pull request #22446 from zeertzjq/vim-8.2.2757
vim-patch:8.2.{2757,2765,2767}
2023-02-28 14:12:58 +08:00
zeertzjq
1f1227f12b vim-patch:8.2.2767: compiler warning for unused argument
Problem:    Compiler warning for unused argument.
Solution:   Remove the argument.

bd6406f15d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 13:42:33 +08:00
zeertzjq
c554e98978 vim-patch:8.2.2765: Vim9: not all blob operations work
Problem:    Vim9: not all blob operations work.
Solution:   Run more tests also with Vim9 script and :def functions.  Fix what
            doesn't work.

0e3ff19196

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 13:42:04 +08:00
zeertzjq
adfa55ba99 vim-patch:8.2.2757: Vim9: blob tests for legacy and Vim9 script are separate
Problem:    Vim9: blob tests for legacy and Vim9 script are separate.
Solution:   Add CheckLegacyAndVim9Success().  Make blob index assign work.

68452177ca

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 13:28:24 +08:00
luukvbaal
9a271f6afd
fix(column): cmdwin cursor is offset with 'statuscolumn' (#22445) 2023-02-28 10:19:58 +08:00
zeertzjq
f113cba3ec
refactor(getchar.c): change most char_u to uint8_t (#22444) 2023-02-28 08:49:02 +08:00
zeertzjq
1b632e99f2
vim-patch:9.0.1362: ml_get error when going to another tab (#22443)
Problem:    ml_get error when going to another tab. (Daniel J. Perry)
Solution:   Do not call update_topline() if "curwin" is invalid.
            (closes vim/vim#11907)

99ad3a8bb9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-28 08:26:00 +08:00
zeertzjq
2630341db6
fix(tui): avoid stack-use-after-scope with cursor color (#22435) 2023-02-28 07:19:03 +08:00
Lewis Russell
fb2ead6cf3
docs(usr): make usr_05.txt more coherent with Nvim changes (#22428)
- Make section 05.2 more coherent.
- Remove explanation of options that are already default.
2023-02-27 22:17:12 +00:00
Lewis Russell
8ecd129f1e
fix: address -Wmaybe-uninitialized warnings (#22436) 2023-02-27 22:16:12 +00:00