aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter
Commit message (Collapse)AuthorAge
...
| * refactor(treesitter): use string.format to create linesGregory Anders2023-03-02
| |
* | fix(treesitter): typos in _range.luaJaehwang Jung2023-03-03
| | | | | | fix(treesitter): typos _range.lua
* | fix(treesitter): disallow empty filetypesLewis Russell2023-03-03
|/ | | Fixes #22473
* fix(treesitter): fixup for healthLewis Russell2023-02-27
|
* fix(treesitter): ipairs -> pairsLewis Russell2023-02-27
| | | Fixes: https://github.com/nvim-treesitter/nvim-treesitter/issues/4349
* fix(treesitter): remove virtual text from playgroundLewis Russell2023-02-27
| | | Implement the range and lang annotations as comments instead
* feat(treesitter): expand the APILewis Russell2023-02-26
|
* feat(treesitter)!: remove silent option from language.add()Lewis Russell2023-02-24
| | | Simply use `pcall` if you want to silence an error.
* fix(treesitter): fixup language invalidation (#22381)Lewis Russell2023-02-23
|
* 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.
* docs: fix more treesitter parsing errorsChristian Clason2023-02-23
|
* docs(treesitter): fix parse errorsChristian Clason2023-02-23
|
* 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.
* fix(treesitter): make params optionalLewis Russell2023-02-15
|
* feat(treesitter): playground improvementsLewis Russell2023-02-10
| | | | | | - Render node ranges as virtual text - Set filettype=query. The virtual text is to avoid parsing errors. - Make sure highlights text is always in view.
* feat(treesitter): respect metadata[id].range for offset!figsoda2023-02-04
|
* 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>
* fix(treesitter): fix most diagnosticsLewis Russell2023-02-04
|
* fix(treesitter): validate language nameChristian Clason2023-01-28
| | | | | | | | | Problem: Some injections (like markdown) allow specifying arbitrary language names for code blocks, which may be lead to errors when looking for a corresponding parser in runtime path. Solution: Validate that the language name only contains alphanumeric characters and `_` (e.g., for `c_sharp`) and error otherwise.
* fix(treesitter): really restore syntaxLewis Russell2023-01-17
| | | | | - also unset b:ts_highlight on stop() Fixes: #21836
* docs: treesitter.add_directive, add_predicate #21206Ching Pei Yang2023-01-16
|
* fix(ts): check buffer is loaded when restoring options (#21419)Lewis Russell2022-12-14
| | | | | | | fix(treesitter): check buffer is loaded when restoring options Also restore spelloptions Fixes #21416
* fix(treesitter): properly restore `'syntax'` (#21358)Lewis Russell2022-12-14
|
* feat(treesitter): add 'lang' option to show_tree() (#21341)Gregory Anders2022-12-08
| | | | This is necessary for now to support filetypes that use a parser with a different name (e.g. the "terraform" filetype uses the "hcl" parser).
* feat(treesitter): add vim.treesitter.show_tree() (#21322)Gregory Anders2022-12-08
| | | | | | | Add a "show_tree" function to view a textual representation of the nodes in a language tree in a window. Moving the cursor in the window highlights the corresponding text in the source buffer, and moving the cursor in the source buffer highlights the corresponding nodes in the window.
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* feat(spell): support nospell in treesitter queriesLewis Russell2022-11-12
|
* feat(checkhealth): check runtime ($VIMRUNTIME)Justin M. Keyes2022-10-30
| | | | | | Move man/health.lua into the "runtime" check. fix #20696
* feat(checkhealth): improve treesitter reportJustin M. Keyes2022-10-30
|
* fix(query): fix unnatural order for inherits in treesitter queries (#20298)Sergey Berezhnoy2022-09-29
| | | close #20297
* fix(docs): invalid :help links #20345Justin M. Keyes2022-09-25
| | | | | Fix those naughty single quotes. closes #20159
* docs(treesitter): clean up and update treesitter.txt (#20142)Christian Clason2022-09-14
| | | | | * add type annotations to code * clean up and expand static documentation * consistent use of tags for static and generated docs
* fix(treesitter): prevent endless loop on self-inheritenceThomas Vigouroux2022-09-11
| | | | Fixes #20139
* fix(treesitter): use the right loading order for base queries (#20117)bfredl2022-09-08
| | | | | Use the first, not last, query for a language on runtimepath. Typically, this implies that a user query will override a site plugin query, which will override a bundled runtime query.
* feat(treesitter)!: do not merge queries by default (#20105)Thomas Vigouroux2022-09-08
| | | | | | | | | | Problem: Treesitter queries for a given language in runtime were merged together, leading to errors if they targeted different parser versions (e.g., bundled viml queries and those shipped by nvim-treesitter). Solution: Runtime queries now work as follows: * The last query in the rtp without `; extends` in the header will be used as the base query * All queries (without a specific order) with `; extends` are concatenated with the base query BREAKING CHANGE: queries need to be updated if they are meant to extend other queries
* Use weak tables in tree-sitter code (#17117)Thomas Vigouroux2022-09-07
| | | | | | feat(treesitter): use weak tables when possible Also add the defaulttable function to create a table whose values are created when a key is missing.
* fix(ts): do not clobber spelloptions (#20095)Lewis Russell2022-09-06
|
* feat(extmarks,ts,spell): full support for spellingThomas Vigouroux2022-09-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added 'spell' option to extmarks: Extmarks with this set will have the region spellchecked. - Added 'noplainbuffer' option to 'spelloptions': This is used to tell Neovim not to spellcheck the buffer. The old behaviour was to spell check the whole buffer unless :syntax was set. - Added spelling support to the treesitter highlighter: @spell captures in highlights.scm are used to define regions which should be spell checked. - Added support for navigating spell errors for extmarks: Works for both ephemeral and static extmarks - Added '_on_spell_nav' callback for decoration providers: Since ephemeral callbacks are only drawn for the visible screen, providers must implement this callback to instruct Neovim which regions in the buffer need can be spell checked. The callback takes a start position and an end position. Note: this callback is subject to change hence the _ prefix. - Added spell captures for built-in support languages Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
* feat(treesitter)!: use @foo.bar style highlight groupsbfredl2022-08-26
| | | | | | | | | | | | This removes the support for defining links via vim.treesitter.highlighter.hl_map (never documented, but plugins did anyway), or the uppercase-only `@FooGroup.Bar` to `FooGroup` rule. The fallback is now strictly `@foo.bar.lang` to `@foo.bar` to `@foo`, and casing is irrelevant (as it already was outside of treesitter) For compatibility, define default links to builting syntax groups as defined by pre-existing color schemes
* feat(treesitter): clarify similar 'get_node_range' functionsQuentin Rasmont2022-08-25
| | | | | | | | | 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.
* feat(treesitter): add ability to retreive a tree/node given a rangeQuentin Rasmont2022-08-25
|
* feat(treesitter): add opts.concat to query.get_text_nodeQuentin Rasmont2022-08-25
| | | | | | | As part of the upstream of utility functions from nvim-treesitter, this option when set to false allows to return a table (downstream behavior). Effectively making the switch from the downstream to the upstream function much easier.
* feat(treesitter): allow customizing language symbol nameThomas Vigouroux2022-08-22
|
* 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
* refactor(lua): replace vim.cmd use with API calls (#19283)Raphael2022-07-09
| | | Signed-off-by: Raphael <glephunter@gmail.com>
* refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason2022-07-07
| | | | * reformat Lua runtime to make lint CI pass * reduce max line length to 100
* fix(treesitter): new iter if foldedkevinhwang912022-06-16
|
* fix(treesitter): correct region for string parser (#18794)Christian Clason2022-06-02
| | | fixes injections for string parsers after https://github.com/neovim/neovim/commit/eab4d03a3264b2afaf803ed839fa25bc4e7acedd