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,
|
workspaceSymbolProvider = true,
|
||||||
documentFormattingProvider = true,
|
documentFormattingProvider = true,
|
||||||
documentRangeFormattingProvider = false,
|
documentRangeFormattingProvider = false,
|
||||||
|
executeCommandProvider = {
|
||||||
|
commands = { "SCLRescanWorkspaceTypes" },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function uri_to_path(uri)
|
local function uri_to_path(uri)
|
||||||
@@ -1812,6 +1815,16 @@ function handlers.textDocument_formatting(params)
|
|||||||
return formatter.format_document(doc.content, format_options)
|
return formatter.format_document(doc.content, format_options)
|
||||||
end
|
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)
|
local function handle_message(message)
|
||||||
if message.method == "$/cancelRequest" then
|
if message.method == "$/cancelRequest" then
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
+1
-1
@@ -127,7 +127,7 @@ local function parse_scl_type_file(content)
|
|||||||
fb_inouts = {}
|
fb_inouts = {}
|
||||||
current_fb_section = nil
|
current_fb_section = nil
|
||||||
elseif in_fb and trimmed:match("^END_FUNCTION_BLOCK") then
|
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] = {
|
types[fb_name] = {
|
||||||
name = fb_name,
|
name = fb_name,
|
||||||
kind = "function_block",
|
kind = "function_block",
|
||||||
|
|||||||
Reference in New Issue
Block a user