File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11local ts_get_node_text = vim .treesitter .get_node_text or vim .treesitter .query .get_node_text
22local M = {}
33
4+ local flatten = (function ()
5+ if vim .fn .has " nvim-0.11" == 1 then
6+ return function (t )
7+ return vim .iter (t ):flatten ():totable ()
8+ end
9+ else
10+ return function (t )
11+ return vim .tbl_flatten (t )
12+ end
13+ end
14+ end )()
15+
16+
417--- Returns the language tree at the given position.
518--- @return LanguageTree
619function M .get_language_tree_at_position (position )
720 local language_tree = vim .treesitter .get_parser ()
821 language_tree :for_each_tree (function (_ , tree )
9- if tree :contains (vim . tbl_flatten ({ position , position })) then
22+ if tree :contains (flatten ({ position , position })) then
1023 language_tree = tree
1124 end
1225 end )
You can’t perform that action at this time.
0 commit comments