bugfix: crashing treesitter

I don't know much about this treesitter node stuff, but it was
attempting to call range, which happened to be a nil value, crashing
treesitter. Check that range is not a nil value of node on callsite and
did early return to resolve the issue
This commit is contained in:
Ivar Fatland
2026-04-18 16:15:27 +02:00
parent c5de994706
commit d24946e94b
@@ -140,6 +140,9 @@ query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred
end end
local injection_alias = vim.treesitter.get_node_text(node, bufnr):lower() local injection_alias = vim.treesitter.get_node_text(node, bufnr):lower()
metadata["injection.language"] = get_parser_from_markdown_info_string(injection_alias) metadata["injection.language"] = get_parser_from_markdown_info_string(injection_alias)
if not node.range then
return -- TODO: What is goin on here???
end
end, opts) end, opts)
-- Just avoid some annoying warnings for this directive -- Just avoid some annoying warnings for this directive