aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/query.lua
Commit message (Collapse)AuthorAge
* fix(treesitter): don't error when node argument of predicate is nil (#19355)Stephan Seitz2022-07-14
| | | | | | When the node mentioned in a predicate is not required for the query then predicates putting restrictions on that node shouldn't run. Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/2600
* fix(treesitter): offset directive associates range with capture (#18276)Lewis Russell2022-05-28
| | | | | | | | | 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.
* chore: format runtime with styluaChristian Clason2022-05-09
|
* docs: treesitter.txt - fix overflowing lines, document ↵Chinmay Dalal2022-02-13
| | | | minimum_language_version (#17286)
* fix(query.lua): check empty table for lineskevinhwang912022-02-11
| | | | The range of node may make `nvim_buf_get_lines` return an empty table.
* perf(treesitter): cache query parsingStephan Seitz2022-01-06
|
* feat(treesitter): multiline match predicatesLewis Russell2021-12-12
|
* feat(ts): add support for multiline nodes in get_node_text (#14999)Mathias Fußenegger2021-12-12
| | | | | | 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.
* chore: fix typos (#16361)dundargoc2021-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | 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.
* docs(ts): add documentation for listing fnsThomas Vigouroux2021-07-25
|
* treesitter: add query.list_directivesStephan Seitz2021-07-24
|
* treesitter: add predicate "any-of?" (#14344)Raymond W. Ko2021-05-14
| | | | | | | | | | | | 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.
* treesitter: do not escape in match? (#14382)Stephan Seitz2021-05-11
|
* Merge pull request #14418 from DerekStride/treesitter-set-directiveThomas Vigouroux2021-05-03
|\ | | | | [RDY] tree-sitter ensure there is a nested table allocated for `#set!`
| * Ensure there is a nested table allocated for #set!derekstride2021-04-27
| | | | | | | | | | | | | | | | Fixes the following bug: ``` test/functional/helpers.lua:107: Error executing lua: vim/treesitter/query.lua:256: attempt to index a nil value ```
* | docs: Treesitter (#13260)TJ DeVries2021-05-01
|/ | | | | | | | | * doc & fixes: Generate treesitter docs * fixup to treesitter-core * docs(treesitter): fix docs for most functions Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
* Merge pull request #14046 from ↵Thomas Vigouroux2021-04-14
|\ | | | | | | | | nvim-treesitter/feature/language-tree-directive-config feat(treesitter): allow injections to be configured through directives
| * feat(treesitter): allow injections to be configured through directivesSteven Sojka2021-04-02
| |
* | Fix #14192: Handle IO errors and close files in query.luaStephan Seitz2021-04-02
|/
* ts: Add per-language query overridingTJ DeVries2021-03-30
|
* fix(treesitter): dedupe runtime file listSteven Sojka2021-03-23
|
* treesitter: small fixesSantos Gallegos2021-02-07
| | | | Mostly typos I found while reading the code.
* treesitter: Fix linter warning and add helper function to remove duplicated ↵“jvgrootveld”2021-01-18
| | | | | | | 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
* treesitter: default start and end row when omitted“jvgrootveld”2021-01-15
| | | | | | | | | | | 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.
* treesitter: simplify query reading logicBjörn Linse2021-01-04
| | | | | | | | | | | | | | Only the plugin/package manager should "manage" after/. Consumers of nvim_get_runtime_file() should not need to special case it (if your plugin manager is broken then fix it instead). Don't use vim.fn.readfile(). Lua can already read files. It is even better at it than vim script. expose M.get_query_files(). Listing the queries is essential for user config debug, and let plugins do fun things with it. Abstraction-by-obscurity is not useful (plugins can just cargo cult copy the code anyway, better with public entry points).
* feat(treesitter): add offset predicate for language injectionSteven Sojka2020-12-15
| | | | refactor(treesitter): add directives to queries
* tree-sitter: Put base languages first in queriesStephan Seitz2020-11-08
| | | | | | | | This reverts the handling of base languages to the old way how nvim-treesitter handled them. When a language extends a base language it usually wants to be able to overwrite queries. Related: https://github.com/nvim-treesitter/nvim-treesitter/issues/633
* fix(treesitter): account for no main query fileSteven Sojka2020-10-28
|
* treesitter: runtime queriesThomas Vigouroux2020-10-11
| | | | | | | | | | | | | 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>
* treesitter: add string parser (#13008)Thomas Vigouroux2020-09-30
|
* lint: just bit twiddlin'Björn Linse2020-09-06
|
* treesitter: simplify match_predsThomas Vigouroux2020-09-06
|
* treesitter: use lua-match? instead of match?Thomas Vigouroux2020-09-06
|
* treesitter: allow to list supported predicatesThomas Vigouroux2020-09-04
|
* treesitter: avoid escaping complete query stringsStephan Seitz2020-08-31
| | | | | Escape "\\" only for `vim-match?` not for `match?` Fixes #12595
* treesitter: allow to force predicate additionThomas Vigouroux2020-08-13
|
* treesitter: add predicate negationThomas Vigouroux2020-08-13
|
* treesitter: add and test vim-match? predicateThomas Vigouroux2020-08-13
|
* treesitter: add contains? predicateThomas Vigouroux2020-08-13
|
* treesitter(docs): update and refresh docsThomas Vigouroux2020-08-13
|
* treesitter: refactor and use lua regexesThomas Vigouroux2020-08-13