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
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 Sojka
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
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
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 Vigouroux
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 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
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
Thomas Vigouroux
3c5141d2cf
treesitter: add string parser ( #13008 )
2020-09-30 09:32:43 -04:00
Thomas Vigouroux
e4b5efa51e
fix: use luahl in treesitter
2020-09-13 07:46:39 +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
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
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
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
Thomas Vigouroux
6a93077475
treesitter: fix tests
2020-06-03 19:58:02 +02:00
Thomas Vigouroux
8349192503
treesitter: update runtime
...
Since tree-sitter PR 615, predicates are not parsed the same.
"Old" way of writing predicates is still supported.
2020-06-02 21:19:07 +02:00
Björn Linse
9c00fea585
lua: add regex support, and @match
support in treesitter queries
2020-02-26 19:39:02 +01:00
Björn Linse
00c57c98df
treesitter: add standard &rtp/parser/ search path for parsers
2020-02-07 09:22:55 +01:00
Björn Linse
440695c296
tree-sitter: implement query functionality and highlighting prototype [skip.lint]
2019-12-22 12:51:46 +01:00
Justin M. Keyes
316c29bbf3
test/pcall_err(): truncate full paths, omit linenr
...
ref #11271
2019-10-26 02:00:58 -07:00
Björn Linse
9fa850991d
tree-sitter: improve and cleanup tests
2019-09-28 17:46:25 +02:00
Björn Linse
d5a69eb076
tree-sitter: handle node equality
2019-09-28 17:46:25 +02:00
Björn Linse
e0d6228978
tree-sitter: use "range" instead of "point_range" consistently in lua API
2019-09-28 17:46:25 +02:00
Björn Linse
06ee45b9b1
tree-sitter: fix lint, delete "demo" plugin (replaced by functional tests)
2019-09-28 17:46:25 +02:00
Björn Linse
167a1cfdef
tree-sitter: improve parser API (shared parser between plugins)
2019-09-28 14:55:43 +02:00
Björn Linse
c8f861b739
tree-sitter: rename tree_sitter => treesitter for consistency
2019-09-28 14:55:43 +02:00