fix: skip commented lines in undefined variable diagnostic

This commit is contained in:
2026-07-23 13:13:04 +02:00
parent 3ca63d278b
commit ebdc96316a
+2
View File
@@ -147,6 +147,7 @@ function M.validate_diagnostics(content, workspace_types, root_dir)
end end
if not in_var_section then if not in_var_section then
if not (trimmed:match("^%s*//") or trimmed:match("^%s*%(%*")) then
local hash_vars = {} local hash_vars = {}
for var in line:gmatch("#[%w_]+") do for var in line:gmatch("#[%w_]+") do
local var_name = var:sub(2) local var_name = var:sub(2)
@@ -171,6 +172,7 @@ function M.validate_diagnostics(content, workspace_types, root_dir)
end end
end end
end end
end
if in_var_section and (trimmed:match("^[%w_]+%s*%b{}%s*:") or trimmed:match("^[%w_]+%s*:")) then if in_var_section and (trimmed:match("^[%w_]+%s*%b{}%s*:") or trimmed:match("^[%w_]+%s*:")) then
local var_name = trimmed:match("^([%w_]+)%s*%b{}%s*:") or trimmed:match("^([%w_]+)%s*:") local var_name = trimmed:match("^([%w_]+)%s*%b{}%s*:") or trimmed:match("^([%w_]+)%s*:")