Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support workspace folder parameter on runAction #2248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/api/CompileTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ export namespace CompileTools {
}
}

export async function runAction(instance: Instance, uri: vscode.Uri, customAction?: Action, method?: DeploymentMethod, browserItem?: BrowserItem): Promise<boolean> {
export async function runAction(instance: Instance, uri: vscode.Uri, customAction?: Action, method?: DeploymentMethod, browserItem?: BrowserItem, workspaceFolder?: WorkspaceFolder): Promise<boolean> {
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/instantiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down