From f8787030c549aeb7c3010b9430a7c8d04ed45646 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 18 Apr 2021 00:28:45 -0400 Subject: [PATCH] Fixes missing id on some nodes --- src/views/nodes/branchNode.ts | 6 +++--- src/views/nodes/branchesNode.ts | 2 +- src/views/nodes/compareBranchNode.ts | 10 +++++----- src/views/nodes/compareResultsNode.ts | 1 + src/views/nodes/pullRequestNode.ts | 2 +- src/views/nodes/remoteNode.ts | 3 +-- src/views/nodes/repositoryNode.ts | 2 +- src/views/nodes/resultsCommitsNode.ts | 2 +- src/views/nodes/resultsFilesNode.ts | 2 +- src/views/nodes/searchResultsNode.ts | 1 + 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/views/nodes/branchNode.ts b/src/views/nodes/branchNode.ts index 762dd8d..a182e53 100644 --- a/src/views/nodes/branchNode.ts +++ b/src/views/nodes/branchNode.ts @@ -403,15 +403,15 @@ export class BranchNode this.label, this.options.expanded ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed, ); + item.id = this.id; + item.contextValue = contextValue; + item.description = description; item.iconPath = this.options.showAsCommits ? new ThemeIcon('git-commit', color) : { dark: Container.context.asAbsolutePath(`images/dark/icon-branch${iconSuffix}.svg`), light: Container.context.asAbsolutePath(`images/light/icon-branch${iconSuffix}.svg`), }; - item.contextValue = contextValue; - item.description = description; - item.id = this.id; item.tooltip = tooltip; item.resourceUri = Uri.parse( `gitlens-view://branch/status/${await this.branch.getStatus()}${ diff --git a/src/views/nodes/branchesNode.ts b/src/views/nodes/branchesNode.ts index e38a0ca..51fe4f8 100644 --- a/src/views/nodes/branchesNode.ts +++ b/src/views/nodes/branchesNode.ts @@ -86,12 +86,12 @@ export class BranchesNode extends ViewNode { async getTreeItem(): Promise { const item = new TreeItem('Branches', TreeItemCollapsibleState.Collapsed); + item.id = this.id; item.contextValue = ContextValues.Branches; if (await this.repo.hasRemotes()) { item.contextValue += '+remotes'; } item.iconPath = new ThemeIcon('git-branch'); - item.id = this.id; return item; } diff --git a/src/views/nodes/compareBranchNode.ts b/src/views/nodes/compareBranchNode.ts index f1ff254..6aeca6b 100644 --- a/src/views/nodes/compareBranchNode.ts +++ b/src/views/nodes/compareBranchNode.ts @@ -160,6 +160,11 @@ export class CompareBranchNode extends ViewNode { }`, TreeItemCollapsibleState.Collapsed, ); + item.id = this.id; item.contextValue = `${ContextValues.CompareResults}${this._pinned ? '+pinned' : ''}`; item.description = description; if (this._pinned) { diff --git a/src/views/nodes/pullRequestNode.ts b/src/views/nodes/pullRequestNode.ts index 38b23d6..2eec36d 100644 --- a/src/views/nodes/pullRequestNode.ts +++ b/src/views/nodes/pullRequestNode.ts @@ -43,6 +43,7 @@ export class PullRequestNode extends ViewNode< getTreeItem(): TreeItem { const item = new TreeItem(`#${this.pullRequest.id}: ${this.pullRequest.title}`, TreeItemCollapsibleState.None); + item.id = this.id; item.contextValue = ContextValues.PullRequest; item.description = `${this.pullRequest.state}, ${this.pullRequest.formatDateFromNow()}`; item.iconPath = new ThemeIcon( @@ -55,7 +56,6 @@ export class PullRequestNode extends ViewNode< : Colors.OpenPullRequestIconColor, ), ); - item.id = this.id; item.tooltip = `${this.pullRequest.title}\n#${this.pullRequest.id} by ${this.pullRequest.author.name} was ${ this.pullRequest.state === PullRequestState.Open ? 'opened' : this.pullRequest.state.toLowerCase() } ${this.pullRequest.formatDateFromNow()}`; diff --git a/src/views/nodes/remoteNode.ts b/src/views/nodes/remoteNode.ts index a2cd9f0..de74f80 100644 --- a/src/views/nodes/remoteNode.ts +++ b/src/views/nodes/remoteNode.ts @@ -107,6 +107,7 @@ export class RemoteNode extends ViewNode { } const item = new TreeItem(this.remote.name, TreeItemCollapsibleState.Collapsed); + item.id = this.id; if (this.remote.provider != null) { const { provider } = this.remote; @@ -144,8 +145,6 @@ export class RemoteNode extends ViewNode { item.resourceUri = Uri.parse('gitlens-view://remote/default'); } - item.id = this.id; - for (const { type, url } of this.remote.urls) { item.tooltip += `\n${url} (${type})`; } diff --git a/src/views/nodes/repositoryNode.ts b/src/views/nodes/repositoryNode.ts index 08195ac..70cec77 100644 --- a/src/views/nodes/repositoryNode.ts +++ b/src/views/nodes/repositoryNode.ts @@ -257,6 +257,7 @@ export class RepositoryNode extends SubscribeableViewNode { } const item = new TreeItem(label, TreeItemCollapsibleState.Expanded); + item.id = this.id; item.contextValue = contextValue; item.description = `${description ?? ''}${ lastFetched @@ -267,7 +268,6 @@ export class RepositoryNode extends SubscribeableViewNode { dark: Container.context.asAbsolutePath(`images/dark/icon-repo${iconSuffix}.svg`), light: Container.context.asAbsolutePath(`images/light/icon-repo${iconSuffix}.svg`), }; - item.id = this.id; item.tooltip = new MarkdownString(tooltip, true); return item; diff --git a/src/views/nodes/resultsCommitsNode.ts b/src/views/nodes/resultsCommitsNode.ts index a018fc0..f8aacaa 100644 --- a/src/views/nodes/resultsCommitsNode.ts +++ b/src/views/nodes/resultsCommitsNode.ts @@ -139,10 +139,10 @@ export class ResultsCommitsNode { `${this.filtered && files != null ? `Showing ${files.length} of ` : ''}${label}`, state, ); + item.id = this.id; item.iconPath = icon; item.contextValue = `${ContextValues.ResultsFiles}${this.filterable ? '+filterable' : ''}${ this.filtered ? `+filtered~${this.filter}` : '' }`; - item.id = this.id; return item; } diff --git a/src/views/nodes/searchResultsNode.ts b/src/views/nodes/searchResultsNode.ts index a9c35e4..06c3b7b 100644 --- a/src/views/nodes/searchResultsNode.ts +++ b/src/views/nodes/searchResultsNode.ts @@ -130,6 +130,7 @@ export class SearchResultsNode extends ViewNode implements async getTreeItem(): Promise { const item = await this.ensureResults().getTreeItem(); + item.id = this.id; item.contextValue = `${ContextValues.SearchResults}${this._pinned ? '+pinned' : ''}`; if ((await Container.git.getRepositoryCount()) > 1) { const repo = await Container.git.getRepository(this.repoPath);