fix: register FBs with only VAR/TEMP as types + add SCLRescanWorkspaceTypes command
This commit is contained in:
@@ -71,6 +71,9 @@ local capabilities = {
|
||||
workspaceSymbolProvider = true,
|
||||
documentFormattingProvider = true,
|
||||
documentRangeFormattingProvider = false,
|
||||
executeCommandProvider = {
|
||||
commands = { "SCLRescanWorkspaceTypes" },
|
||||
},
|
||||
}
|
||||
|
||||
local function uri_to_path(uri)
|
||||
@@ -1812,6 +1815,16 @@ function handlers.textDocument_formatting(params)
|
||||
return formatter.format_document(doc.content, format_options)
|
||||
end
|
||||
|
||||
function handlers.workspace_executeCommand(params)
|
||||
if params.command ~= "SCLRescanWorkspaceTypes" then
|
||||
return nil
|
||||
end
|
||||
|
||||
plc_json.clear_cache()
|
||||
|
||||
return {}
|
||||
end
|
||||
|
||||
local function handle_message(message)
|
||||
if message.method == "$/cancelRequest" then
|
||||
return nil
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ local function parse_scl_type_file(content)
|
||||
fb_inouts = {}
|
||||
current_fb_section = nil
|
||||
elseif in_fb and trimmed:match("^END_FUNCTION_BLOCK") then
|
||||
if fb_name and (#fb_inputs > 0 or #fb_outputs > 0 or #fb_inouts > 0) then
|
||||
if fb_name then
|
||||
types[fb_name] = {
|
||||
name = fb_name,
|
||||
kind = "function_block",
|
||||
|
||||
Reference in New Issue
Block a user