mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(treesitter): incorrect method name call
This commit is contained in:
parent
0c8d6ab536
commit
2985c17867
@ -445,7 +445,7 @@ end
|
||||
function LanguageTree:language_for_range(range)
|
||||
for _, child in pairs(self._children) do
|
||||
if child:contains(range) then
|
||||
return child:node_for_range(range)
|
||||
return child:language_for_range(range)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -919,4 +919,25 @@ local hl_query = [[
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("when getting the language for a range", function()
|
||||
before_each(function()
|
||||
insert([[
|
||||
int x = INT_MAX;
|
||||
#define VALUE 123456789
|
||||
]])
|
||||
end)
|
||||
|
||||
it("should return the correct language tree", function()
|
||||
local result = exec_lua([[
|
||||
parser = vim.treesitter.get_parser(0, "c", {
|
||||
queries = { c = "(preproc_def (preproc_arg) @c)"}})
|
||||
|
||||
local sub_tree = parser:language_for_range({1, 18, 1, 19})
|
||||
|
||||
return sub_tree == parser:children().c
|
||||
]])
|
||||
|
||||
eq(result, true)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user