Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Multi-root by default for Dev Workspaces
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Nikitenko <[email protected]>
  • Loading branch information
RomanNikitenko committed Mar 22, 2021
1 parent d690740 commit 6314f24
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class CheWorkspaceServer extends DefaultWorkspaceServer {
}

function isMultiRoot(workspace: Workspace): boolean {
const devfile = workspace.devfile;
return !!devfile && !!devfile.attributes && !!devfile.attributes.multiRoot && devfile.attributes.multiRoot === 'on';
const devWorkspaceNamespace = process.env.DEVWORKSPACE_NAMESPACE;
const isDevWorkspace = !!devWorkspaceNamespace;
if (isDevWorkspace) {
return true;
}

return workspace.devfile?.attributes?.multiRoot === 'on';
}
11 changes: 10 additions & 1 deletion plugins/workspace-plugin/src/workspace-projects-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,20 @@ export class WorkspaceProjectsManager {

async run(): Promise<void> {
const devfile = await che.devfile.get();

this.outputChannel.appendLine(`Found devfile ${JSON.stringify(devfile, undefined, 2)}`);

const cloneCommandList = await this.buildCloneCommands(devfile.projects || []);

this.outputChannel.appendLine(`Clone commands are ${JSON.stringify(cloneCommandList, undefined, 2)}`);
const isMultiRoot = devfile.metadata?.attributes?.multiRoot === 'on';

const devWorkspaceNamespace = await theia.env.getEnvVariable('DEVWORKSPACE_NAMESPACE');
const isDevWorkspace = !!devWorkspaceNamespace;
const isMultiRoot = isDevWorkspace || devfile.metadata?.attributes?.multiRoot === 'on';

this.outputChannel.appendLine(`dev workspace is ${isDevWorkspace}`);
this.outputChannel.appendLine(`multi root is ${isMultiRoot}`);

const cloningPromise = this.executeCloneCommands(cloneCommandList, isMultiRoot);
theia.window.withProgress({ location: { viewId: 'explorer' } }, () => cloningPromise);
await cloningPromise;
Expand Down

0 comments on commit 6314f24

Please sign in to comment.