From 10dfbc65d99bcebb1e170b856995464bb0e2887d Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 1 Apr 2019 04:00:38 -0400 Subject: [PATCH] Fixes #691 - Keep expand/collapse state on swap --- CHANGELOG.md | 1 + src/views/nodes/compareResultsNode.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eae8556..1fec9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Fixes [#683](https://github.com/eamodio/vscode-gitlens/issues/683) - log.showSignature leads to stray files being displayed +- Fixes [#691](https://github.com/eamodio/vscode-gitlens/issues/691) - Auto-expand tree view on Swap Comparison - Fixes the behavior of the _Open Line Changes with Previous Revision_ (`gitlens.diffLineWithPrevious`) command to follow the line history much better ## [9.5.1] - 2019-02-13 diff --git a/src/views/nodes/compareResultsNode.ts b/src/views/nodes/compareResultsNode.ts index b166616..23e16c1 100644 --- a/src/views/nodes/compareResultsNode.ts +++ b/src/views/nodes/compareResultsNode.ts @@ -7,9 +7,9 @@ import { log, Strings } from '../../system'; import { CompareView } from '../compareView'; import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode'; import { ResultsFilesNode } from './resultsFilesNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; -export class CompareResultsNode extends ViewNode { +export class CompareResultsNode extends SubscribeableViewNode { constructor( view: CompareView, public readonly repoPath: string, @@ -52,7 +52,7 @@ export class CompareResultsNode extends ViewNode { description = (repo && repo.formattedName) || this.uri.repoPath; } - const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed); + const item = new TreeItem(this.label, this._state || TreeItemCollapsibleState.Collapsed); item.contextValue = ResourceType.CompareResults; if (this._pinned) { item.contextValue += '+pinned'; @@ -118,6 +118,10 @@ export class CompareResultsNode extends ViewNode { this.view.triggerNodeChange(this); } + protected subscribe() { + return undefined; + } + private async getCommitsQuery(maxCount: number | undefined): Promise { const log = await Container.git.getLog(this.uri.repoPath!, { maxCount: maxCount,