aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/parser_spec.lua
Commit message (Collapse)AuthorAge
...
* feat(treesitter): upstream foldexpr from nvim-treesitterLewis Russell2023-02-23
|
* perf(treesitter): smarter languagetree invalidationLewis Russell2023-02-23
| | | | | | | | | | | | | | Problem: Treesitter injections are slow because all injected trees are invalidated on every change. Solution: Implement smarter invalidation to avoid reparsing injected regions. - In on_bytes, try and update self._regions as best we can. This PR just offsets any regions after the change. - Add valid flags for each region in self._regions. - Call on_bytes recursively for all children. - We still need to run the query every time for the top level tree. I don't know how to avoid this. However, if the new injection ranges don't change, then we re-use the old trees and avoid reparsing children. This should result in roughly a 2-3x reduction in tree parsing when the comment injections are enabled.
* feat(treesitter): add filetype -> lang APILewis Russell2023-02-21
| | | | | | | | | | | | | | | | | | Problem: vim.treesitter does not know how to map a specific filetype to a parser. This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang. Solution: Add an API to enable this: - Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language(). - Optional arguments are now passed via an opts table. - Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs. - Deprecated vim.treesitter.language.require_language(). - Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype. - Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
* feat(treesitter): add metadata option for get_node_textfigsoda2023-02-04
|
* feat(treesitter): allow capture text to be transformedfigsoda2023-02-04
| | | | Co-authored-by: Lewis Russell <lewis6991@gmail.com>
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* test: don't skip parser_spec on windows (#20294)dundargoc2022-11-15
|
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* ci(tests): don't skip parsers on functionaltestChristian Clason2022-09-06
| | | | | Treesitter parsers are now a mandatory part of the installation and should be tested on all platforms. Remove `pending_c_parser` helper.
* fix(ci): noisy logs, unreliable test #19019Justin M. Keyes2022-06-18
| | | | | | | | | | | | | | | | | | | Problem: 1. CI logs have too many (40+) logs mentioning SIGHUP: ``` WRN 2022-06-18T16:05:47.075 T3568.22499.0/c deadly_signal:177: got signal 1 (SIGHUP) WRN 2022-06-18T16:05:47.273 T3569.91095.0/c deadly_signal:177: got signal 1 (SIGHUP) WRN 2022-06-18T16:05:47.651 T3570.59545.0/c deadly_signal:177: got signal 1 (SIGHUP) ``` 2. TS parser test still sometimes fails on BSD CI. 3. remote_spec test fails too often. Solution: 1. Log deadly signals at INFO level. It hasn't been helpful in CI, and for local troubleshooting it's reasonable to adjust the loglevel as needed. 2. Adjust the TS parser test again. ref #18911 3. Skip the remote_spec test. The `--remote` feature was merged before it was fully formed and needs to be revisited.
* fix(tests): unreliable parser_spec #18911Justin M. Keyes2022-06-09
| | | | | | | | | The "first run" has high variability. Looks like the test failures correlate with 545dc82c1b22709c83ec23e9450f245f9ff1babc , 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
* fix: append test for checking zero width node rangekevinhwang912022-02-11
|
* fix(ts): escape lang when loading parsers (#16668)Lewis Russell2022-01-27
| | | | | | | | | | | 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.
* perf(treesitter): cache query parsingStephan Seitz2022-01-06
|
* 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.
* fix(tests): adapt parser_spec test to tree-sitter bumpChristian Clason2021-11-23
| | | | | Change query to include anonymous nodes (`(_)` -> `[_]`) and use new syntax (`{vim,lua}.match?`->`#{vim,lua}.match?`)
* Merge pull request #15283 from jamessan/pending-c-parsersThomas Vigouroux2021-08-06
|\ | | | | test(treesitter): skip all parsers tests if parsers aren't installed
| * test(treesitter): skip all parsers tests if parsers aren't installedJames McCoy2021-08-05
| |
* | 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
|
* 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 ```
* feat(treesitter): allow injections to be configured through directivesSteven Sojka2021-04-02
|
* 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.
* tests: make treesitter its own categoryBjörn Linse2021-01-03