From 390c5aa0e5362fdc8c71bd52fd7f7f1223d800ee Mon Sep 17 00:00:00 2001 From: Roman Nikitenko Date: Mon, 22 Mar 2021 11:55:11 +0200 Subject: [PATCH] Multi-root by default for Dev Workspaces Signed-off-by: Roman Nikitenko --- .../src/node/che-workspace-server.ts | 6 ++++-- .../src/workspace-projects-manager.ts | 13 ++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/extensions/eclipse-che-theia-workspace/src/node/che-workspace-server.ts b/extensions/eclipse-che-theia-workspace/src/node/che-workspace-server.ts index e9e8506f0..f88cb48a4 100644 --- a/extensions/eclipse-che-theia-workspace/src/node/che-workspace-server.ts +++ b/extensions/eclipse-che-theia-workspace/src/node/che-workspace-server.ts @@ -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'; } diff --git a/plugins/workspace-plugin/src/workspace-projects-manager.ts b/plugins/workspace-plugin/src/workspace-projects-manager.ts index 58509ec55..d1b4d3a9e 100644 --- a/plugins/workspace-plugin/src/workspace-projects-manager.ts +++ b/plugins/workspace-plugin/src/workspace-projects-manager.ts @@ -44,11 +44,22 @@ export class WorkspaceProjectsManager { async run(): Promise { 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;