[Backport release-0.9] fix: vim.treesitter.get_node() now correctly takes opts.lang (#26382)

[Backport release-0.9] fix(treesitter): allow passing lang to get_node()
This commit is contained in:
github-actions[bot]
2023-12-04 10:03:55 +01:00
committed by GitHub
parent e7dc5dd69e
commit 8a4464cd14
3 changed files with 18 additions and 1 deletions

View File

@@ -355,6 +355,7 @@ end
--- - bufnr integer|nil Buffer number (nil or 0 for current buffer)
--- - pos table|nil 0-indexed (row, col) tuple. Defaults to cursor position in the
--- current window. Required if {bufnr} is not the current buffer
--- - lang string|nil Parser language. (default: from buffer filetype)
--- - ignore_injections boolean Ignore injected languages (default true)
---
---@return TSNode | nil Node at the given position
@@ -385,7 +386,7 @@ function M.get_node(opts)
local ts_range = { row, col, row, col }
local root_lang_tree = M.get_parser(bufnr)
local root_lang_tree = M.get_parser(bufnr, opts.lang)
if not root_lang_tree then
return
end