From a826f5363e447de7a511260b60f63f6f3577adad Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 13 Dec 2016 10:17:05 +0100 Subject: [PATCH] Stop changing selection when autoreveal is off (fixes #14745) --- .../workbench/parts/files/browser/files.contribution.ts | 2 +- .../workbench/parts/files/browser/views/explorerView.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/files/browser/files.contribution.ts b/src/vs/workbench/parts/files/browser/files.contribution.ts index 7756a7a6e11..cd050c03186 100644 --- a/src/vs/workbench/parts/files/browser/files.contribution.ts +++ b/src/vs/workbench/parts/files/browser/files.contribution.ts @@ -258,7 +258,7 @@ configurationRegistry.registerConfiguration({ }, 'explorer.autoReveal': { 'type': 'boolean', - 'description': nls.localize('autoReveal', "Controls if the explorer should automatically reveal files when opening them."), + 'description': nls.localize('autoReveal', "Controls if the explorer should automatically reveal and select files when opening them."), 'default': true }, 'explorer.enableDragAndDrop': { diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts index 13582f30140..0604644629f 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts @@ -157,6 +157,10 @@ export class ExplorerView extends CollapsibleViewletView { } private onEditorsChanged(): void { + if (!this.autoReveal) { + return; // do not touch selection or focus if autoReveal === false + } + const activeInput = this.editorService.getActiveEditorInput(); let clearSelection = true; let clearFocus = false; @@ -251,7 +255,12 @@ export class ExplorerView extends CollapsibleViewletView { this.shouldRefresh = false; // Reset flag } + if (!this.autoReveal) { + return refreshPromise; // do not react to setVisible call if autoReveal === false + } + // Always select the current navigated file in explorer if input is file editor input + // unless autoReveal is set to false const activeResource = this.getActiveEditorInputResource(); if (activeResource) { return refreshPromise.then(() => { -- GitLab