diff --git a/src/views/nodes/branchNode.ts b/src/views/nodes/branchNode.ts index ed9ff99..af01be5 100644 --- a/src/views/nodes/branchNode.ts +++ b/src/views/nodes/branchNode.ts @@ -11,7 +11,7 @@ import { BranchTrackingStatusNode } from './branchTrackingStatusNode'; import { CommitNode } from './commitNode'; import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { PageableViewNode, ResourceType, ViewNode, ViewRefNode } from './viewNode'; +import { ContextValues, PageableViewNode, ViewNode, ViewRefNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class BranchNode extends ViewRefNode implements PageableViewNode { @@ -117,7 +117,7 @@ export class BranchNode extends ViewRefNode implements const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed); item.id = this.id; if (this._root) { - item.contextValue = ahead ? ResourceType.StatusAheadOfUpstream : ResourceType.StatusBehindUpstream; + item.contextValue = ahead ? ContextValues.StatusAheadOfUpstream : ContextValues.StatusBehindUpstream; } else { item.contextValue = ahead - ? ResourceType.BranchStatusAheadOfUpstream - : ResourceType.BranchStatusBehindUpstream; + ? ContextValues.BranchStatusAheadOfUpstream + : ContextValues.BranchStatusBehindUpstream; } item.iconPath = new ThemeIcon(ahead ? 'cloud-upload' : 'cloud-download'); item.tooltip = `${label}${ahead ? ' of ' : ' '}${this.status.upstream}`; diff --git a/src/views/nodes/branchesNode.ts b/src/views/nodes/branchesNode.ts index f1c377d..af46c91 100644 --- a/src/views/nodes/branchesNode.ts +++ b/src/views/nodes/branchesNode.ts @@ -8,7 +8,7 @@ import { Arrays, debug, gate } from '../../system'; import { RepositoriesView } from '../repositoriesView'; import { BranchNode } from './branchNode'; import { BranchOrTagFolderNode } from './branchOrTagFolderNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; import { MessageNode } from './common'; @@ -70,7 +70,7 @@ export class BranchesNode extends ViewNode { async getTreeItem(): Promise { const item = new TreeItem('Branches', TreeItemCollapsibleState.Collapsed); - item.contextValue = ResourceType.Branches; + item.contextValue = ContextValues.Branches; if (await this.repo.hasRemotes()) { item.contextValue += '+remotes'; } diff --git a/src/views/nodes/commitFileNode.ts b/src/views/nodes/commitFileNode.ts index 0b4c235..647b624 100644 --- a/src/views/nodes/commitFileNode.ts +++ b/src/views/nodes/commitFileNode.ts @@ -7,7 +7,7 @@ import { Container } from '../../container'; import { CommitFormatter, GitFile, GitLogCommit, GitRevisionReference, StatusFileFormatter } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { View } from '../viewBase'; -import { ResourceType, ViewNode, ViewRefFileNode } from './viewNode'; +import { ContextValues, ViewNode, ViewRefFileNode } from './viewNode'; export class CommitFileNode extends ViewRefFileNode { constructor( @@ -58,7 +58,7 @@ export class CommitFileNode extends ViewRefFileNode { } const item = new TreeItem(this.label, TreeItemCollapsibleState.None); - item.contextValue = this.resourceType; + item.contextValue = this.contextValye; item.description = this.description; item.tooltip = this.tooltip; @@ -82,6 +82,14 @@ export class CommitFileNode extends ViewRefFileNode { return item; } + protected get contextValye(): string { + if (!this.commit.isUncommitted) { + return `${ContextValues.File}+committed${this._options.inFileHistory ? '+history' : ''}`; + } + + return this.commit.isUncommittedStaged ? `${ContextValues.File}+staged` : `${ContextValues.File}+unstaged`; + } + private _description: string | undefined; get description() { if (this._description === undefined) { @@ -130,14 +138,6 @@ export class CommitFileNode extends ViewRefFileNode { this._tooltip = undefined; } - protected get resourceType(): string { - if (!this.commit.isUncommitted) { - return `${ResourceType.File}+committed${this._options.inFileHistory ? '+history' : ''}`; - } - - return this.commit.isUncommittedStaged ? `${ResourceType.File}+staged` : `${ResourceType.File}+unstaged`; - } - private _tooltip: string | undefined; get tooltip() { if (this._tooltip === undefined) { diff --git a/src/views/nodes/commitNode.ts b/src/views/nodes/commitNode.ts index 73e95ed..f67e38c 100644 --- a/src/views/nodes/commitNode.ts +++ b/src/views/nodes/commitNode.ts @@ -10,7 +10,7 @@ import { Arrays, Iterables, Strings } from '../../system'; import { ViewWithFiles } from '../viewBase'; import { CommitFileNode } from './commitFileNode'; import { FileNode, FolderNode } from './folderNode'; -import { ResourceType, ViewNode, ViewRefNode } from './viewNode'; +import { ContextValues, ViewNode, ViewRefNode } from './viewNode'; export class CommitNode extends ViewRefNode { constructor( @@ -67,7 +67,7 @@ export class CommitNode extends ViewRefNode label, this._options.expand ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed, ); - item.contextValue = ResourceType.Commit; + item.contextValue = ContextValues.Commit; if (this.branch?.current) { item.contextValue += '+current'; } diff --git a/src/views/nodes/common.ts b/src/views/nodes/common.ts index ffc3dab..8a2b56e 100644 --- a/src/views/nodes/common.ts +++ b/src/views/nodes/common.ts @@ -2,7 +2,7 @@ import { Command, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vsc import { GlyphChars } from '../../constants'; import { Container } from '../../container'; import { View } from '../viewBase'; -import { PageableViewNode, ResourceType, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, unknownGitUri, ViewNode } from './viewNode'; export class MessageNode extends ViewNode { constructor( @@ -29,7 +29,7 @@ export class MessageNode extends ViewNode { getTreeItem(): TreeItem | Promise { const item = new TreeItem(this._message, TreeItemCollapsibleState.None); - item.contextValue = ResourceType.Message; + item.contextValue = ContextValues.Message; item.description = this._description; item.tooltip = this._tooltip; item.iconPath = this._iconPath; @@ -97,7 +97,7 @@ export class UpdateableMessageNode extends ViewNode { getTreeItem(): TreeItem | Promise { const item = new TreeItem(this._message, TreeItemCollapsibleState.None); item.id = this.id; - item.contextValue = ResourceType.Message; + item.contextValue = ContextValues.Message; item.tooltip = this._tooltip; item.iconPath = this._iconPath; return item; @@ -164,7 +164,7 @@ export abstract class PagerNode extends ViewNode { getTreeItem(): TreeItem | Promise { const item = new TreeItem(this.message, TreeItemCollapsibleState.None); - item.contextValue = ResourceType.Pager; + item.contextValue = ContextValues.Pager; item.command = this.getCommand(); return item; } diff --git a/src/views/nodes/compareBranchNode.ts b/src/views/nodes/compareBranchNode.ts index 755fb8b..77ddcb2 100644 --- a/src/views/nodes/compareBranchNode.ts +++ b/src/views/nodes/compareBranchNode.ts @@ -1,7 +1,7 @@ 'use strict'; import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode'; import { BranchComparison, BranchComparisons, GlyphChars, WorkspaceState } from '../../constants'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoriesView } from '../repositoriesView'; import { GitBranch, GitRevision } from '../../git/git'; import { GitUri } from '../../git/gitUri'; @@ -107,7 +107,7 @@ export class CompareBranchNode extends ViewNode { command: 'gitlens.views.executeNodeCallback', arguments: [() => this.compareWith()], }; - item.contextValue = `${ResourceType.CompareBranch}${this._compareWith === undefined ? '' : '+comparing'}+${ + item.contextValue = `${ContextValues.CompareBranch}${this._compareWith === undefined ? '' : '+comparing'}+${ this.comparisonNotation === '..' ? 'twodot' : 'threedot' }+${this.comparisonType}`; item.description = description; diff --git a/src/views/nodes/compareNode.ts b/src/views/nodes/compareNode.ts index 7dc596a..81a6fd1 100644 --- a/src/views/nodes/compareNode.ts +++ b/src/views/nodes/compareNode.ts @@ -8,7 +8,7 @@ import { debug, gate, Iterables, log, Promises } from '../../system'; import { CompareView } from '../compareView'; import { MessageNode } from './common'; import { ComparePickerNode } from './comparePickerNode'; -import { ResourceType, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, unknownGitUri, ViewNode } from './viewNode'; interface RepoRef { label: string; @@ -55,7 +55,7 @@ export class CompareNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Compare', TreeItemCollapsibleState.Expanded); - item.contextValue = ResourceType.Compare; + item.contextValue = ContextValues.Compare; return item; } diff --git a/src/views/nodes/comparePickerNode.ts b/src/views/nodes/comparePickerNode.ts index f27a6e8..eb5045c 100644 --- a/src/views/nodes/comparePickerNode.ts +++ b/src/views/nodes/comparePickerNode.ts @@ -4,7 +4,7 @@ import { GlyphChars } from '../../constants'; import { Container } from '../../container'; import { CompareView } from '../compareView'; import { CompareNode } from './compareNode'; -import { ResourceType, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, unknownGitUri, ViewNode } from './viewNode'; export class ComparePickerNode extends ViewNode { constructor(view: CompareView, protected readonly parent: CompareNode) { @@ -33,7 +33,7 @@ export class ComparePickerNode extends ViewNode { 'Compare with ', TreeItemCollapsibleState.None, ); - item.contextValue = ResourceType.ComparePicker; + item.contextValue = ContextValues.ComparePicker; item.description = description; item.tooltip = `Click to select or enter a reference for compare${GlyphChars.Ellipsis}`; item.command = { @@ -45,7 +45,7 @@ export class ComparePickerNode extends ViewNode { `Compare ${selectedRef.label} with `, TreeItemCollapsibleState.None, ); - item.contextValue = ResourceType.ComparePickerWithRef; + item.contextValue = ContextValues.ComparePickerWithRef; item.description = description; item.tooltip = `Click to compare ${selectedRef.label} with${GlyphChars.Ellipsis}`; item.command = { diff --git a/src/views/nodes/compareResultsNode.ts b/src/views/nodes/compareResultsNode.ts index a505055..266652e 100644 --- a/src/views/nodes/compareResultsNode.ts +++ b/src/views/nodes/compareResultsNode.ts @@ -8,7 +8,7 @@ import { debug, gate, log, Strings } from '../../system'; import { CompareView } from '../compareView'; import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode'; import { FilesQueryResults, ResultsFilesNode } from './resultsFilesNode'; -import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { ContextValues, SubscribeableViewNode, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; let instanceId = 0; @@ -80,7 +80,7 @@ export class CompareResultsNode extends SubscribeableViewNode { }`, this._state ?? TreeItemCollapsibleState.Collapsed, ); - item.contextValue = `${ResourceType.CompareResults}+${ + item.contextValue = `${ContextValues.CompareResults}+${ this.comparisonNotation === '..' ? 'twodot' : 'threedot' }`; if (this._pinned) { diff --git a/src/views/nodes/contributorNode.ts b/src/views/nodes/contributorNode.ts index c6a69ee..6ba2ed2 100644 --- a/src/views/nodes/contributorNode.ts +++ b/src/views/nodes/contributorNode.ts @@ -4,7 +4,7 @@ import { GitContributor, GitLog } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { debug, gate, Iterables, Strings } from '../../system'; import { RepositoriesView } from '../repositoriesView'; -import { PageableViewNode, ResourceType, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, ViewNode } from './viewNode'; import { Container } from '../../container'; import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; @@ -66,7 +66,9 @@ export class ContributorNode extends ViewNode implements Pagea TreeItemCollapsibleState.Collapsed, ); item.id = this.id; - item.contextValue = this.contributor.current ? `${ResourceType.Contributor}+current` : ResourceType.Contributor; + item.contextValue = this.contributor.current + ? `${ContextValues.Contributor}+current` + : ContextValues.Contributor; item.description = `${ presence != null && presence.status !== 'offline' ? `${presence.statusText} ${GlyphChars.Space}${GlyphChars.Dot}${GlyphChars.Space} ` diff --git a/src/views/nodes/contributorsNode.ts b/src/views/nodes/contributorsNode.ts index a7af5a0..2415cde 100644 --- a/src/views/nodes/contributorsNode.ts +++ b/src/views/nodes/contributorsNode.ts @@ -5,7 +5,7 @@ import { GitUri } from '../../git/gitUri'; import { RepositoriesView } from '../repositoriesView'; import { MessageNode } from './common'; import { ContributorNode } from './contributorNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { Container } from '../../container'; import { RepositoryNode } from './repositoryNode'; import { debug, timeout } from '../../system'; @@ -38,7 +38,7 @@ export class ContributorsNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Contributors', TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Contributors; + item.contextValue = ContextValues.Contributors; item.iconPath = new ThemeIcon('organization'); return item; } diff --git a/src/views/nodes/fileHistoryNode.ts b/src/views/nodes/fileHistoryNode.ts index c5efef8..9745279 100644 --- a/src/views/nodes/fileHistoryNode.ts +++ b/src/views/nodes/fileHistoryNode.ts @@ -15,7 +15,7 @@ import { View } from '../viewBase'; import { CommitFileNode } from './commitFileNode'; import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { PageableViewNode, ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, SubscribeableViewNode, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class FileHistoryNode extends SubscribeableViewNode implements PageableViewNode { @@ -90,7 +90,7 @@ export class FileHistoryNode extends SubscribeableViewNode implements PageableVi }`, TreeItemCollapsibleState.Expanded, ); - item.contextValue = ResourceType.FileHistory; + item.contextValue = ContextValues.FileHistory; item.description = this.uri.directory; item.tooltip = `History of ${this.uri.fileName}\n${this.uri.directory}/${ this.uri.sha == null ? '' : `\n\n${this.uri.sha}` diff --git a/src/views/nodes/fileHistoryTrackerNode.ts b/src/views/nodes/fileHistoryTrackerNode.ts index a1ea5d1..3443b5d 100644 --- a/src/views/nodes/fileHistoryTrackerNode.ts +++ b/src/views/nodes/fileHistoryTrackerNode.ts @@ -10,7 +10,7 @@ import { GitCommitish, GitUri } from '../../git/gitUri'; import { Logger } from '../../logger'; import { ReferencePicker } from '../../quickpicks'; import { debug, Functions, gate, log } from '../../system'; -import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; export class FileHistoryTrackerNode extends SubscribeableViewNode { private _base: string | undefined; @@ -58,7 +58,7 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode { getTreeItem(): TreeItem { const item = new TreeItem(this.label, TreeItemCollapsibleState.Expanded); - item.contextValue = ResourceType.Folder; + item.contextValue = ContextValues.Folder; if (this.containsWorkingFiles) { item.contextValue += '+working'; } diff --git a/src/views/nodes/lineHistoryNode.ts b/src/views/nodes/lineHistoryNode.ts index 35d1a7d..0f49e67 100644 --- a/src/views/nodes/lineHistoryNode.ts +++ b/src/views/nodes/lineHistoryNode.ts @@ -18,7 +18,7 @@ import { View } from '../viewBase'; import { CommitFileNode } from './commitFileNode'; import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { PageableViewNode, ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, SubscribeableViewNode, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class LineHistoryNode extends SubscribeableViewNode implements PageableViewNode { @@ -214,7 +214,7 @@ export class LineHistoryNode extends SubscribeableViewNode implements PageableVi }`, TreeItemCollapsibleState.Expanded, ); - item.contextValue = ResourceType.LineHistory; + item.contextValue = ContextValues.LineHistory; item.description = this.uri.directory; item.tooltip = `History of ${this.uri.fileName}${lines}\n${this.uri.directory}/${ this.uri.sha == null ? '' : `\n\n${this.uri.sha}` diff --git a/src/views/nodes/lineHistoryTrackerNode.ts b/src/views/nodes/lineHistoryTrackerNode.ts index f64a92d..b081e0e 100644 --- a/src/views/nodes/lineHistoryTrackerNode.ts +++ b/src/views/nodes/lineHistoryTrackerNode.ts @@ -12,7 +12,7 @@ import { Logger } from '../../logger'; import { ReferencePicker } from '../../quickpicks'; import { debug, Functions, gate, log } from '../../system'; import { LinesChangeEvent } from '../../trackers/gitLineTracker'; -import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; export class LineHistoryTrackerNode extends SubscribeableViewNode { private _base: string | undefined; @@ -64,7 +64,7 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode implements PageableVi getTreeItem(): TreeItem { const item = new TreeItem('Incoming Activity', TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Reflog; + item.contextValue = ContextValues.Reflog; item.description = 'experimental'; item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-activity.svg'), diff --git a/src/views/nodes/reflogRecordNode.ts b/src/views/nodes/reflogRecordNode.ts index 9c0face..fef0145 100644 --- a/src/views/nodes/reflogRecordNode.ts +++ b/src/views/nodes/reflogRecordNode.ts @@ -8,7 +8,7 @@ import { debug, gate, Iterables } from '../../system'; import { ViewWithFiles } from '../viewBase'; import { CommitNode } from './commitNode'; import { MessageNode, ShowMoreNode } from './common'; -import { PageableViewNode, ResourceType, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class ReflogRecordNode extends ViewNode implements PageableViewNode { @@ -66,7 +66,7 @@ export class ReflogRecordNode extends ViewNode implements Pageabl ? '' : `${this.record.HEAD} ${GlyphChars.Space}${GlyphChars.Dot}${GlyphChars.Space} ` }${this.record.formattedDate}`; - item.contextValue = ResourceType.ReflogRecord; + item.contextValue = ContextValues.ReflogRecord; item.tooltip = `${this.record.HEAD.length === 0 ? '' : `${this.record.HEAD}\n`}${this.record.command}${ this.record.commandArgs ? ` ${this.record.commandArgs}` : '' }${ diff --git a/src/views/nodes/remoteNode.ts b/src/views/nodes/remoteNode.ts index 4b5a9cc..fd45b73 100644 --- a/src/views/nodes/remoteNode.ts +++ b/src/views/nodes/remoteNode.ts @@ -9,7 +9,7 @@ import { Arrays, log } from '../../system'; import { RepositoriesView } from '../repositoriesView'; import { BranchNode } from './branchNode'; import { BranchOrTagFolderNode } from './branchOrTagFolderNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; import { MessageNode } from './common'; @@ -118,12 +118,12 @@ export class RemoteNode extends ViewNode { if (provider.hasApi()) { const connected = provider.maybeConnected ?? (await provider.isConnected()); - item.contextValue += `${ResourceType.Remote}${connected ? '+connected' : '+disconnected'}`; + item.contextValue += `${ContextValues.Remote}${connected ? '+connected' : '+disconnected'}`; item.tooltip = `${this.remote.name} (${provider.name} ${GlyphChars.Dash} ${ connected ? 'connected' : 'not connected' })\n${provider.displayPath}\n`; } else { - item.contextValue = ResourceType.Remote; + item.contextValue = ContextValues.Remote; item.tooltip = `${this.remote.name} (${provider.name})\n${provider.displayPath}\n`; } } else { @@ -132,7 +132,7 @@ export class RemoteNode extends ViewNode { ? `${this.remote.domain} ${GlyphChars.Space}${GlyphChars.Dot}${GlyphChars.Space} ` : '' }${this.remote.path}`; - item.contextValue = ResourceType.Remote; + item.contextValue = ContextValues.Remote; item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-remote.svg'), light: Container.context.asAbsolutePath('images/light/icon-remote.svg'), diff --git a/src/views/nodes/remotesNode.ts b/src/views/nodes/remotesNode.ts index d5a9a88..8b4c8a5 100644 --- a/src/views/nodes/remotesNode.ts +++ b/src/views/nodes/remotesNode.ts @@ -6,7 +6,7 @@ import { GitUri } from '../../git/gitUri'; import { RepositoriesView } from '../repositoriesView'; import { MessageNode } from './common'; import { RemoteNode } from './remoteNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class RemotesNode extends ViewNode { @@ -35,7 +35,7 @@ export class RemotesNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Remotes', TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Remotes; + item.contextValue = ContextValues.Remotes; item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-remote.svg'), diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index cf7f99b..1dc31bc 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -7,7 +7,7 @@ import { debug, Functions, gate } from '../../system'; import { RepositoriesView } from '../repositoriesView'; import { MessageNode } from './common'; import { RepositoryNode } from './repositoryNode'; -import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode'; export class RepositoriesNode extends SubscribeableViewNode { private _children: (RepositoryNode | MessageNode)[] | undefined; @@ -47,7 +47,7 @@ export class RepositoriesNode extends SubscribeableViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Repositories', TreeItemCollapsibleState.Expanded); - item.contextValue = ResourceType.Repositories; + item.contextValue = ContextValues.Repositories; void this.ensureSubscription(); diff --git a/src/views/nodes/repositoryNode.ts b/src/views/nodes/repositoryNode.ts index 40952c4..d409c62 100644 --- a/src/views/nodes/repositoryNode.ts +++ b/src/views/nodes/repositoryNode.ts @@ -25,7 +25,7 @@ import { RemotesNode } from './remotesNode'; import { StashesNode } from './stashesNode'; import { StatusFilesNode } from './statusFilesNode'; import { TagsNode } from './tagsNode'; -import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode'; +import { ContextValues, SubscribeableViewNode, ViewNode } from './viewNode'; const hasTimeRegex = /[hHm]/; @@ -130,7 +130,7 @@ export class RepositoryNode extends SubscribeableViewNode { let iconSuffix = ''; let workingStatus = ''; - let contextValue: string = ResourceType.Repository; + let contextValue: string = ContextValues.Repository; if (this.repo.starred) { contextValue += '+starred'; } diff --git a/src/views/nodes/resultsCommitsNode.ts b/src/views/nodes/resultsCommitsNode.ts index a24be7e..df42477 100644 --- a/src/views/nodes/resultsCommitsNode.ts +++ b/src/views/nodes/resultsCommitsNode.ts @@ -8,7 +8,7 @@ import { ViewWithFiles } from '../viewBase'; import { CommitNode } from './commitNode'; import { ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { PageableViewNode, ResourceType, ViewNode } from './viewNode'; +import { ContextValues, PageableViewNode, ViewNode } from './viewNode'; export interface CommitsQueryResults { readonly label: string; @@ -35,8 +35,8 @@ export class ResultsCommitsNode extends ViewNode implements Pagea return `${this.parent!.id}:results:commits`; } - get type(): ResourceType { - return ResourceType.ResultsCommits; + get type(): ContextValues { + return ContextValues.ResultsCommits; } async getChildren(): Promise { diff --git a/src/views/nodes/resultsFileNode.ts b/src/views/nodes/resultsFileNode.ts index 415d3af..70e6001 100644 --- a/src/views/nodes/resultsFileNode.ts +++ b/src/views/nodes/resultsFileNode.ts @@ -6,7 +6,7 @@ import { Container } from '../../container'; import { GitFile, GitReference, GitRevisionReference, StatusFileFormatter } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { View } from '../viewBase'; -import { ResourceType, ViewNode, ViewRefFileNode } from './viewNode'; +import { ContextValues, ViewNode, ViewRefFileNode } from './viewNode'; export class ResultsFileNode extends ViewRefFileNode { constructor( @@ -38,7 +38,7 @@ export class ResultsFileNode extends ViewRefFileNode { getTreeItem(): TreeItem { const item = new TreeItem(this.label, TreeItemCollapsibleState.None); - item.contextValue = ResourceType.ResultsFile; + item.contextValue = ContextValues.ResultsFile; item.description = this.description; item.tooltip = StatusFileFormatter.fromTemplate( // eslint-disable-next-line no-template-curly-in-string diff --git a/src/views/nodes/resultsFilesNode.ts b/src/views/nodes/resultsFilesNode.ts index 66ed8a8..447d8e7 100644 --- a/src/views/nodes/resultsFilesNode.ts +++ b/src/views/nodes/resultsFilesNode.ts @@ -8,7 +8,7 @@ import { Arrays, debug, gate, Iterables, Promises, Strings } from '../../system' import { ViewWithFiles } from '../viewBase'; import { FileNode, FolderNode } from './folderNode'; import { ResultsFileNode } from './resultsFileNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; export interface FilesQueryResults { label: string; @@ -80,7 +80,7 @@ export class ResultsFilesNode extends ViewNode { } const item = new TreeItem(label ?? 'files changed', state); - item.contextValue = ResourceType.ResultsFiles; + item.contextValue = ContextValues.ResultsFiles; item.id = this.id; return item; diff --git a/src/views/nodes/searchNode.ts b/src/views/nodes/searchNode.ts index d104708..f44cb3c 100644 --- a/src/views/nodes/searchNode.ts +++ b/src/views/nodes/searchNode.ts @@ -5,7 +5,7 @@ import { GlyphChars } from '../../constants'; import { debug, gate, Iterables, log, Promises } from '../../system'; import { View } from '../viewBase'; import { CommandMessageNode, MessageNode } from './common'; -import { ResourceType, unknownGitUri, ViewNode } from './viewNode'; +import { ContextValues, unknownGitUri, ViewNode } from './viewNode'; import { SearchOperators } from '../../git/git'; export class SearchNode extends ViewNode { @@ -93,7 +93,7 @@ export class SearchNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Search', TreeItemCollapsibleState.Expanded); - item.contextValue = ResourceType.Search; + item.contextValue = ContextValues.Search; return item; } diff --git a/src/views/nodes/searchResultsCommitsNode.ts b/src/views/nodes/searchResultsCommitsNode.ts index 704523a..ced3b0d 100644 --- a/src/views/nodes/searchResultsCommitsNode.ts +++ b/src/views/nodes/searchResultsCommitsNode.ts @@ -3,7 +3,7 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode'; import { Commands, SearchCommitsCommandArgs } from '../../commands'; import { ViewWithFiles } from '../viewBase'; import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; import { SearchPattern } from '../../git/git'; @@ -39,8 +39,8 @@ export class SearchResultsCommitsNode extends ResultsCommitsNode { return SearchResultsCommitsNode.getId(this.repoPath, this.search, this._instanceId); } - get type(): ResourceType { - return ResourceType.SearchResults; + get type(): ContextValues { + return ContextValues.SearchResults; } async getTreeItem(): Promise { diff --git a/src/views/nodes/stashFileNode.ts b/src/views/nodes/stashFileNode.ts index 084d17b..5d1b454 100644 --- a/src/views/nodes/stashFileNode.ts +++ b/src/views/nodes/stashFileNode.ts @@ -2,15 +2,15 @@ import { GitFile, GitLogCommit } from '../../git/git'; import { View } from '../viewBase'; import { CommitFileNode } from './commitFileNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; export class StashFileNode extends CommitFileNode { constructor(view: View, parent: ViewNode, file: GitFile, commit: GitLogCommit) { super(view, parent, file, commit); } - protected get resourceType(): ResourceType { - return ResourceType.StashFile; + protected get contextValye(): ContextValues { + return ContextValues.StashFile; } protected getCommitTemplate() { diff --git a/src/views/nodes/stashNode.ts b/src/views/nodes/stashNode.ts index 1b63125..30b7ce8 100644 --- a/src/views/nodes/stashNode.ts +++ b/src/views/nodes/stashNode.ts @@ -6,7 +6,7 @@ import { CommitFormatter, GitStashCommit, GitStashReference } from '../../git/gi import { Arrays, Iterables, Strings } from '../../system'; import { ViewWithFiles } from '../viewBase'; import { StashFileNode } from './stashFileNode'; -import { ResourceType, ViewNode, ViewRefNode } from './viewNode'; +import { ContextValues, ViewNode, ViewRefNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; import { FileNode, FolderNode } from '../nodes'; import { ViewFilesLayout } from '../../config'; @@ -83,7 +83,7 @@ export class StashNode extends ViewRefNode { truncateMessageAtNewLine: true, dateFormat: Container.config.defaultDateFormat, }); - item.contextValue = ResourceType.Stash; + item.contextValue = ContextValues.Stash; // eslint-disable-next-line no-template-curly-in-string item.tooltip = CommitFormatter.fromTemplate('${ago} (${date})\n\n${message}', this.commit, { dateFormat: Container.config.defaultDateFormat, diff --git a/src/views/nodes/stashesNode.ts b/src/views/nodes/stashesNode.ts index f527207..0204770 100644 --- a/src/views/nodes/stashesNode.ts +++ b/src/views/nodes/stashesNode.ts @@ -7,7 +7,7 @@ import { Iterables } from '../../system'; import { ViewWithFiles } from '../viewBase'; import { MessageNode } from './common'; import { StashNode } from './stashNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class StashesNode extends ViewNode { @@ -34,7 +34,7 @@ export class StashesNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Stashes', TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Stashes; + item.contextValue = ContextValues.Stashes; item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-stash.svg'), diff --git a/src/views/nodes/statusFileNode.ts b/src/views/nodes/statusFileNode.ts index 2c66459..04653cc 100644 --- a/src/views/nodes/statusFileNode.ts +++ b/src/views/nodes/statusFileNode.ts @@ -8,7 +8,7 @@ import { GitUri } from '../../git/gitUri'; import { Strings } from '../../system'; import { View } from '../viewBase'; import { CommitFileNode } from './commitFileNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { DiffWithCommandArgs } from '../../commands/diffWith'; export class StatusFileNode extends ViewNode { @@ -71,7 +71,7 @@ export class StatusFileNode extends ViewNode { item.description = this.description; if ((this._hasStagedChanges || this._hasUnstagedChanges) && this.commits.length === 1) { - item.contextValue = ResourceType.File; + item.contextValue = ContextValues.File; if (this._hasStagedChanges) { item.contextValue += '+staged'; item.tooltip = StatusFileFormatter.fromTemplate( @@ -96,7 +96,7 @@ export class StatusFileNode extends ViewNode { } else { item.collapsibleState = TreeItemCollapsibleState.Collapsed; if (this._hasStagedChanges || this._hasUnstagedChanges) { - item.contextValue = ResourceType.File; + item.contextValue = ContextValues.File; if (this._hasStagedChanges && this._hasUnstagedChanges) { item.contextValue += '+staged+unstaged'; } else if (this._hasStagedChanges) { @@ -109,7 +109,7 @@ export class StatusFileNode extends ViewNode { item.resourceUri = GitUri.resolveToUri(this.file.fileName, this.repoPath); item.iconPath = ThemeIcon.File; } else { - item.contextValue = ResourceType.StatusFileCommits; + item.contextValue = ContextValues.StatusFileCommits; const icon = GitFile.getStatusIcon(this.file.status); item.iconPath = { diff --git a/src/views/nodes/statusFilesNode.ts b/src/views/nodes/statusFilesNode.ts index 2fb17dc..0f56d44 100644 --- a/src/views/nodes/statusFilesNode.ts +++ b/src/views/nodes/statusFilesNode.ts @@ -17,7 +17,7 @@ import { Arrays, Iterables, Objects, Strings } from '../../system'; import { RepositoriesView } from '../repositoriesView'; import { FileNode, FolderNode } from './folderNode'; import { StatusFileNode } from './statusFileNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class StatusFilesNode extends ViewNode { @@ -153,7 +153,7 @@ export class StatusFilesNode extends ViewNode { const label = `${Strings.pluralize('file', files)} changed`; const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.StatusFiles; + item.contextValue = ContextValues.StatusFiles; item.iconPath = { dark: Container.context.asAbsolutePath('images/dark/icon-diff.svg'), light: Container.context.asAbsolutePath('images/light/icon-diff.svg'), diff --git a/src/views/nodes/tagNode.ts b/src/views/nodes/tagNode.ts index c335a3d..2600374 100644 --- a/src/views/nodes/tagNode.ts +++ b/src/views/nodes/tagNode.ts @@ -9,7 +9,7 @@ import { RepositoriesView } from '../repositoriesView'; import { CommitNode } from './commitNode'; import { MessageNode, ShowMoreNode } from './common'; import { insertDateMarkers } from './helpers'; -import { PageableViewNode, ResourceType, ViewNode, ViewRefNode } from './viewNode'; +import { ContextValues, PageableViewNode, ViewNode, ViewRefNode } from './viewNode'; import { emojify } from '../../emojis'; import { RepositoryNode } from './repositoryNode'; import { GlyphChars } from '../../constants'; @@ -64,7 +64,7 @@ export class TagNode extends ViewRefNode impl getTreeItem(): TreeItem { const item = new TreeItem(this.label, TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Tag; + item.contextValue = ContextValues.Tag; item.description = `${GitRevision.shorten(this.tag.sha, { force: true })}${Strings.pad( GlyphChars.Dot, 2, diff --git a/src/views/nodes/tagsNode.ts b/src/views/nodes/tagsNode.ts index a962077..ba5be8d 100644 --- a/src/views/nodes/tagsNode.ts +++ b/src/views/nodes/tagsNode.ts @@ -8,7 +8,7 @@ import { RepositoriesView } from '../repositoriesView'; import { BranchOrTagFolderNode } from './branchOrTagFolderNode'; import { MessageNode } from './common'; import { TagNode } from './tagNode'; -import { ResourceType, ViewNode } from './viewNode'; +import { ContextValues, ViewNode } from './viewNode'; import { RepositoryNode } from './repositoryNode'; export class TagsNode extends ViewNode { @@ -56,7 +56,7 @@ export class TagsNode extends ViewNode { getTreeItem(): TreeItem { const item = new TreeItem('Tags', TreeItemCollapsibleState.Collapsed); item.id = this.id; - item.contextValue = ResourceType.Tags; + item.contextValue = ContextValues.Tags; item.iconPath = new ThemeIcon('tag'); return item; } diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index 34a8b5d..6aa88dc 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -6,7 +6,7 @@ import { Logger } from '../../logger'; import { debug, Functions, gate, logName } from '../../system'; import { TreeViewNodeStateChangeEvent, View } from '../viewBase'; -export enum ResourceType { +export enum ContextValues { ActiveFileHistory = 'gitlens:history:active:file', ActiveLineHistory = 'gitlens:history:active:line', Branch = 'gitlens:branch',