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

Add backward compatibility related to switching to multi root mode #1074

Merged
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
2 changes: 1 addition & 1 deletion plugins/workspace-plugin/src/workspace-folder-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class WorkspaceFolderUpdater {
private pendingFolders: string[] = [];
private addingWorkspaceFolderPromise: Promise<void> | undefined;

constructor(protected readonly updateWorkspaceFolderTimeout = 3000) {}
constructor(protected readonly updateWorkspaceFolderTimeout = 7000) {}

async addWorkspaceFolder(path: string): Promise<void> {
const workspaceFolderPath = this.toValidWorkspaceFolderPath(path);
Expand Down
12 changes: 11 additions & 1 deletion plugins/workspace-plugin/src/workspace-projects-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export class WorkspaceProjectsManager {

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

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

this.outputChannel.appendLine(`Clone commands are ${JSON.stringify(cloneCommandList, undefined, 2)}`);

Expand All @@ -59,6 +60,15 @@ export class WorkspaceProjectsManager {
theia.window.withProgress({ location: { viewId: 'explorer' } }, () => cloningPromise);
await cloningPromise;

if (isMultiRoot) {
// Backward compatibility for single-root workspaces
// we need it to support workspaces which were created before switching multi-root mode to ON by default
projects
.map(project => this.getProjectPath(project))
.filter(projectPath => fs.existsSync(projectPath))
.forEach(projectPath => this.workspaceFolderUpdater.addWorkspaceFolder(projectPath));
}

await this.startSyncWorkspaceProjects();
}

Expand Down