From 9990ad718c50834268dce618c0b3e6b75cba58f0 Mon Sep 17 00:00:00 2001 From: artificial-ben Date: Fri, 1 Jul 2022 10:44:17 -0500 Subject: [PATCH] Check for presence of wfdebug in expected location for each debug configuration --- package.json | 2 +- src/activateWorkflowDebug.ts | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0f6fc2a8..2a7e5533 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "artificial-debug-extension", "displayName": "Artificial Inc. Workflow Debugger VSCode Extension", - "version": "1.2.0", + "version": "1.2.1", "publisher": "artificial", "description": "Enables debugging of Artificial, Inc. Workflows.", "author": { diff --git a/src/activateWorkflowDebug.ts b/src/activateWorkflowDebug.ts index b554065a..5a9e6392 100644 --- a/src/activateWorkflowDebug.ts +++ b/src/activateWorkflowDebug.ts @@ -44,7 +44,7 @@ class ArtificialWorkflowDebugConfigurationProvider implements vscode.DebugConfig * Massage a debug configuration just before a debug session is being launched, * e.g. add all missing attributes to the debug configuration. */ - resolveDebugConfiguration(folder: WorkspaceFolder | undefined, config: DebugConfiguration, token?: CancellationToken): ProviderResult { + async resolveDebugConfiguration(folder: WorkspaceFolder | undefined, config: DebugConfiguration, token?: CancellationToken): Promise { // if launch.json is missing or empty if (!config.type && !config.request && !config.name) { @@ -58,19 +58,24 @@ class ArtificialWorkflowDebugConfigurationProvider implements vscode.DebugConfig } if (!config.program) { - return vscode.window.showInformationMessage("Cannot find a program to debug").then(_ => { - return undefined; // abort launch - }); + await vscode.window.showErrorMessage("Cannot find a program to debug"); + return undefined; // abort launch } if (config.type == 'attach' && !config.jobId && !config.jobName) { - return vscode.window.showInformationMessage("jobId or jobName must be specified in attach config").then(_ => { - return undefined; // abort launch - }); + await vscode.window.showErrorMessage("jobId or jobName must be specified in attach config"); + return undefined; } config.envFile = config.envFile ?? vscode.workspace.getConfiguration('artificial.workflow.debug').envFilePath + try { + await vscode.workspace.fs.stat(vscode.Uri.parse('file:///home/code/.local/bin/wfdebug')); + } + catch (ex: any) { + const fileSystemError: vscode.FileSystemError = ex; + vscode.window.showWarningMessage(`Cannot access wfdebug utility; please ensure that the artificial-debug-adapter package is installed. Error: ${fileSystemError.message}`); + } return config; } }