diff --git a/src/diagnostics.lua b/src/diagnostics.lua index f399a76..3b11798 100644 --- a/src/diagnostics.lua +++ b/src/diagnostics.lua @@ -144,12 +144,13 @@ function M.validate_diagnostics(content, workspace_types, root_dir) type_part = type_part:gsub("%s*$", "") type_part = type_part:gsub("^%s+", "") - local base_type = type_part:match("^([%w_]+)") + -- Handle quoted type names like "MyUDT" + local base_type = type_part:match('^"([^"]+)"') or type_part:match("^([%w_]+)") if type_part:match("%s+OF%s+") then - base_type = type_part:match(".*%s+OF%s+([%w_]+)") + base_type = type_part:match('.*%s+OF%s+"([^"]+)"') or type_part:match(".*%s+OF%s+([%w_]+)") end local upper_type = base_type and base_type:upper() or nil - if base_type and not all_types[base_type] and + if base_type and base_type ~= "" and not all_types[base_type] and upper_type ~= "BOOL" and upper_type ~= "INT" and upper_type ~= "DINT" and upper_type ~= "REAL" and upper_type ~= "LREAL" and upper_type ~= "BYTE" and upper_type ~= "WORD" and upper_type ~= "DWORD" and upper_type ~= "LWORD" and