Commit Graph

27 Commits

Author SHA1 Message Date
Justin M. Keyes
9662cd7f48
fix(tests): unreliable parser_spec #18911
The "first run" has high variability. Looks like the test failures
correlate with 545dc82c1b
, which makes sense because that improves "first run" performance.

So the `1000*` factor of this test could be adjusted to e.g. `300*` or `500*`.

ref https://github.com/neovim/neovim/pull/16945
2022-06-09 08:07:54 -07:00
James McCoy
6b0595d7cc
test(ts): skip test if C parser is not available 2022-06-08 18:04:25 -04:00
Chinmay Dalal
116a3f4683
fix(treesitter): create new parser if language is not the same as cached parser (#18149) 2022-04-22 16:15:28 +02:00
bfredl
6eca9b69c4 feat(ui): allow conceal to be defined in decorations
Unlike syntax conceal, change highlight of concealed char

Can be used in tree-sitter using "conceal" metadata.
2022-03-20 18:02:41 +01:00
Stephan Seitz
8ab5ec4aaa
feat(tree-sitter): allow Atom-style capture fallbacks (#14196)
This allows falling back to `@definition` when we have no mapping
`@definition.fancy-specialization`.

This behavior is described in tree-sitter's documentation
(https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme).

Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/738
2022-02-16 19:38:19 +01:00
kevinhwang91
58d81efcb2 fix: append test for checking zero width node range 2022-02-11 20:59:47 +08:00
Lewis Russell
f9080b24c4
fix(ts): escape lang when loading parsers (#16668)
When trying to load a language parser, escape the value of
the language.

With language injection, the language might be picked up from the
buffer. If this value is erroneous it can cause `nvim_get_runtime_file`
to hard error.

E.g., the markdown expression `~~~{` will extract '{' as a language and
then try to get the parser using `parser/{*` as the pattern.
2022-01-27 10:42:59 +01:00
Stephan Seitz
9c26939f75 perf(treesitter): cache query parsing 2022-01-06 13:20:22 +01:00
Mathias Fußenegger
1f3c0593eb
feat(ts): add support for multiline nodes in get_node_text (#14999)
Based on https://github.com/neovim/neovim/pull/14445

This extends `vim.treesitter.query.get_node_text` to return the text
that spans a node's range even if start_row ~= end_row.
2021-12-12 12:05:39 +01:00
Christian Clason
5676edb86d fix(tests): adapt parser_spec test to tree-sitter bump
Change query to include anonymous nodes (`(_)` -> `[_]`) and
use new syntax (`{vim,lua}.match?`->`#{vim,lua}.match?`)
2021-11-23 18:38:22 +01:00
Dylan Kendal
140084180e
feat(treesitter): add next, prev sibling method
Add tsnode methods to change to the next, previous, named or unnamed
nodes.
2021-08-20 11:58:15 -04:00
Thomas Vigouroux
41912bf777
Merge pull request #15283 from jamessan/pending-c-parsers
test(treesitter): skip all parsers tests if parsers aren't installed
2021-08-06 10:53:18 +02:00
James McCoy
8336488ce1
test(treesitter): skip all parsers tests if parsers aren't installed 2021-08-05 21:41:55 -04:00
Stephan Seitz
b2a9afef6d treesitter: add query.list_directives 2021-07-24 20:57:45 +02:00
Stephan Seitz
242608e669 feat(treesitter): allow to set highlight priority for queries 2021-07-22 21:38:57 +02:00
Raymond W. Ko
7c95697026
treesitter: add predicate "any-of?" (#14344)
For the case of Clojure and other Lisp syntax highlighting, it is
necessary to create huge regexps consisting of hundreds of symbols with
the pipe (|) character. To make things more difficult, these Lisp
symbols sometimes consists of special characters that are themselves
part of special regexp characters like '*'. In addition to being
difficult to maintain, it's performance is suboptimal.

This patch introduces a new predicate to perform 'source' matching in
amortized constant time. This is accomplished by compiling a hash table
on the first use.
2021-05-14 17:41:20 +02:00
Stephan Seitz
5c9b4948d4
treesitter: do not escape in match? (#14382) 2021-05-11 11:52:47 +02:00
derekstride
44d4526e18
Ensure there is a nested table allocated for #set!
Fixes the following bug:
```
test/functional/helpers.lua:107: Error executing lua:
vim/treesitter/query.lua:256: attempt to index a nil value
```
2021-04-27 12:29:37 -02:30
Thomas Vigouroux
e652b2987a
Merge pull request #14046 from nvim-treesitter/feature/language-tree-directive-config
feat(treesitter): allow injections to be configured through directives
2021-04-14 05:36:05 +02:00
Thomas Vigouroux
e8bc3d717e
feat(ts): include parser ABI version in checkhealth 2021-04-06 19:02:58 +02:00
Steven Sojka
8bea39f372 feat(treesitter): allow injections to be configured through directives 2021-04-02 12:48:16 -05:00
TJ DeVries
d50f99f08b
fixup: remove unused test function 2021-03-31 18:09:03 +02:00
TJ DeVries
06c065469b
ts: Add per-language highlight links 2021-03-31 18:09:00 +02:00
TJ DeVries
d6209a7b84 fixup: Add a test and it is so pretty 2021-03-30 10:57:38 -04:00
“jvgrootveld”
a2818819bb treesitter: default start and end row when omitted
Add support for default start and end row when omitted in the
query:iter_captures and query:iter_matches functions.

When the start and end row values are omitted, the values of the given
node is used. The end row value is incremented by 1 to include the node end
row in the match.

Updated tests and docs accordingly.
2021-01-15 21:44:40 +01:00
Björn Linse
a58d96a7ed buffer updates: mark sorted region as changed.
NB: currently this invalidates all extmarks inside the region.
Later on within-line extmarks could be preserved
2021-01-03 14:47:37 +01:00
Björn Linse
adb01190c4 tests: make treesitter its own category 2021-01-03 14:47:29 +01:00