From f0478e2c81bfd5b58c6fb240abcbc7d9cdebf4a8 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 17 Jun 2020 15:58:56 +0200 Subject: [PATCH] Fix #99890 #91139 --- .../contrib/markers/browser/markersView.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/markers/browser/markersView.ts b/src/vs/workbench/contrib/markers/browser/markersView.ts index b7754c812a0..f6796e95edb 100644 --- a/src/vs/workbench/contrib/markers/browser/markersView.ts +++ b/src/vs/workbench/contrib/markers/browser/markersView.ts @@ -198,7 +198,8 @@ export class MarkersView extends ViewPane implements IMarkerFilterController { if (this.hasNoProblems() && this.messageBoxContainer) { this.messageBoxContainer.focus(); } else if (this.tree) { - this.tree.getHTMLElement().focus(); + this.tree.domFocus(); + this.setTreeSelection(); } } @@ -295,6 +296,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController { private refreshPanel(markerOrChange?: Marker | MarkerChangesEvent): void { if (this.isVisible() && this.tree) { + const hasSelection = this.tree.getSelection().length > 0; this.cachedFilterStats = undefined; if (markerOrChange) { @@ -321,6 +323,20 @@ export class MarkersView extends ViewPane implements IMarkerFilterController { this.tree.toggleVisibility(total === 0 || filtered === 0); this.renderMessage(); this._onDidChangeFilterStats.fire(this.getFilterStats()); + + if (hasSelection) { + this.setTreeSelection(); + } + } + } + + private setTreeSelection(): void { + if (this.tree && this.tree.getSelection().length === 0) { + const firstMarker = this.markersWorkbenchService.markersModel.resourceMarkers[0].markers[0]; + if (firstMarker) { + this.tree.setFocus([firstMarker]); + this.tree.setSelection([firstMarker]); + } } } -- GitLab