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

Multi-root by default for Dev Workspaces #1043

Merged
merged 1 commit into from
Mar 23, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ 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';
// the multi-root mode is ON by default for DevWorkspace
// 'workspace.runtime' is 'undefined' in the case of DevWorkspace
// the check for 'workspace.runtime' will be removed soon as we are going to turn on multi-root mode by default
return !workspace.runtime || workspace.devfile?.attributes?.multiRoot === 'on';
}
13 changes: 12 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,22 @@ 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 workspace = await che.workspace.getCurrentWorkspace();

// the multi-root mode is ON by default for DevWorkspace
// 'workspace.runtime' is 'undefined' in the case of DevWorkspace
// the check for 'workspace.runtime' will be removed soon as we are going to turn on multi-root mode by default
const isMultiRoot = !workspace.runtime || devfile.metadata?.attributes?.multiRoot === 'on';

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

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