From 9e5bd182bb4b5b72255c9ae71e2acfc0ef73569a Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Thu, 30 Jul 2020 14:50:42 -0700 Subject: [PATCH] don't change focus to file explorer viewlet when automatically opening sql projects in the open folder (#11583) --- .../src/controllers/mainController.ts | 3 ++- .../src/controllers/projectController.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/sql-database-projects/src/controllers/mainController.ts b/extensions/sql-database-projects/src/controllers/mainController.ts index 935432012f..a8cb704944 100644 --- a/extensions/sql-database-projects/src/controllers/mainController.ts +++ b/extensions/sql-database-projects/src/controllers/mainController.ts @@ -106,7 +106,8 @@ export default class MainController implements vscode.Disposable { let results = await glob(sqlprojFilter); for (let f in results) { - await this.projectsController.openProject(vscode.Uri.file(results[f])); + // open the project, but don't switch focus to the file explorer viewlet + await this.projectsController.openProject(vscode.Uri.file(results[f]), false); } } diff --git a/extensions/sql-database-projects/src/controllers/projectController.ts b/extensions/sql-database-projects/src/controllers/projectController.ts index 302aaa908c..8b815af48e 100644 --- a/extensions/sql-database-projects/src/controllers/projectController.ts +++ b/extensions/sql-database-projects/src/controllers/projectController.ts @@ -47,7 +47,7 @@ export class ProjectsController { this.projectTreeViewProvider.load(this.projects); } - public async openProject(projectFile: vscode.Uri): Promise { + public async openProject(projectFile: vscode.Uri, focusProject: boolean = true): Promise { for (const proj of this.projects) { if (proj.projectFilePath === projectFile.fsPath) { vscode.window.showInformationMessage(constants.projectAlreadyOpened(projectFile.fsPath)); @@ -81,7 +81,10 @@ export class ProjectsController { } this.refreshProjectsTree(); - await this.focusProject(newProject); + + if (focusProject) { + await this.focusProject(newProject); + } } catch (err) { // if the project didnt load - remove it from the list of open projects