feat(lsp): add goto declaration for FB, DB, and UDT types
- Add declaration provider (gD) that finds definitions for: - Functions in .scl files - Function Blocks (FB) in .scl files - Data Blocks (DB) in .scl and .db files - User-Defined Types (UDT) in .scl and .udt files - Implement project root detection for cross-directory searches - Add duplicate location filtering to prevent multiple results - Load UDT types from .udt files in plc_json - Update documentation with goto declaration feature
This commit is contained in:
@@ -198,6 +198,21 @@ function M.load_types_from_workspace(root_dir)
|
||||
end
|
||||
end
|
||||
|
||||
-- Also scan for .udt files
|
||||
local udt_files = scan_files_recursive(root_dir, "*.udt")
|
||||
for _, filepath in ipairs(udt_files) do
|
||||
local content = run_command("cat " .. filepath:gsub(" ", "\\ "))
|
||||
if content then
|
||||
local udt_types = parse_scl_type_file(content)
|
||||
for name, typ in pairs(udt_types) do
|
||||
typ.source = "udt_file"
|
||||
if not types[name] then
|
||||
types[name] = typ
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return types
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user