diff --git a/package.json b/package.json index dba3843c..8b632d59 100644 --- a/package.json +++ b/package.json @@ -19,430 +19,328 @@ "npm": ">=8.0.0", "vscode": "^1.54.0" }, - "categories": [ - "Programming Languages" - ], - "keywords": [ - "vRealize", - "vRO", - "vRA" - ], - "activationEvents": [ - "onLanguage:javascript", - "onLanguage:typescript", - "workspaceContains:.o11n/", - "onView:vrdev.views.explorer", - "onCommand:vrdev.new.project", - "onCommand:vrdev.change.profile", - "onCommand:vrdev.open.action", - "onCommand:vrdev.open.workflow", - "onCommand:vrdev.open.config", - "onCommand:vrdev.open.resource", - "onCommand:vrdev.run.action", - "onCommand:vrdev.toggle.typescript", - "onCommand:vrdev.vra.auth.configure", - "onCommand:vrdev.blueprint.create", - "onCommand:vrdev.blueprint.fetch", - "onCommand:vrdev.blueprint.upload", - "onCommand:vrdev.blueprint.deploy" - ], - "main": "./extension/out/extension", + "categories": ["Programming Languages"], + "keywords": ["vRealize", "vRO", "vRA"], + "activationEvents": ["onLanguage:javascript", "onLanguage:typescript", "workspaceContains:.o11n/", "onView:vrdev.views.explorer", "onCommand:vrdev.new.project", "onCommand:vrdev.change.profile", "onCommand:vrdev.open.action", "onCommand:vrdev.open.workflow", "onCommand:vrdev.open.config", "onCommand:vrdev.open.resource", "onCommand:vrdev.run.action", "onCommand:vrdev.toggle.typescript", "onCommand:vrdev.vra.auth.configure", "onCommand:vrdev.blueprint.create", "onCommand:vrdev.blueprint.fetch", "onCommand:vrdev.blueprint.upload", "onCommand:vrdev.blueprint.deploy"], + "main": "./extension/dist/extension", "icon": "assets/logo.png", "contributes": { "viewsContainers": { - "activitybar": [ - { - "id": "vro-explorer", - "title": "vRealize Developer Tools", - "icon": "assets/icons/explorer.svg" - } - ] + "activitybar": [{ + "id": "vro-explorer", + "title": "vRealize Developer Tools", + "icon": "assets/icons/explorer.svg" + }] }, "views": { - "vro-explorer": [ - { - "id": "vrdev.views.explorer", - "name": "Explorer" - }, - { - "id": "vrdev.views.properties", - "name": "Properties" - } - ] + "vro-explorer": [{ + "id": "vrdev.views.explorer", + "name": "Explorer" + }, { + "id": "vrdev.views.properties", + "name": "Properties" + }] }, - "viewsWelcome": [ - { - "view": "vrdev.views.explorer", - "contents": "Connect to vRealize Orchetsrator by selecting a maven profile.\n\n[Select Profile](command:vrdev.change.profile)" - }, - { - "view": "vrdev.views.properties", - "contents": "Select a node in the Explorer to view its properties." + "viewsWelcome": [{ + "view": "vrdev.views.explorer", + "contents": "Connect to vRealize Orchetsrator by selecting a maven profile.\n\n[Select Profile](command:vrdev.change.profile)" + }, { + "view": "vrdev.views.properties", + "contents": "Select a node in the Explorer to view its properties." + }], + "commands": [{ + "command": "vrdev.views.explorer.refresh", + "title": "Refresh", + "category": "vRealize", + "icon": { + "light": "assets/icons/light/refresh.svg", + "dark": "assets/icons/dark/refresh.svg" + } + }, { + "command": "vrdev.views.explorer.revealItem", + "title": "Reveal Item in Explorer", + "category": "vRealize" + }, { + "command": "vrdev.views.properties.show", + "title": "Show Properties", + "category": "vRealize" + }, { + "command": "vrdev.views.properties.copy", + "title": "Copy Value", + "category": "vRealize", + "icon": { + "light": "assets/icons/light/clipboard.svg", + "dark": "assets/icons/dark/clipboard.svg" + } + }, { + "command": "vrdev.views.properties.locateItem", + "title": "Locate Item in Explorer", + "category": "vRealize", + "icon": { + "light": "assets/icons/light/location.svg", + "dark": "assets/icons/dark/location.svg" + } + }, { + "command": "vrdev.fetchRemoteElement", + "title": "Fetch from Remote", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/link-external.svg", + "light": "assets/icons/light/link-external.svg" + } + }, { + "command": "vrdev.workflow.fetchSchema", + "title": "Open Workflow Schema", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/circuit-board.svg", + "light": "assets/icons/light/circuit-board.svg" + } + }, { + "command": "vrdev.package.delete", + "title": "Delete", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/trash.svg", + "light": "assets/icons/light/trash.svg" + } + }, { + "command": "vrdev.change.profile", + "title": "Change Active Profile", + "category": "vRealize" + }, { + "command": "vrdev.open.action", + "title": "Open vRO Action", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/search.svg", + "light": "assets/icons/light/search.svg" + } + }, { + "command": "vrdev.open.workflow", + "title": "Open vRO Workflow", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/search.svg", + "light": "assets/icons/light/search.svg" + } + }, { + "command": "vrdev.open.config", + "title": "Open vRO Configuration", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/search.svg", + "light": "assets/icons/light/search.svg" + } + }, { + "command": "vrdev.open.resource", + "title": "Open vRO Resource", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/search.svg", + "light": "assets/icons/light/search.svg" } - ], - "commands": [ - { + }, { + "command": "vrdev.new.project", + "title": "New Project", + "category": "vRealize" + }, { + "command": "vrdev.run.action", + "title": "Run vRO Action", + "category": "vRealize", + "icon": { + "light": "assets/icons/light/zap.svg", + "dark": "assets/icons/dark/zap.svg" + } + }, { + "command": "vrdev.toggle.typescript", + "title": "Toggle TypeScript Support (Experimental)", + "category": "vRealize" + }, { + "command": "vrdev.vra.auth.configure", + "title": "Configure vRA Authentication", + "category": "vRealize" + }, { + "command": "vrdev.blueprint.create", + "title": "Create vRA Blueprint", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/circuit-board.svg", + "light": "assets/icons/light/circuit-board.svg" + } + }, { + "command": "vrdev.blueprint.upload", + "title": "Upload vRA Blueprint", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/circuit-board.svg", + "light": "assets/icons/light/circuit-board.svg" + } + }, { + "command": "vrdev.blueprint.fetch", + "title": "Fetch vRA Blueprint", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/circuit-board.svg", + "light": "assets/icons/light/circuit-board.svg" + } + }, { + "command": "vrdev.blueprint.deploy", + "title": "Deploy vRA Blueprint", + "category": "vRealize", + "icon": { + "dark": "assets/icons/dark/circuit-board.svg", + "light": "assets/icons/light/circuit-board.svg" + } + }], + "menus": { + "view/title": [{ + "when": "view =~ /^vrdev\\.views\\.explorer/", "command": "vrdev.views.explorer.refresh", - "title": "Refresh", - "category": "vRealize", - "icon": { - "light": "assets/icons/light/refresh.svg", - "dark": "assets/icons/dark/refresh.svg" - } - }, - { - "command": "vrdev.views.explorer.revealItem", - "title": "Reveal Item in Explorer", - "category": "vRealize" - }, - { - "command": "vrdev.views.properties.show", - "title": "Show Properties", - "category": "vRealize" - }, - { - "command": "vrdev.views.properties.copy", - "title": "Copy Value", - "category": "vRealize", - "icon": { - "light": "assets/icons/light/clipboard.svg", - "dark": "assets/icons/dark/clipboard.svg" - } - }, - { + "group": "navigation@1" + }, { + "when": "!vrdev:properties:empty && view =~ /^vrdev\\.views\\.properties/", "command": "vrdev.views.properties.locateItem", - "title": "Locate Item in Explorer", - "category": "vRealize", - "icon": { - "light": "assets/icons/light/location.svg", - "dark": "assets/icons/dark/location.svg" - } - }, - { + "group": "navigation@1" + }], + "view/item/context": [{ "command": "vrdev.fetchRemoteElement", - "title": "Fetch from Remote", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/link-external.svg", - "light": "assets/icons/light/link-external.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:(action|workflow|config|resource)\\b/", + "group": "inline@98" + }, { + "command": "vrdev.fetchRemoteElement", + "when": "viewItem =~ /vrdev:element:kind:(action|workflow|config|resource)\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.workflow.fetchSchema", - "title": "Open Workflow Schema", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/circuit-board.svg", - "light": "assets/icons/light/circuit-board.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:workflow\\b/", + "group": "inline@95" + }, { + "command": "vrdev.workflow.fetchSchema", + "when": "viewItem =~ /vrdev:element:kind:workflow\\b/", + "group": "1_vrdevs@2" + }, { "command": "vrdev.package.delete", - "title": "Delete", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/trash.svg", - "light": "assets/icons/light/trash.svg" - } - }, - { - "command": "vrdev.change.profile", - "title": "Change Active Profile", - "category": "vRealize" - }, - { + "when": "viewItem =~ /vrdev:element:kind:package\\b/", + "group": "inline@95" + }, { + "command": "vrdev.package.delete", + "when": "viewItem =~ /vrdev:element:kind:package\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.open.action", - "title": "Open vRO Action", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/search.svg", - "light": "assets/icons/light/search.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:actions\\b/", + "group": "inline@95" + }, { + "command": "vrdev.open.action", + "when": "viewItem =~ /vrdev:element:kind:actions\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.open.workflow", - "title": "Open vRO Workflow", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/search.svg", - "light": "assets/icons/light/search.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:workflows\\b/", + "group": "inline@95" + }, { + "command": "vrdev.open.workflow", + "when": "viewItem =~ /vrdev:element:kind:workflows\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.open.config", - "title": "Open vRO Configuration", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/search.svg", - "light": "assets/icons/light/search.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:configs\\b/", + "group": "inline@95" + }, { + "command": "vrdev.open.config", + "when": "viewItem =~ /vrdev:element:kind:configs\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.open.resource", - "title": "Open vRO Resource", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/search.svg", - "light": "assets/icons/light/search.svg" - } - }, - { - "command": "vrdev.new.project", - "title": "New Project", - "category": "vRealize" - }, - { - "command": "vrdev.run.action", - "title": "Run vRO Action", - "category": "vRealize", - "icon": { - "light": "assets/icons/light/zap.svg", - "dark": "assets/icons/dark/zap.svg" - } - }, - { - "command": "vrdev.toggle.typescript", - "title": "Toggle TypeScript Support (Experimental)", - "category": "vRealize" - }, - { - "command": "vrdev.vra.auth.configure", - "title": "Configure vRA Authentication", - "category": "vRealize" - }, - { + "when": "viewItem =~ /vrdev:element:kind:resources\\b/", + "group": "inline@95" + }, { + "command": "vrdev.open.resource", + "when": "viewItem =~ /vrdev:element:kind:resources\\b/", + "group": "1_vrdevs@1" + }, { + "command": "vrdev.views.properties.copy", + "when": "viewItem =~ /vrdev:element:kind:property\\b(?!.*?\\+multi\\b)\\b/", + "group": "inline@95" + }, { + "command": "vrdev.views.properties.copy", + "when": "viewItem =~ /vrdev:element:kind:property\\b(?!.*?\\+multi\\b)\\b/", + "group": "1_vrdevs@1" + }, { "command": "vrdev.blueprint.create", - "title": "Create vRA Blueprint", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/circuit-board.svg", - "light": "assets/icons/light/circuit-board.svg" - } - }, - { + "when": "viewItem =~ /vrdev:element:kind:blueprint\\b/", + "group": "inline@95" + }, { + "command": "vrdev.blueprint.create", + "when": "viewItem =~ /vrdev:element:kind:blueprint\\b/", + "group": "1_vrdevs@1" + }], + "editor/title": [{ + "when": "resourceLangId == javascript || resourceLangId == typescript", + "command": "vrdev.run.action", + "group": "navigation" + }, { + "when": "resourceLangId == yaml", "command": "vrdev.blueprint.upload", - "title": "Upload vRA Blueprint", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/circuit-board.svg", - "light": "assets/icons/light/circuit-board.svg" - } - }, - { - "command": "vrdev.blueprint.fetch", - "title": "Fetch vRA Blueprint", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/circuit-board.svg", - "light": "assets/icons/light/circuit-board.svg" - } - }, - { + "group": "navigation" + }, { + "when": "resourceLangId == yaml", "command": "vrdev.blueprint.deploy", - "title": "Deploy vRA Blueprint", - "category": "vRealize", - "icon": { - "dark": "assets/icons/dark/circuit-board.svg", - "light": "assets/icons/light/circuit-board.svg" - } - } - ], - "menus": { - "view/title": [ - { - "when": "view =~ /^vrdev\\.views\\.explorer/", - "command": "vrdev.views.explorer.refresh", - "group": "navigation@1" - }, - { - "when": "!vrdev:properties:empty && view =~ /^vrdev\\.views\\.properties/", - "command": "vrdev.views.properties.locateItem", - "group": "navigation@1" - } - ], - "view/item/context": [ - { - "command": "vrdev.fetchRemoteElement", - "when": "viewItem =~ /vrdev:element:kind:(action|workflow|config|resource)\\b/", - "group": "inline@98" - }, - { - "command": "vrdev.fetchRemoteElement", - "when": "viewItem =~ /vrdev:element:kind:(action|workflow|config|resource)\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.workflow.fetchSchema", - "when": "viewItem =~ /vrdev:element:kind:workflow\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.workflow.fetchSchema", - "when": "viewItem =~ /vrdev:element:kind:workflow\\b/", - "group": "1_vrdevs@2" - }, - { - "command": "vrdev.package.delete", - "when": "viewItem =~ /vrdev:element:kind:package\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.package.delete", - "when": "viewItem =~ /vrdev:element:kind:package\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.open.action", - "when": "viewItem =~ /vrdev:element:kind:actions\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.open.action", - "when": "viewItem =~ /vrdev:element:kind:actions\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.open.workflow", - "when": "viewItem =~ /vrdev:element:kind:workflows\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.open.workflow", - "when": "viewItem =~ /vrdev:element:kind:workflows\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.open.config", - "when": "viewItem =~ /vrdev:element:kind:configs\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.open.config", - "when": "viewItem =~ /vrdev:element:kind:configs\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.open.resource", - "when": "viewItem =~ /vrdev:element:kind:resources\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.open.resource", - "when": "viewItem =~ /vrdev:element:kind:resources\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.views.properties.copy", - "when": "viewItem =~ /vrdev:element:kind:property\\b(?!.*?\\+multi\\b)\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.views.properties.copy", - "when": "viewItem =~ /vrdev:element:kind:property\\b(?!.*?\\+multi\\b)\\b/", - "group": "1_vrdevs@1" - }, - { - "command": "vrdev.blueprint.create", - "when": "viewItem =~ /vrdev:element:kind:blueprint\\b/", - "group": "inline@95" - }, - { - "command": "vrdev.blueprint.create", - "when": "viewItem =~ /vrdev:element:kind:blueprint\\b/", - "group": "1_vrdevs@1" - } - ], - "editor/title": [ - { - "when": "resourceLangId == javascript || resourceLangId == typescript", - "command": "vrdev.run.action", - "group": "navigation" - }, - { - "when": "resourceLangId == yaml", - "command": "vrdev.blueprint.upload", - "group": "navigation" - }, - { - "when": "resourceLangId == yaml", - "command": "vrdev.blueprint.deploy", - "group": "navigation" - } - ], - "commandPalette": [ - { - "command": "vrdev.fetchRemoteElement", - "when": "false" - }, - { - "command": "vrdev.workflow.fetchSchema", - "when": "false" - }, - { - "command": "vrdev.package.delete", - "when": "false" - }, - { - "command": "vrdev.views.properties.show", - "when": "false" - }, - { - "command": "vrdev.views.properties.copy", - "when": "false" - }, - { - "command": "vrdev.views.properties.locateItem", - "when": "false" - }, - { - "command": "vrdev.views.explorer.revealItem", - "when": "false" - }, - { - "command": "vrdev.views.explorer.refresh", - "when": "false" - } - ] + "group": "navigation" + }], + "commandPalette": [{ + "command": "vrdev.fetchRemoteElement", + "when": "false" + }, { + "command": "vrdev.workflow.fetchSchema", + "when": "false" + }, { + "command": "vrdev.package.delete", + "when": "false" + }, { + "command": "vrdev.views.properties.show", + "when": "false" + }, { + "command": "vrdev.views.properties.copy", + "when": "false" + }, { + "command": "vrdev.views.properties.locateItem", + "when": "false" + }, { + "command": "vrdev.views.explorer.revealItem", + "when": "false" + }, { + "command": "vrdev.views.explorer.refresh", + "when": "false" + }] }, - "taskDefinitions": [ - { - "type": "vRealize", - "required": [ - "label", - "command" - ], - "properties": { - "label": { - "type": "string" - }, - "command": { - "type": "string", - "description": "The command to execute" - } + "taskDefinitions": [{ + "type": "vRealize", + "required": ["label", "command"], + "properties": { + "label": { + "type": "string" + }, + "command": { + "type": "string", + "description": "The command to execute" } } - ], + }], "configuration": { "type": "object", "title": "vRealize Developer Tools", "properties": { "vrdev.log": { "type": "string", - "enum": [ - "off", - "info", - "debug" - ], + "enum": ["off", "info", "debug"], "default": "info", "description": "Enables logging of the vRealize Developer Tools to the OUTPUT panel. This log can be used to diagnose vRealize Developer Tools issues. The log may contain file paths, source code, and other potentially sensitive information from your project." }, "vrdev.trace": { "type": "string", - "enum": [ - "off", - "messages", - "verbose" - ], + "enum": ["off", "messages", "verbose"], "default": "off", "description": "Enables tracing of messages exchanged between the vRealize Developer Tools extension and the vRO language server. This trace can be used to diagnose extension issues. The trace may contain file paths, source code, and other potentially sensitive information from your project." }, @@ -481,10 +379,7 @@ }, "vrdev.vra.auth.type": { "type": "string", - "enum": [ - "refresh_token", - "password" - ], + "enum": ["refresh_token", "password"], "description": "Method for authetication towards vRealize Automation 8", "scope": "window" }, @@ -509,16 +404,8 @@ "vrdev.views.explorer.actions.layout": { "type": "string", "default": "compact", - "enum": [ - "tree", - "compact", - "flat" - ], - "enumDescriptions": [ - "Displays action packages as a tree", - "Displays action packages as a tree, but flattens any folders that have no children", - "Displays action packages as a list" - ], + "enum": ["tree", "compact", "flat"], + "enumDescriptions": ["Displays action packages as a tree", "Displays action packages as a tree, but flattens any folders that have no children", "Displays action packages as a list"], "markdownDescription": "Specifies how the _Explorer_ view will display vRO action packages", "scope": "window" }, @@ -530,16 +417,13 @@ } } }, - "snippets": [ - { - "language": "javascript", - "path": "./extension/snippets/vro.json" - }, - { - "language": "yaml", - "path": "./extension/snippets/vra-blueprint.json" - } - ] + "snippets": [{ + "language": "javascript", + "path": "./extension/snippets/vro.json" + }, { + "language": "yaml", + "path": "./extension/snippets/vra-blueprint.json" + }] }, "devDependencies": { "@types/adm-zip": "^0.4.33", @@ -619,11 +503,9 @@ "glob-stream": "^7.0.0", "ansi-regex": "^5.0.1" }, - "workspaces": [ - "packages/node/*" - ], + "workspaces": ["packages/node/*"], "scripts": { "preinstall": "node build/preinstall.js", "vscode:prepublish": "webpack --mode production --config ./extension/webpack.config.js && webpack --mode production --config ./packages/node/vro-language-server/webpack.config.js" } -} +} \ No newline at end of file diff --git a/packages/node/vro-language-server/src/server/core/HintLookup.ts b/packages/node/vro-language-server/src/server/core/HintLookup.ts index 03865524..24a59648 100644 --- a/packages/node/vro-language-server/src/server/core/HintLookup.ts +++ b/packages/node/vro-language-server/src/server/core/HintLookup.ts @@ -100,7 +100,7 @@ export class HintLookup implements Disposable { const module = this.getActionModules(workspaceFolder).find(module => module.name === moduleName) this.logger.debug(`Module hint: ${JSON.stringify(module, null, 4)}`) - if (module && module.actions) { + if (module?.actions) { return module.actions.filter(action => !!action) } @@ -122,7 +122,7 @@ export class HintLookup implements Disposable { getConfigElementsIn(categoryPath: string, workspaceFolder?: WorkspaceFolder): vmw.pscoe.hints.IConfig[] { const module = this.getConfigCategories(workspaceFolder).find(category => category.path === categoryPath) - if (module && module.configurations) { + if (module?.configurations) { return module.configurations.filter(config => !!config) } @@ -139,9 +139,7 @@ export class HintLookup implements Disposable { for (const api of this.scriptingApi.global) { for (const cls of api.classes) { const hasConstructors = !!cls.constructors && cls.constructors.length > 0 - if (filter.isInstantiable === undefined) { - result.push(cls) - } else if (hasConstructors === filter.isInstantiable) { + if (filter.isInstantiable === undefined || hasConstructors === filter.isInstantiable) { result.push(cls) } } diff --git a/packages/node/vro-language-server/src/server/request/collection/ServerCollection.ts b/packages/node/vro-language-server/src/server/request/collection/ServerCollection.ts index ba6fc60a..84285e3b 100644 --- a/packages/node/vro-language-server/src/server/request/collection/ServerCollection.ts +++ b/packages/node/vro-language-server/src/server/request/collection/ServerCollection.ts @@ -134,6 +134,7 @@ export class ServerCollection { collectObjects() { this.getVroObjects() .then(objects => { + // todo merge both in same actions.pb file this.hints.collectVroObjects(objects) }) .catch(error => { @@ -173,6 +174,7 @@ export class ServerCollection { const pluginDetails = await this.restClient.getPluginDetails(parsedLink) for (const pluginObject of pluginDetails["objects"]) { + // enrich the object with vRO plugin object properties const object: vmw.pscoe.hints.IClass = { name: pluginObject["name"], description: pluginObject["description"], diff --git a/packages/node/vro-language-server/src/server/request/collection/WorkspaceCollection.ts b/packages/node/vro-language-server/src/server/request/collection/WorkspaceCollection.ts index 28ac4459..dcb53828 100644 --- a/packages/node/vro-language-server/src/server/request/collection/WorkspaceCollection.ts +++ b/packages/node/vro-language-server/src/server/request/collection/WorkspaceCollection.ts @@ -89,7 +89,7 @@ export class WorkspaceCollection { const payload = this.collectLocalData(modulesPath) this.generateActionsPbFiles(payload, outputDir, workspaceFolder) } catch (error) { - this.logger.warn(`Error occurred: ${JSON.stringify(error)}`) + this.logger.warn(`Error occurred: ${error}`) } this.logger.info("Workspace hint collection has finished") } @@ -104,22 +104,23 @@ export class WorkspaceCollection { fs.writeFileSync(actionPackProtoFile, ActionsPackProto) protobuf.load(actionPackProtoFile, function (err, root) { - if (err) throw err - if (!root) throw new Error("Root namespace not loaded") - + if (err) { + throw err + } + if (!root) { + throw new Error("Root namespace not loaded") + } // Obtain a message type const ActionsPack = root.lookupType("vmw.pscoe.hints.ActionsPack") - // Verify the payload (i.e. incomplete or invalid) const errMsg = ActionsPack.verify(payload) - if (errMsg) throw Error(errMsg) - + if (errMsg) { + throw Error(errMsg) + } // Create a new message const message = ActionsPack.create(payload) - // Encode a message to a Buffer const buffer = ActionsPack.encode(message).finish() - fs.writeFileSync(outputFile, buffer) }) } @@ -155,7 +156,7 @@ export class WorkspaceCollection { parameters.push(actionParams) } if (tag.tag === "return") { - returnType = tag.type + returnType = tag?.type } }) @@ -182,7 +183,7 @@ export class WorkspaceCollection { modules.forEach(module => { actions.forEach(action => { - if (action.moduleName === module.name) { + if (action?.moduleName === module?.name) { module.actions.push(action) } })