| Commit message (Collapse) | Author | Age |
... | |
| |
|
|
|
| |
Fixup to #22484.
|
|\
| |
| | |
fix(treesitter): maintain cursor position when toggling anonymous nodes
|
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
| |
Fixes #22473
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This allows vim.treesitter.show_tree() to work on buffers where the
filetype does not match the parser language name e.g, bash/sh.
|
|
|
|
|
|
| |
- 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(lsp): add function to get semantic tokens at cursor
feat: `vim.inspect_pos()`, `vim.show_pos()` and `:Inspect[!]`
|
| | |
|
|/ |
|
|
|
|
| |
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).
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
"pos" has a long precedent as "position" in vim, and there is no reason
to use a verbose name here.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* add type annotations to code
* clean up and expand static documentation
* consistent use of tags for static and generated docs
|
|\
| |
| |
| | |
* feat(treesitter): upstream get_{node,captures} utility functions
* refactor(treesitter): get_{nodes,captures}_at_{position,cursor}
|
| | |
|
| |
| |
| |
| | |
Util from the nvim-treesitter project.
|
| | |
|
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
* 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`
|
| |
|
|
|
|
| |
Util from the nvim-treesitter project.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Util from the nvim-treesitter project.
|
|
|
|
|
| |
Util from the nvim-treesitter project.
Renamed is_parent to is_ancestor for clarity.
|
| |
|
|
|
|
| |
parser (#18149)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* doc & fixes: Generate treesitter docs
* fixup to treesitter-core
* docs(treesitter): fix docs for most functions
Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Fixes an issue that tree-sitter always attached to the current buffer,
instead of the provided buffer.
|
|
|
|
|
| |
Also adds a test that we actually subscribe to buffer events when in
CMDPREVIEW.
|