Commit Graph
174 Commits
Author SHA1 Message Date
Björn Linse 94622ca66b buffer updates: add on_reload callback and handle it in treesitter parser 2021-02-10 18:58:46 +01:00
Thomas Vigouroux 3094bb4e38 fix(buf_updates): send updates when putting past last line
Fixes #13710
2021-02-08 19:08:42 +01:00
Björn Linse 209fb35acd tests: clean up lua/buffer_updates_spec.lua 2021-02-04 14:35:30 +01:00
Björn Linse aa50369897 inccommand: preserve extmarks when undoing preview substitution 2021-02-04 14:33:37 +01:00
chentau f0ccac0ba4 lint 2021-01-26 17:09:35 -08:00
Tony Chen d95a465b43 Don't show entire context when completing 2021-01-26 17:04:32 -08:00
TJ DeVries 901dd79f6a feat: add completion to ':lua' 2021-01-26 17:04:31 -08:00
Björn Linse adb01190c4 tests: make treesitter its own category 2021-01-03 14:47:29 +01:00
Björn Linse 39d098f9f9 api: set_text: fix some byte count issues
add byte count tests

update documentation
2021-01-01 19:51:58 +01:00
Björn Linse 5e202f69b3 Merge pull request #13367 from nvim-treesitter/offset-lang-injection
feat(treesitter): add offset predicate for language injection
2020-12-16 13:59:36 +01:00
Thomas Vigouroux 25e20da550 feat(buffer_updates): allow ignoring when previewing
Also adds a test that we actually subscribe to buffer events when in
CMDPREVIEW.
2020-12-15 22:29:27 +01:00
Steven Sojka 929f194145 feat(treesitter): add offset predicate for language injection
refactor(treesitter): add directives to queries
2020-12-15 07:03:47 -06:00
Björn Linse 52e660e857 Merge pull request #13482 from dm1try/propagate_lua_file_loading_errors
runtime: propagate lua parsing errors while using "require"
2020-12-10 12:15:40 +01:00
Thomas Vigouroux 99007bcc12 Merge pull request #13450 from nvim-treesitter/fix-unknown-language-parser
fix(treesitter): don't throw an error for missing injected langs
2020-12-10 11:12:39 +01:00
dm1try 3421485253 runtime: propagate lua parsing errors while using "require" 2020-12-10 10:53:28 +01:00
Steven Sojka e15c5f58df fix(treesitter): don't throw an error for missing injected langs 2020-12-04 16:56:29 -06:00
Steven Sojka 2985c17867 fix(treesitter): incorrect method name call 2020-12-04 16:15:47 -06:00
Thomas Vigouroux 52d76f0a32 fix(treesitter): allow ranges in set_included_ranges 2020-11-23 15:09:32 +01:00
Steven SojkaandThomas Vigouroux 1a631026a9 feat(treesitter): add language tree
Implement the LanguageTree structure to enable language injection.

This is done be removing the old Parser metatable and replacing by the
new structure, with the same API (almost).

Some noticeable differences :
  - `parser:parse()` now returns a table of trees
  - There is no incremental parsing for child (injected) languages

Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
2020-11-23 08:06:17 +01:00
Björn Linse 1b0e4a5906 lua: make vim.inspect available early so it can be used for path debugging 2020-11-05 14:46:41 +01:00
Thomas Vigouroux 8e73cf6731 tree-sitter: ignore some tests on windows
Weirdl this test is failing, but can't reproduce locally, this is an
unnecessary blocker for this PR.
2020-11-03 10:39:36 +01:00
Jan Edmund Lazo 0d9fa42d83 fixup! startup: handle autoload and lua packages during startup 2020-11-02 22:37:07 -05:00
Björn Linse c60c7375f5 startup: handle autoload and lua packages during startup
¡NO HAY BANDA!
2020-11-02 15:21:36 +01:00
Björn Linse 03c478ae53 treesitter: add node:id() 2020-11-01 14:59:17 +01:00
TJ DeVries 0ad5b34170 Merge pull request #12053 from tjdevries/tjdevries/nicer_validate
vim.validate(): include stacktrace in message
2020-10-17 16:47:18 -04:00
Thomas VigourouxandPaul Burlumi bdbc56f931 treesitter: allow custom parser for highlighter
Also allow to get parser ranges.

This will be useful for language injection, allowing us to tweak the
parser's ranges on the fly.

Update runtime/lua/vim/treesitter.lua

Co-authored-by: Paul Burlumi <paul@burlumi.com>
2020-10-12 18:23:14 +02:00
Thomas VigourouxandPaul Burlumi 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