Skip to content

Commit 1d65651

Browse files
authored
Use correct folder during create component context menu button (#3149)
Use the selected folder when activating create component through the context menu instead of always using the first workspace folder. Fixes #3122 Signed-off-by: David Thompson <[email protected]>
1 parent 51ac8f4 commit 1d65651

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/openshift/component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as YAML from 'yaml';
1313
import { CliChannel } from '../cli';
1414
import { Command } from '../odo/command';
1515
import { ascDevfileFirst, ComponentTypeAdapter, ComponentTypeDescription } from '../odo/componentType';
16-
import { StarterProject, CommandProvider } from '../odo/componentTypeDescription';
16+
import { CommandProvider, StarterProject } from '../odo/componentTypeDescription';
1717
import { ComponentWorkspaceFolder } from '../odo/workspace';
1818
import * as odo3 from '../odo3';
1919
import sendTelemetry, { NewComponentCommandProps } from '../telemetry';
@@ -493,16 +493,16 @@ export class Component extends OpenShiftItem {
493493
*
494494
*/
495495
@vsCommand('openshift.component.createFromRootWorkspaceFolder')
496-
static async createFromRootWorkspaceFolderPalette(): Promise<void> {
497-
const devFileLocation = path.join(workspace.workspaceFolders[0].uri.fsPath, 'devfile.yaml');
496+
static async createFromRootWorkspaceFolderPalette(context: { fsPath: string}): Promise<void> {
497+
const devFileLocation = path.join(context.fsPath, 'devfile.yaml');
498498
try {
499499
await fs.access(devFileLocation);
500500
await window.showErrorMessage('The selected folder already contains a devfile.');
501501
return;
502502
} catch (e) {
503503
// do nothing
504504
}
505-
await CreateComponentLoader.loadView('Create Component', workspace.workspaceFolders[0].uri.fsPath);
505+
await CreateComponentLoader.loadView('Create Component', context.fsPath);
506506
}
507507

508508
/**

0 commit comments

Comments
 (0)