diff --git a/packages/salesforcedx-vscode-apex/src/commands/apexActionController.ts b/packages/salesforcedx-vscode-apex/src/commands/apexActionController.ts index 1b8287f30a..444e822ce4 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/apexActionController.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/apexActionController.ts @@ -107,6 +107,23 @@ export class ApexActionController { ); } } + + // Step 8: Call Mulesoft extension if installed + if (await this.isCommandAvailable('mule-dx-api.open-api-project')) { + try { + const yamlUri = vscode.Uri.file(this.replaceXmlToYaml(fullPath[1])); + await vscode.commands.executeCommand('mule-dx-api.open-api-project', yamlUri); + console.log('mule-dx-api.open-api-project command executed successfully'); + } catch (error) { + telemetryService.sendEventData('mule-dx-api.open-api-project command could not be executed', { + error: error.message + }); + console.error('mule-dx-api.open-api-project command could not be executed', error); + } + } else { + telemetryService.sendEventData('mule-dx-api.open-api-project command not found'); + console.log('mule-dx-api.open-api-project command not found'); + } } ); @@ -503,4 +520,14 @@ export class ApexActionController { diffWindowName ); }; + + /** + * Checks if a VSCode command is available. + * @param commandId Command ID of the VSCode command to check + * @returns boolean - true if the command is available, false otherwise + */ + private isCommandAvailable = async (commandId: string): Promise => { + const commands = await vscode.commands.getCommands(true); + return commands.includes(commandId); + }; }