From 469ba2a62062055a1eb85196e3be16a19c66c9a3 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 21 Aug 2017 10:50:45 +0200 Subject: [PATCH] fixes #32816 --- extensions/git/src/commands.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index ccba5abd79b..86261a370fa 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -153,10 +153,10 @@ export class CommandCenter { @command('git.openResource') async openResource(resource: Resource): Promise { - await this._openResource(resource); + await this._openResource(resource, undefined, true); } - private async _openResource(resource: Resource, preview?: boolean): Promise { + private async _openResource(resource: Resource, preview?: boolean, preserveFocus?: boolean): Promise { const left = this.getLeftResource(resource); const right = this.getRightResource(resource); const title = this.getTitle(resource); @@ -168,8 +168,8 @@ export class CommandCenter { } const opts: TextDocumentShowOptions = { - preserveFocus: true, - preview: preview, + preserveFocus, + preview, viewColumn: window.activeTextEditor && window.activeTextEditor.viewColumn || ViewColumn.One }; @@ -311,6 +311,8 @@ export class CommandCenter { @command('git.openFile') async openFile(arg?: Resource | Uri, ...resourceStates: SourceControlResourceState[]): Promise { + const preserveFocus = !!arg; + let uris: Uri[] | undefined; if (arg instanceof Uri) { @@ -345,7 +347,7 @@ export class CommandCenter { : undefined; const opts: TextDocumentShowOptions = { - preserveFocus: true, + preserveFocus, preview: preview, viewColumn: activeTextEditor && activeTextEditor.viewColumn || ViewColumn.One }; @@ -387,6 +389,7 @@ export class CommandCenter { @command('git.openChange') async openChange(arg?: Resource | Uri, ...resourceStates: SourceControlResourceState[]): Promise { + const preserveFocus = !!arg; let resources: Resource[] | undefined = undefined; if (arg instanceof Uri) { @@ -415,7 +418,7 @@ export class CommandCenter { const preview = resources.length === 1 ? undefined : false; for (const resource of resources) { - await this._openResource(resource, preview); + await this._openResource(resource, preview, preserveFocus); } }