Skip to content

Commit

Permalink
Merge pull request #399 from IBM/fix/360-runAction-buildCurrent-wrong…
Browse files Browse the repository at this point in the history
…Path

Fix/360 run action build current wrong path
  • Loading branch information
edmundreinhardt authored Mar 19, 2024
2 parents 2ea96cf + e63e4d0 commit bb748d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/testing/suites/iProject.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
/*
* (c) Copyright IBM Corp. 2023
*/
Expand Down
20 changes: 14 additions & 6 deletions src/views/projectExplorer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,17 +996,25 @@ export default class ProjectExplorer implements TreeDataProvider<ProjectExplorer
}),
commands.registerCommand(`vscode-ibmi-projectexplorer.runAction`, async (element: Project | ObjectFile | MemberFile) => {
if (element) {
let chosenUri = element.resourceUri;

// if project, get the uri of the active editor file if appropriate
if (element instanceof Project) {
await ProjectManager.setActiveProject(element.workspaceFolder);

await commands.executeCommand(`code-for-ibmi.runAction`, {
resourceUri: element.workspaceFolder.uri
});
const activeProject = ProjectManager.getActiveProject();
chosenUri = activeProject?.workspaceFolder.uri;
let activeEditor = window.activeTextEditor;

if (activeEditor) {
const editorProject = ProjectManager.getProjectFromUri(activeEditor.document.uri);
if (activeProject?.workspaceFolder.uri === editorProject?.workspaceFolder.uri) {
chosenUri = activeEditor.document.uri;
}
}
}

await commands.executeCommand(`code-for-ibmi.runAction`, {
resourceUri: element.resourceUri
});
await commands.executeCommand(`code-for-ibmi.runAction`, chosenUri);

this.refresh();
}
Expand Down

0 comments on commit bb748d5

Please sign in to comment.