Commit Graph

129 Commits

Author SHA1 Message Date
240cec9192 ts: Add language version to vim.treesitter (#14255) 2021-03-30 16:40:29 -04:00
b540141876 chore: remove deprecated lua module tshighlighter 2021-03-16 01:41:28 +01:00
94622ca66b buffer updates: add on_reload callback and handle it in treesitter parser 2021-02-10 18:58:46 +01:00
fa5f583981 treesitter: propagate on_detach event properly 2021-02-10 18:57:49 +01:00
acf6ed5541 fix(treesitter): use source() method on attach
Fixes an issue that tree-sitter always attached to the current buffer,
instead of the provided buffer.
2021-01-14 12:01:50 +01:00
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
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
c7d460c197 treesitter: separate tree and parser
While this might sound silly, it is needed for further improvements.
2020-11-04 08:14:20 +01:00
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
3c5141d2cf treesitter: add string parser (#13008) 2020-09-30 09:32:43 -04:00
9437327d5e treesitter: use new on_bytes interface
This will significantly reduce the parsing work
needed e.g. when rehighlighting after every keypress
in insert mode.

Also add safety check for tree-sitter trying to read
past the end of a line. This can happen after we sent
an incorrect buffer update.
2020-09-09 21:22:21 +02:00
18c0e77528 treesitter(docs): update and refresh docs 2020-08-13 20:30:15 +02:00
613068071e treesitter: refactor and use lua regexes 2020-08-13 20:30:15 +02:00
341e139992 treesitter: add parser on_lines callbacks 2020-07-10 17:16:24 +02:00
529251d5e4 treesitter: call bufload before parsing (#12603) 2020-07-10 09:33:27 -04:00
b652f74ca3 treesitter: use nodes to mark ranges 2020-06-29 22:21:06 +02:00
333f3f19db treesitter: add set_included_ranges to the parser
This is the first step towards language injection using treesitter.
2020-06-29 22:21:06 +02:00
6a93077475 treesitter: fix tests 2020-06-03 19:58:02 +02:00
e5022c61ed treesitter: unknown predicates always match #12173 2020-04-30 22:43:30 -07:00
1fb44ba835 treesitter: escape backslashes in queries
Treesitter changed their decoders and apparently thus causing this
change.

This decoder change happened on
ee9a3c0ebb218990cf391ed987be7f2448c54a73.
2020-04-18 09:20:13 +02:00
9c00fea585 lua: add regex support, and @match support in treesitter queries 2020-02-26 19:39:02 +01:00
00c57c98df treesitter: add standard &rtp/parser/ search path for parsers 2020-02-07 09:22:55 +01:00
440695c296 tree-sitter: implement query functionality and highlighting prototype [skip.lint] 2019-12-22 12:51:46 +01:00
c844f986d4 tree-sitter: use "module" pattern in lua source 2019-09-28 17:46:25 +02:00
f86a2c33a2 tree-sitter: simplify editing using the new old_byte_size parameter 2019-09-28 17:46:25 +02:00
06ee45b9b1 tree-sitter: fix lint, delete "demo" plugin (replaced by functional tests) 2019-09-28 17:46:25 +02:00
167a1cfdef tree-sitter: improve parser API (shared parser between plugins) 2019-09-28 14:55:43 +02:00
d24dec596c tree-sitter: inspect language 2019-09-28 14:55:43 +02:00
c8f861b739 tree-sitter: rename tree_sitter => treesitter for consistency 2019-09-28 14:55:43 +02:00