TEMP: IDK

This commit is contained in:
2026-04-22 21:27:02 +02:00
parent ecd7eb1e9d
commit b341897943
@@ -127,6 +127,30 @@ query.add_directive("set-lang-from-mimetype!", function(match, _, bufnr, pred, m
end end
end, opts) end, opts)
---@param val any
---@param indentation integer?
---@return string
local function pretty_str(val, indentation)
indentation = indentation or 0
local t = type(val)
if t == "string" then
return "("..t..")"..'"'..val..'"'
end
if t == "table" then
---@type string[]
local builder = {"{\n"}
for key, value in pairs(val) do
table.insert(builder, "("..type(key)..")"..pretty_str(key, indentation+1))
table.insert(builder, ": ")
table.insert(builder, "("..type(value)..")"..pretty_str(value))
table.insert(builder, ",\n")
end
return table.concat(builder, "")
end
return tostring(val)
end
---@param match (TSNode|nil)[] ---@param match (TSNode|nil)[]
---@param _ string ---@param _ string
---@param bufnr integer ---@param bufnr integer
@@ -138,10 +162,7 @@ query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred
if not node then if not node then
return return
end end
if not node.range then local injection_alias = vim.treesitter.get_node_text(node, bufnr, {metadata=metadata}):lower()
return -- TODO: What is goin on here???
end
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)
end, opts) end, opts)