Quentin Rasmont
ffe98531b9
feat(treesitter): upstream get_node_at_cursor()
...
Util from the nvim-treesitter project.
2022-09-06 10:14:05 +02:00
Christian Clason
0822896efc
feat(treesitter): add vim.treesitter.start(), enable for Lua
...
* Add vim.treesitter.start() for starting treesitter highlighting via
ftplugin or autocommand (can be extended later for fold, indent,
matchpairs, ...)
* Add vim.treesitter.stop() for manually stopping treesitter
highlighting
* Enable treesitter highlighting for Lua if
`vim.g.ts_highlight_lua = true` is set in `init.lua`
2022-09-06 08:08:29 +02:00
bfredl
b04ef7f6b9
fix(treesitter): make it get_captures_at_position
2022-08-26 13:57:31 +02:00
Quentin Rasmont
064ecb9ec5
feat(treesitter): upstream get_hl_groups_at_position()
...
Util from the nvim-treesitter project.
2022-08-26 13:57:31 +02:00
Quentin Rasmont
244a115e49
feat(treesitter): clarify similar 'get_node_range' functions
...
The private 'get_node_range' function from the languagetree module has
been renamed and remains private as it serve a purpose that is only
relevant inside the languagetree module.
The 'get_node_range' upstreamed from nvim-treesitter in the treesitter
module has been made public as it is in itself a utlity function.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
133ff6e11e
feat(treesitter): upstream node_contains()
...
Util from the nvim-treesitter project.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
3aba4ba378
feat(treesitter): upstream is_parent()
...
Util from the nvim-treesitter project.
Renamed is_parent to is_ancestor for clarity.
2022-08-25 18:01:14 +02:00
Christian Clason
aefdc6783c
chore: format runtime with stylua
2022-05-09 16:31:55 +02: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
Thomas Vigouroux
8c140be31f
feat(ts): expose minimum language version to lua ( #17186 )
2022-01-27 12:46:56 +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
Thomas Vigouroux
8e0963d307
feat(ts): add query module in treesitter keys
2021-08-23 15:34:08 +02: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
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
Thomas Vigouroux
11bea67a55
fix: allow accessing vim.treesitter.language without require
2021-04-01 16:51:36 +02:00
TJ DeVries
240cec9192
ts: Add language version to vim.treesitter ( #14255 )
2021-03-30 16:40:29 -04:00
Matthieu Coudron
b540141876
chore: remove deprecated lua module tshighlighter
2021-03-16 01:41:28 +01: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
Thomas Vigouroux
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
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
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
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
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
3c5141d2cf
treesitter: add string parser ( #13008 )
2020-09-30 09:32:43 -04:00
Björn Linse
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
Thomas Vigouroux
18c0e77528
treesitter(docs): update and refresh docs
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
341e139992
treesitter: add parser on_lines callbacks
2020-07-10 17:16:24 +02:00
Thomas Vigouroux
529251d5e4
treesitter: call bufload before parsing ( #12603 )
2020-07-10 09:33:27 -04:00
Thomas Vigouroux
b652f74ca3
treesitter: use nodes to mark ranges
2020-06-29 22:21:06 +02:00
Thomas Vigouroux
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
Thomas Vigouroux
6a93077475
treesitter: fix tests
2020-06-03 19:58:02 +02:00
Thomas Vigouroux
e5022c61ed
treesitter: unknown predicates always match #12173
2020-04-30 22:43:30 -07:00
Thomas Vigouroux
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
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
Björn Linse
c844f986d4
tree-sitter: use "module" pattern in lua source
2019-09-28 17:46:25 +02:00
Björn Linse
f86a2c33a2
tree-sitter: simplify editing using the new old_byte_size parameter
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
d24dec596c
tree-sitter: inspect language
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