From 4bf9f0b64eabb2c07a896f36f455f881a48569f7 Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Sat, 21 Feb 2026 01:00:42 +0100 Subject: [PATCH] fix: handle quoted type names in diagnostics - Add pattern matching for quoted type names like "MyUDT" - Handle quoted types in ARRAY ... OF declarations - Skip empty base_type to avoid spurious warnings --- src/diagnostics.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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