Thomas Vigouroux
d3f544002c
treesitter: runtime queries
...
Runtime queries just work like ftplugins, that is:
- Queries in the `after` directory are sourced _after_ the "base" query
- Otherwise, the last define query takes precedence.
Queries can be found in the `queries` directory.
Update runtime/lua/vim/treesitter/query.lua
Co-authored-by: Paul Burlumi <paul@burlumi.com >
2020-10-11 21:18:28 +02:00
Björn Linse
0b615dae07
api: multiple decoration providers at once
2020-10-10 15:16:45 +02:00
TJ DeVries
7b89353985
lua: vim.wait allows control of fast events ( #13053 )
...
* lua: vim.wait allows control of fast events
* fixup: remove requirement of function for easier waiting
* fixup: lint
* fixup: bfredl comments
2020-10-06 12:58:05 -04:00
Justin M. Keyes
8e77d70e29
test/vim.validate(): assert normalized stacktrace
...
- The previous commit lost information in the tests. Instead, add some
more "normalization" substitutions in pcall_err(), so that the general
shape of the stacktrace is included in the asserted text.
- Eliminate contains(), it is redundant with matches()
2020-10-05 09:47:59 -04:00
TJ DeVries
aad7a74053
vim.validate(): include stacktrace in message
2020-10-05 09:47:59 -04:00
KillTheMule
02dcc3c11a
Fix byte updates for blockwise paste at buffer end
2020-09-30 21:28:21 +02:00
Thomas Vigouroux
c1a740ae33
bytetrack: add blockwise paste test
2020-09-30 20:10:06 +02:00
KillTheMule
ba515622fb
Fix buffer_updates on blockwise paste
...
Fixes #12718 .
2020-09-30 20:10:05 +02:00
Thomas Vigouroux
3c5141d2cf
treesitter: add string parser ( #13008 )
2020-09-30 09:32:43 -04:00
Björn Linse
3610d0091f
test: buffer updates: add visual charwise paste test
2020-09-19 15:50:35 +02:00
Björn Linse
b7fc7ac6a1
buffer updates: fix issues with "change" operator
2020-09-19 10:01:00 +02:00
Björn Linse
4cc2a7af4b
tests: lua buffer updates: reorg check_events()
2020-09-19 09:58:31 +02:00
Thomas Vigouroux
179f0bca18
buf_updates: fix wrong updates on linewise change
2020-09-18 17:54:49 +02:00
Thomas Vigouroux
6dc815530b
buf_updates: fix updates for empty buffers ( #12926 )
...
On empty buffers, when editing the first line, the line is buffered, causing offset to be < 0. While the buffer is not actually empty, the buffered line has not been flushed (and should not be) yet, so the call is valid but an edge case.
2020-09-17 23:34:28 +02:00
Thomas Vigouroux
9a7f111db6
treesitter: filter updates on <CR>
...
This fixes an error when fo=ro, when hitting <CR> to insert a new
comment line.
2020-09-16 16:35:17 +02:00
Björn Linse
34c0f7af04
buf_attach: fix buffer updates with setline()
2020-09-16 13:50:16 +02:00
Björn Linse
ead2fcf4ee
api: add nvim_buf_call to call function with curbuf changed to buffer
2020-09-13 09:11:38 +02:00
Thomas Vigouroux
e4b5efa51e
fix: use luahl in treesitter
2020-09-13 07:46:39 +02:00
Thomas Vigouroux
a8f71676a1
fix(bufupdates): avoid sending empty updates
2020-09-11 14:48:10 +02:00
Thomas Vigouroux
f0e258cf85
fix(bytetrack): send correct events when opening lines
...
a bit of test cleanup
ärrår
feeel
SPLIT
fix: sned correct updates on <CR>
2020-09-11 14:38:58 +02:00
Björn Linse
f239134fee
tests: disable hl glitch test for now, will be fixed in luahl (next PR)
2020-09-10 06:50:04 +02:00
Thomas Vigouroux
82fb6a8818
fix lints
2020-09-09 21:22:21 +02:00
Björn Linse
bc86f76c0a
api/buffer: add "on_bytes" callback to nvim_buf_attach
...
This implements byte-resolution updates of buffer changes.
Note: there is no promise that the buffer state is valid inside
the callback!
2020-09-09 21:22:21 +02:00
Thomas Vigouroux
1ff064126d
treesitter: revert wrong optimization in highlights
2020-09-09 16:00:19 +02:00
Björn Linse
b397f31ede
tests: update query.list_predicates() test
2020-09-06 10:33:13 +02:00
Thomas Vigouroux
dc579c420b
treesitter: Use excplicit names in tests
2020-09-06 10:30:40 +02:00
Thomas Vigouroux
3fd6e3b923
treesitter: allow to list supported predicates
2020-09-04 15:24:23 +02:00
Thomas Vigouroux
4bcf54478a
Merge pull request #12814 from theHamsta/escape-queries
...
treesitter: avoid escaping complete query strings
2020-09-01 12:50:21 +02:00
Thomas Vigouroux
18217b987f
treesitter: add node:field() to get field children
2020-09-01 08:57:55 +02:00
Stephan Seitz
b058c671d2
treesitter: avoid escaping complete query strings
...
Escape "\\" only for `vim-match?` not for `match?`
Fixes #12595
2020-08-31 17:24:38 +02:00
Thomas Vigouroux
e123fd0a5d
treesitter: allow to iterate over node children
2020-08-31 13:42:30 +02:00
Thomas Vigouroux
24b5f69a49
fix(win): ignore closing wins in win_findbuf #12798
...
This caused segfaults when calling win_findbuf in an `on_detach`
callback, when the callback was triggered when closing the last window
containing the buffer.
2020-08-31 00:53:10 -07:00
TJ DeVries
3ccdbc570d
lua: add vim.register_keystroke_callback ( #12536 )
...
* feat: Add vim.register_keystroke_callback
* fixup: Forgot to remove mention of old option
* fixup: Answer jamessan comments
* fixup: Answer norcalli comments
* fixup: portability
* Update runtime/doc/lua.txt
Co-authored-by: Ashkan Kiani <ashkan.k.kiani@gmail.com >
2020-08-14 10:03:17 -04:00
Thomas Vigouroux
d7b12e58df
treesitter: add and test vim-match? predicate
2020-08-13 20:30:15 +02:00
Thomas Vigouroux
58e37d7df8
treesitter: add contains? predicate
2020-08-13 20:30:15 +02:00
Thomas Vigouroux
613068071e
treesitter: refactor and use lua regexes
2020-08-13 20:30:15 +02:00
Thomas Vigouroux
2c34780c32
buffer_updates: emit valid old_byte_size
...
Test this using treesitter highlighting, which is based on this
old_byte_size.
2020-07-21 19:18:04 +02:00
TJ DeVries
398201cfab
lua: Fix crash on unprotected lua errors ( #12658 )
...
Can be reproduced with a script like this:
-- in some lua file
vim.fn.timer_start(10, function() error("uh....") end)
-- will cause neovim to crash with the following error.
PANIC: unprotected error in call to Lua API
(nlua_CFunction_func_call failed.)
After this, it will instead print the error message
from the top of the stack, like so.
tmp/error_nvim.lua:10: uh...
Also added an example test. Previously this test
caused the embedded nvim to panic.
2020-07-19 17:16:48 -04:00
TJ DeVries
6360cf7ce8
lua: Add ability to pass tables with __call
...
vim-patch:8.2.1054: not so easy to pass a lua function to Vim
vim-patch:8.2.1084: Lua: registering function has useless code
I think I have also opened up the possibility for people to use these
callbacks elsewhere, since I've added a new struct that we should be
able to use.
Also, this should allow us to determine what the state of a list is in
Lua or a dictionary in Lua, since we now can track the luaref as we go.
2020-07-10 20:23:12 -04:00
TJ DeVries
971a191c4d
lua: Add ability to pass lua functions directly to vimL
2020-07-10 16:17:33 -04:00
Thomas Vigouroux
d19132ffd1
treesitter: update test to show overlapping works
2020-07-10 17:16:24 +02:00
Thomas Vigouroux
69816f5e13
treesitter: use single nodes in set_ranges
...
fixup! treesitter: fix lint
2020-06-29 23:32:49 +02:00
Thomas Vigouroux
66af35fc85
treesitter: separate tests into smaller pieces
2020-06-29 22:21:06 +02:00
Thomas Vigouroux
b652f74ca3
treesitter: use nodes to mark ranges
2020-06-29 22:21:06 +02:00
Thomas Vigouroux
ac18403d6e
treesitter: test newly added set_included_ranges
2020-06-29 22:21:06 +02:00
Matthieu Coudron
dbc8ec9446
Merge pull request #12321 from vigoux/treesitter-runtime
...
treesitter: update runtime
2020-06-06 15:37:51 +02:00
TJ DeVries
d14298a1f0
test: remove flaky unhelpful test
...
vim.wait( sthg)
2020-06-06 01:11:12 +02:00
notomo
ac5a3f2c56
lua: fix behavior when split empty string ( #12429 )
...
* lua: fix behavior when split empty string
* test: lsp.util.apply_text_edits with an empty edit
2020-06-04 08:48:48 -04:00
Thomas Vigouroux
6a93077475
treesitter: fix tests
2020-06-03 19:58:02 +02:00
notomo
60c581b35d
lua: fix infinite loop for vim.split on empty string ( #12420 )
2020-06-02 19:31:43 -04:00