aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter.lua
Commit message (Collapse)AuthorAge
* docs(treesitter): add disclaimer about needing to parse before `get_node()`L Lllvvuu2023-11-04
| | | | | | | | | | | Problem: --- Misuse of `get_node()` is common: https://github.com/search?q=get_node_at_cursor+language%3Alua&type=code Solution: --- Add a note clarifying proper usage.
* feat(treesitter): add foldtext with treesitter highlighting (#25391)Till Bungert2023-10-01
|
* docs: fix type warningsMaria José Solano2023-09-23
|
* refactor(treesitter): rename "preview" => "edit" #25161Maria José Solano2023-09-15
| | | | | | "Edit" more closely describes the generic application than "Preview", though the buffer contents don't (yet) map to an actual file on disk. https://github.com/neovim/neovim/pull/24703#discussion_r1321719133
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* feat(treesitter): add a query editor (#24703)Maria José Solano2023-08-25
|
* fix(treesitter): stop() should treat 0 as current buffer #24450Micah Halter2023-07-24
|
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* refactor!: rename "playground" => "dev" #23919Justin M. Keyes2023-06-06
| | | | | | | | | | | | Problem: "playground" is new jargon that overlaps with existing concepts: "dev" (`:help dev`) and "view" (also "scratch" `:help scratch-buffer`) . Solution: We should consistently use "dev" as the namespace for where "developer tools" live. For purposes of a "throwaway sandbox object", we can use the name "view". - Rename `TSPlayground` => `TSView` - Rename `playground.lua` => `dev.lua`
* fix(treesitter): allow foldexpr without highlights (#23672)Lewis Russell2023-05-18
| | | Ref nvim-treesitter/nvim-treesitter#4748
* refactor: rename local API alias from a to apiLewis Russell2023-04-05
| | | | | | | | Problem: Codebase inconsistently binds vim.api onto a or api. Solution: Use api everywhere. a as an identifier is too short to have at the module level.
* refactor(treesitter): move inspect_tree implLewis Russell2023-04-04
|
* fix(treesitter): disable folding in inspect_tree() (#22885)Lewis Russell2023-04-04
|
* feat: add `vim.treesitter.language.get_filetypes()` (#22643)Lewis Russell2023-03-30
|
* feat(treesitter)!: deprecate top level indexes to modules (#22761)Lewis Russell2023-03-24
| | | | | | | | | | | | | | | | | The following top level Treesitter functions have been moved: - vim.treesitter.inspect_language() -> vim.treesitter.language.inspect() - vim.treesitter.get_query_files() -> vim.treesitter.query.get_files() - vim.treesitter.set_query() -> vim.treesitter.query.set() - vim.treesitter.query.set_query() -> vim.treesitter.query.set() - vim.treesitter.get_query() -> vim.treesitter.query.get() - vim.treesitter.query.get_query() -> vim.treesitter.query.get() - vim.treesitter.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.query.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.add_predicate() -> vim.treesitter.query.add_predicate() - vim.treesitter.add_directive() -> vim.treesitter.query.add_directive() - vim.treesitter.list_predicates() -> vim.treesitter.query.list_predicates() - vim.treesitter.list_directives() -> vim.treesitter.query.list_directives() - vim.treesitter.query.get_range() -> vim.treesitter.get_range() - vim.treesitter.query.get_node_text() -> vim.treesitter.get_node_text()
* fix(treesitter): annotationsLewis Russell2023-03-23
| | | | | | - Begin using `@package` in place of `@private` for functions that are accessed internally but outside their defined class. - Rename Node -> TSP.Node
* fix(treesitter): InspectTree does not respect 'splitright' #22692Yochem van Rosmalen2023-03-17
| | | | | | | | | | Problem: vim.treesitter.inspect_tree() and :InspectTree does not respect 'splitright'. Solution: - Change the default `command` from `topleft 60vnew` to `60vnew`. - Change :InspectTree to respect command mods (`:vertical`, count, etc.). Closes #22656
* refactor(treesitter)!: remove deprecated show_tree funcnullchilly2023-03-11
|
* fix(treesitter): better lang handling of get_parser()Lewis Russell2023-03-10
|
* fix(treesitter): is_in_node_range (#22582)Lewis Russell2023-03-08
| | | | TS ranges are end column exclusive, so fix is_in_node_range to account for that.
* refactor(treesitter): simplify some range functionsLewis Russell2023-03-06
|
* fix(treesitter): break early from loop when match is found (#22499)Gregory Anders2023-03-03
| | | Fixup to #22484.
* Merge pull request #22484 from gpanders/inspect-tree-fix-cursorChristian Clason2023-03-03
|\ | | | | fix(treesitter): maintain cursor position when toggling anonymous nodes
| * fix(treesitter): maintain cursor position when toggling anonymous nodesGregory Anders2023-03-02
| | | | | | | | | | | | When toggling anonymous nodes in the :InspectTree window, keep the cursor fixed relative to the node within the tree. This prevents the cursor from jumping.
* | fix(treesitter): disallow empty filetypesLewis Russell2023-03-03
|/ | | Fixes #22473
* feat(treesitter): add :InspectTree command (#22477)Christian Clason2023-03-02
|
* refactor: rename show_tree => inspect_tree #22474Justin M. Keyes2023-03-02
| | | | | | | | | | | | | | | | Problem: "show" is potentially a new verb that we can avoid (there is already "open" and "echo"). Even if we can't avoid it, the behavior of `show_tree` fits well in the "inspect" family of functions: a way for users to introspect/reflect on the state of Nvim. Existing "inspect" functions: vim.inspect() vim.inspect_pos() vim.treesitter.inspect_language() nvim__inspect_cell Solution: Rename `show_tree` to `inspect_tree`.
* feat(treesitter): upstream foldexpr from nvim-treesitterLewis Russell2023-02-23
|
* docs: fix more treesitter parsing errorsChristian Clason2023-02-23
|
* docs(treesitter): fix parse errorsChristian Clason2023-02-23
|
* refactor(treesitter): Add vim.treesitter.get_node() (#22360)Gregory Anders2023-02-22
| | | | | | | | | | | | This function replaces both vim.treesitter.get_node_at_pos() and vim.treesitter.get_node_at_cursor(). These two functions are similar enough that they don't need separate interfaces. Even worse, get_node_at_pos() returns a TSNode while get_node_at_cursor() returns a string, so the two functions behave slightly differently. vim.treesitter.get_node() combines these two into a more streamlined interface. With no arguments, it returns the node under the cursor in the current buffer. Optionally, it can accept a buffer number or a position to get the node at a given position in a given buffer.
* 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): don't trample parsers when filetype!=langLewis Russell2023-02-10
| | | | | This allows vim.treesitter.show_tree() to work on buffers where the filetype does not match the parser language name e.g, bash/sh.
* 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.
* fix(treesitter): fix most diagnosticsLewis Russell2023-02-04
|
* Merge pull request #21393 from folke/highlight_showChristian Clason2022-12-17
|\ | | | | | | feat(lsp): add function to get semantic tokens at cursor feat: `vim.inspect_pos()`, `vim.show_pos()` and `:Inspect[!]`
| * feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`Folke Lemaitre2022-12-17
| |
* | 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
|
* refactor(treesitter): rename x_position => x_posJustin M. Keyes2022-09-25
| | | | | "pos" has a long precedent as "position" in vim, and there is no reason to use a verbose name here.
* fix(treesitter): return full metadata for get_captures_at_position (#20203)Christian Clason2022-09-16
| | | | | | | | fix(treesitter): get_captures_at_position returns metadata Return the full `metadata` table for the capture instead of just the priority. Further cleanup of related docs.
* 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
* Merge pull request #20093 from neovim/upstream-ts-utilChristian Clason2022-09-08
|\ | | | | | | * feat(treesitter): upstream get_{node,captures} utility functions * refactor(treesitter): get_{nodes,captures}_at_{position,cursor}
| * refactor(treesitter): get_{nodes,captures}_at_{position,cursor}Christian Clason2022-09-06
| |
| * feat(treesitter): upstream get_node_at_cursor()Quentin Rasmont2022-09-06
| | | | | | | | Util from the nvim-treesitter project.
* | docs(treesitter): fix doxygenzeertzjq2022-09-08
| |
* | 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(treesitter): don't support legacy syntax in start()Christian Clason2022-09-06
|/