aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/treesitter.lua')
-rw-r--r--runtime/lua/vim/treesitter.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index e36aacfd94..4629203138 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -342,6 +342,9 @@ end
---
--- Ignore injected languages (default true)
--- @field ignore_injections boolean?
+---
+--- Include anonymous nodes (default false)
+--- @field include_anonymous boolean?
--- Returns the smallest named node at the given position
---
@@ -388,6 +391,9 @@ function M.get_node(opts)
return
end
+ if opts.include_anonymous then
+ return root_lang_tree:node_for_range(ts_range, opts)
+ end
return root_lang_tree:named_node_for_range(ts_range, opts)
end