diff --git a/src/testing/suites/iProject.ts b/src/testing/suites/iProject.ts index 773d635c..da6829ef 100644 --- a/src/testing/suites/iProject.ts +++ b/src/testing/suites/iProject.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ /* * (c) Copyright IBM Corp. 2023 */ diff --git a/src/views/projectExplorer/index.ts b/src/views/projectExplorer/index.ts index 5848d124..182ca976 100644 --- a/src/views/projectExplorer/index.ts +++ b/src/views/projectExplorer/index.ts @@ -996,17 +996,25 @@ export default class ProjectExplorer implements TreeDataProvider { 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(); }