Raphael
6b1a8f23d7
refactor(lua): replace vim.cmd use with API calls ( #19283 )
...
Signed-off-by: Raphael <glephunter@gmail.com >
2022-07-09 18:40:32 +02:00
Christian Clason
aa4f9c5341
refactor(lua): reformat with stylua 0.14.0 ( #19264 )
...
* reformat Lua runtime to make lint CI pass
* reduce max line length to 100
2022-07-07 18:27:18 +02:00
kevinhwang91
8780076a78
fix(treesitter): new iter if folded
2022-06-16 17:38:10 +02:00
Christian Clason
26966688aa
fix(treesitter): correct region for string parser ( #18794 )
...
fixes injections for string parsers after eab4d03a32
2022-06-02 17:35:16 +02:00
Lewis Russell
eab4d03a32
fix(treesitter): offset directive associates range with capture ( #18276 )
...
Previously the `offset!` directive populated the metadata in such a way
that the new range could be attributed to a specific capture. #14046
made it so the directive simply stored just the new range in the
metadata and information about what capture the range is based from is
lost.
This change reverts that whilst also correcting the docs.
2022-05-28 19:22:18 +02:00
Christian Clason
d200ba654a
Merge pull request #18502 from drybalka/fix-languagetree-contains-description
...
treesitter: small improvements of languagetree.lua
2022-05-19 09:17:10 +02:00
Denys
fec944142b
refactor: simple logic in tree_contains()
2022-05-18 19:28:49 +02:00
Denys
f66a60805d
docs: correct description of LanguageTree:contains()
2022-05-18 19:28:41 +02:00
Christian Clason
aefdc6783c
chore: format runtime with stylua
2022-05-09 16:31:55 +02:00
Gregory Anders
6d648f5594
feat(treesitter): add more default groups to highlight map ( #17835 )
...
This covers some default groups listed in :h group-name.
2022-03-30 22:14:20 +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
Chinmay Dalal
e481901748
docs: treesitter.txt - fix overflowing lines, document minimum_language_version ( #17286 )
2022-02-13 14:43:25 +01:00
kevinhwang91
afcf64479c
fix(query.lua): check empty table for lines
...
The range of node may make `nvim_buf_get_lines` return an empty table.
2022-02-11 14:44:37 +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
dundargoc
0b0c4f7dfa
chore: fix typos ( #16816 )
...
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com >
Co-authored-by: Gregory Anders <greg@gpanders.com >
Co-authored-by: Sebastian Volland <seb@baunz.net >
Co-authored-by: Lewis Russell <lewis6991@gmail.com >
Co-authored-by: zeertzjq <zeertzjq@outlook.com >
2022-01-04 11:07:40 -07:00
Lewis Russell
6e6c36ca5b
feat(treesitter): multiline match predicates
2021-12-12 12:16:42 +00: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
dundargoc
caa6992a10
chore: fix typos ( #16361 )
...
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com >
Co-authored-by: zeertzjq <zeertzjq@outlook.com >
Co-authored-by: István Donkó <istvan.donko@gmail.com >
Co-authored-by: Julian Berman <Julian@GrayVines.com >
Co-authored-by: bryant <bryant@users.noreply.github.com >
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com >
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com >
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com >
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com >
Co-authored-by: dm1try <me@dmitry.it >
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl >
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com >
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com >
Co-authored-by: zeertzjq <zeertzjq@outlook.com >
Co-authored-by: István Donkó <istvan.donko@gmail.com >
Co-authored-by: Julian Berman <Julian@GrayVines.com >
Co-authored-by: bryant <bryant@users.noreply.github.com >
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com >
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com >
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com >
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com >
Co-authored-by: dm1try <me@dmitry.it >
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl >
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com >
2021-11-27 11:10:48 -05:00
Javier Lopez
0a7a215aa6
fix(healthcheck): update builtins to the new convention #15914
...
Adjust some builtin healthchecks to use Lua, after #15259
2021-10-05 05:05:33 -07:00
Gregory Anders
c2a211b8e3
docs: make Lua docstrings consistent #15255
...
The official developer documentation in in :h dev-lua-doc specifies to
use "--@" for special/magic tokens. However, this format is not
consistent with EmmyLua notation (used by some Lua language servers) nor
with the C version of the magic docstring tokens which use three comment
characters.
Further, the code base is currently split between usage of "--@",
"---@", and "--- @". In an effort to remain consistent, change all Lua
magic tokens to use "---@" and update the developer documentation
accordingly.
2021-08-22 13:55:28 -07:00
Björn Linse
2460f0a702
perf(treesitter): avoid string lookup of highlight name in hot loop
...
These numbers are guaranteed to be stable even if you do "highlight
clear" (all attributes disappear, but not the id to name mapping itself)
2021-08-19 16:45:04 +02:00
Stephan Seitz
912152d635
chore: remove reference to nvim-treesitter in comment
2021-08-06 22:08:45 +02:00
Stephan Seitz
f489d98653
fix(treesitter): do not map hl_group when no mapping is set
...
This changes the behavior of the hl_cache to the old one.
- when the capture exists as a hlgroup -> use it
- when hl_map contains a mapping -> use it
- else do nothing (before: map capture to non-existing capture)
Before also captures `@foo.bar` would intend to use the hlgroup `foo.bar`
which results in a confusing error since hlgroups can't contain dots.
2021-08-06 22:04:28 +02:00
Thomas Vigouroux
5c42e2a87f
docs(ts): add documentation for listing fns
2021-07-25 20:52:05 +02: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
Thomas Vigouroux
3fc71ea228
Merge pull request #14418 from DerekStride/treesitter-set-directive
...
[RDY] tree-sitter ensure there is a nested table allocated for `#set!`
2021-05-03 21:41:39 +02:00
TJ DeVries
27da5511a0
docs: Treesitter ( #13260 )
...
* doc & fixes: Generate treesitter docs
* fixup to treesitter-core
* docs(treesitter): fix docs for most functions
Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com >
2021-05-01 08:19:48 -04: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
Marco Hinz
cd75d3289a
Merge pull request #14200 from teto/treesitter-checkhealth
...
feat: treesitter checkhealth
2021-04-07 16:40:56 +02:00
Thomas Vigouroux
952508d405
fix(ts): move checkhealth in runtime/vim
2021-04-06 19:03:04 +02:00
Steven Sojka
8bea39f372
feat(treesitter): allow injections to be configured through directives
2021-04-02 12:48:16 -05:00
Stephan Seitz
43eb22d4c9
Fix #14192 : Handle IO errors and close files in query.lua
2021-04-02 16:21:49 +02:00
Thomas Vigouroux
3f7cd18c4a
Merge pull request #14218 from steelsojka/bugfix/check-queries-exist
...
fix(treesitter): check highlight queries exist
2021-04-02 05:24:49 +02:00
TJ DeVries
06c065469b
ts: Add per-language highlight links
2021-03-31 18:09:00 +02:00
TJ DeVries
04fb94cd80
ts: Add per-language query overriding
2021-03-30 08:25:11 -04:00
Steven Sojka
98f9df253e
fix(treesitter): check highlight queries exist
2021-03-26 11:25:19 -05:00
Steven Sojka
2a794b8f5d
fix(treesitter): dedupe runtime file list
2021-03-23 12:58:27 -05:00
Simon Hauser
6b7cc45c48
fix: treesitter languagetree crash when using telescope buffer previewer ( #13986 )
2021-02-23 21:39:35 -05:00
Björn Linse
94622ca66b
buffer updates: add on_reload callback and handle it in treesitter parser
2021-02-10 18:58:46 +01:00
Björn Linse
fa5f583981
treesitter: propagate on_detach event properly
2021-02-10 18:57:49 +01:00
Santos Gallegos
947f9a04d4
treesitter: small fixes
...
Mostly typos I found while reading the code.
2021-02-07 01:27:38 -05:00
Steven Sojka
ed558e269a
fix(languagetree): use tree nodes instead of regions in contains
2021-01-20 06:52:47 -06:00
“jvgrootveld”
9bed991cfb
treesitter: Fix linter warning and add helper function to remove duplicated logic
...
This function returns the start and stop value if set else the node's range is used
When the node's range is used, the stop is incremented by 1 to make the search inclusive
2021-01-18 08:17:12 +01: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