From 471a05f571cadbace7b1728e0c572dc4cf6ffa0e Mon Sep 17 00:00:00 2001 From: Sanjula Ganepola Date: Tue, 3 Sep 2024 11:01:34 -0400 Subject: [PATCH] Support workspace folder parameter on runAction Signed-off-by: Sanjula Ganepola --- src/api/CompileTools.ts | 8 +++++--- src/instantiate.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/api/CompileTools.ts b/src/api/CompileTools.ts index ec62e8869..1b9ac6fa2 100644 --- a/src/api/CompileTools.ts +++ b/src/api/CompileTools.ts @@ -79,15 +79,17 @@ export namespace CompileTools { } } - export async function runAction(instance: Instance, uri: vscode.Uri, customAction?: Action, method?: DeploymentMethod, browserItem?: BrowserItem): Promise { + export async function runAction(instance: Instance, uri: vscode.Uri, customAction?: Action, method?: DeploymentMethod, browserItem?: BrowserItem, workspaceFolder?: WorkspaceFolder): Promise { const connection = instance.getConnection(); const config = instance.getConfig(); const content = instance.getContent(); const uriOptions = parseFSOptions(uri); const isProtected = uriOptions.readonly || config?.readOnlyMode; - - const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri); + + if(!workspaceFolder) { + workspaceFolder = vscode.workspace.getWorkspaceFolder(uri); + } let remoteCwd = config?.homeDirectory || `.`; if (connection && config && content) { diff --git a/src/instantiate.ts b/src/instantiate.ts index dd90c0c62..e9f6607bf 100644 --- a/src/instantiate.ts +++ b/src/instantiate.ts @@ -528,7 +528,7 @@ export async function loadAllofExtension(context: vscode.ExtensionContext) { quickPick.show(); }), - vscode.commands.registerCommand(`code-for-ibmi.runAction`, async (target: vscode.TreeItem | BrowserItem | vscode.Uri, group?: any, action?: Action, method?: DeploymentMethod) => { + vscode.commands.registerCommand(`code-for-ibmi.runAction`, async (target: vscode.TreeItem | BrowserItem | vscode.Uri, group?: any, action?: Action, method?: DeploymentMethod, workspaceFolder?: vscode.WorkspaceFolder) => { const editor = vscode.window.activeTextEditor; let uri; let browserItem; @@ -574,7 +574,7 @@ export async function loadAllofExtension(context: vscode.ExtensionContext) { } if (canRun && [`member`, `streamfile`, `file`, 'object'].includes(uri.scheme)) { - return await CompileTools.runAction(instance, uri, action, method, browserItem); + return await CompileTools.runAction(instance, uri, action, method, browserItem, workspaceFolder); } } else {