diff --git a/src/constants.ts b/src/constants.ts index 727ae4f..602cac6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -144,6 +144,7 @@ export enum GlyphChars { SpaceThinnest = '\u200A', SquareWithBottomShadow = '\u274F', SquareWithTopShadow = '\u2750', + Warning = '\u26a0', ZeroWidthSpace = '\u200b', } diff --git a/src/views/branchesView.ts b/src/views/branchesView.ts index 0c2e91a..563d74b 100644 --- a/src/views/branchesView.ts +++ b/src/views/branchesView.ts @@ -15,6 +15,7 @@ import { ViewFilesLayout, ViewShowBranchComparison, } from '../configuration'; +import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitBranchReference, @@ -34,7 +35,7 @@ import { unknownGitUri, ViewNode, } from './nodes'; -import { debug, gate } from '../system'; +import { debug, gate, Strings } from '../system'; import { ViewBase } from './viewBase'; export class BranchesRepositoryNode extends RepositoryFolderNode { @@ -85,6 +86,10 @@ export class BranchesViewNode extends ViewNode { if (this.children.length === 1) { const [child] = this.children; + if (!child.repo.supportsChangeEvents) { + this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`; + } + const branches = await child.repo.getBranches({ filter: b => !b.remote }); if (branches.length === 0) { this.view.message = 'No branches could be found.'; diff --git a/src/views/commitsView.ts b/src/views/commitsView.ts index b8a3ee8..de2d6be 100644 --- a/src/views/commitsView.ts +++ b/src/views/commitsView.ts @@ -86,10 +86,12 @@ export class CommitsRepositoryNode extends RepositoryFolderNode { const branch = await child.repo.getBranch(); if (branch != null) { - const lastFetched = (await child.repo?.getLastFetched()) ?? 0; + const lastFetched = (await child.repo.getLastFetched()) ?? 0; const status = branch.getTrackingStatus(); this.view.description = `${status ? `${status} ${GlyphChars.Dot} ` : ''}${branch.name}${ branch.rebasing ? ' (Rebasing)' : '' - }${lastFetched ? ` ${GlyphChars.Dot} Last fetched ${Repository.formatLastFetched(lastFetched)}` : ''}`; + }${lastFetched ? ` ${GlyphChars.Dot} Last fetched ${Repository.formatLastFetched(lastFetched)}` : ''}${ + child.repo.supportsChangeEvents + ? '' + : `${Strings.pad(GlyphChars.Warning, 3, 2)}Auto-refresh unavailable` + }`; } else { - this.view.description = undefined; + this.view.description = child.repo.supportsChangeEvents + ? undefined + : `${Strings.pad(GlyphChars.Warning, 1, 2)}Auto-refresh unavailable`; } return child.getChildren(); diff --git a/src/views/contributorsView.ts b/src/views/contributorsView.ts index 409c34f..f7ba585 100644 --- a/src/views/contributorsView.ts +++ b/src/views/contributorsView.ts @@ -2,11 +2,12 @@ import { commands, ConfigurationChangeEvent, Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode'; import { Avatars } from '../avatars'; import { configuration, ContributorsViewConfig, ViewFilesLayout } from '../configuration'; +import { GlyphChars } from '../constants'; import { Container } from '../container'; import { RepositoryChange, RepositoryChangeEvent } from '../git/git'; import { GitUri } from '../git/gitUri'; import { ContributorsNode, RepositoryFolderNode, unknownGitUri, ViewNode } from './nodes'; -import { debug, gate } from '../system'; +import { debug, gate, Strings } from '../system'; import { ViewBase } from './viewBase'; export class ContributorsRepositoryNode extends RepositoryFolderNode { @@ -64,6 +65,10 @@ export class ContributorsViewNode extends ViewNode { if (this.children.length === 1) { const [child] = this.children; + if (!child.repo.supportsChangeEvents) { + this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`; + } + const contributors = await child.repo.getContributors(); if (contributors.length === 0) { this.view.message = 'No contributors could be found.'; diff --git a/src/views/nodes/repositoryNode.ts b/src/views/nodes/repositoryNode.ts index 79b2c71..fd6346d 100644 --- a/src/views/nodes/repositoryNode.ts +++ b/src/views/nodes/repositoryNode.ts @@ -249,8 +249,10 @@ export class RepositoryNode extends SubscribeableViewNode { } if (!this.repo.supportsChangeEvents) { - description = `${description ? ` ${GlyphChars.Space}${description}` : ''}`; - tooltip += '\n\n Unable to automatically detect repository changes'; + description = `${Strings.pad(GlyphChars.Warning, 1, 0)}${ + description ? Strings.pad(description, 2, 0) : '' + }`; + tooltip += `\n\n${GlyphChars.Warning} Unable to automatically detect repository changes`; } const item = new TreeItem(label, TreeItemCollapsibleState.Expanded); diff --git a/src/views/nodes/viewNode.ts b/src/views/nodes/viewNode.ts index b8838d7..52c6a2a 100644 --- a/src/views/nodes/viewNode.ts +++ b/src/views/nodes/viewNode.ts @@ -1,5 +1,6 @@ 'use strict'; import { Command, Disposable, Event, TreeItem, TreeItemCollapsibleState, TreeViewVisibilityChangeEvent } from 'vscode'; +import { GlyphChars } from '../../constants'; import { Container } from '../../container'; import { GitFile, @@ -11,7 +12,7 @@ import { } from '../../git/git'; import { GitUri } from '../../git/gitUri'; import { Logger } from '../../logger'; -import { debug, Functions, gate, log, logName } from '../../system'; +import { debug, Functions, gate, log, logName, Strings } from '../../system'; import { TreeViewNodeCollapsibleStateChangeEvent, View } from '../viewBase'; export enum ContextValues { @@ -352,8 +353,13 @@ export abstract class RepositoryFolderNode< expand ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed, ); item.contextValue = `${ContextValues.RepositoryFolder}${this.repo.starred ? '+starred' : ''}`; + item.description = this.repo.supportsChangeEvents ? undefined : Strings.pad(GlyphChars.Warning, 1, 0); item.tooltip = `${ this.repo.formattedName ? `${this.repo.formattedName}\n${this.uri.repoPath}` : this.uri.repoPath ?? '' + }${ + this.repo.supportsChangeEvents + ? '' + : `\n\n${GlyphChars.Warning} Unable to automatically detect repository changes` }`; return item; diff --git a/src/views/remotesView.ts b/src/views/remotesView.ts index 2bf9bb4..1eed315 100644 --- a/src/views/remotesView.ts +++ b/src/views/remotesView.ts @@ -9,6 +9,7 @@ import { window, } from 'vscode'; import { configuration, RemotesViewConfig, ViewBranchesLayout, ViewFilesLayout } from '../configuration'; +import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitBranch, @@ -31,7 +32,7 @@ import { unknownGitUri, ViewNode, } from './nodes'; -import { debug, gate } from '../system'; +import { debug, gate, Strings } from '../system'; import { ViewBase } from './viewBase'; export class RemotesRepositoryNode extends RepositoryFolderNode { @@ -80,6 +81,10 @@ export class RemotesViewNode extends ViewNode { if (this.children.length === 1) { const [child] = this.children; + if (!child.repo.supportsChangeEvents) { + this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`; + } + const remotes = await child.repo.getRemotes(); if (remotes.length === 0) { this.view.message = 'No remotes could be found.'; diff --git a/src/views/stashesView.ts b/src/views/stashesView.ts index 5109e5a..9bbd41b 100644 --- a/src/views/stashesView.ts +++ b/src/views/stashesView.ts @@ -9,11 +9,12 @@ import { window, } from 'vscode'; import { configuration, StashesViewConfig, ViewFilesLayout } from '../configuration'; +import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitReference, GitStashReference, RepositoryChange, RepositoryChangeEvent } from '../git/git'; import { GitUri } from '../git/gitUri'; import { RepositoryFolderNode, RepositoryNode, StashesNode, StashNode, unknownGitUri, ViewNode } from './nodes'; -import { debug, gate } from '../system'; +import { debug, gate, Strings } from '../system'; import { ViewBase } from './viewBase'; export class StashesRepositoryNode extends RepositoryFolderNode { @@ -62,6 +63,10 @@ export class StashesViewNode extends ViewNode { if (this.children.length === 1) { const [child] = this.children; + if (!child.repo.supportsChangeEvents) { + this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`; + } + const stash = await child.repo.getStash(); if (stash == null) { this.view.message = 'No stashes could be found.'; diff --git a/src/views/tagsView.ts b/src/views/tagsView.ts index c8c902e..b04b84c 100644 --- a/src/views/tagsView.ts +++ b/src/views/tagsView.ts @@ -9,13 +9,20 @@ import { window, } from 'vscode'; import { configuration, TagsViewConfig, ViewBranchesLayout, ViewFilesLayout } from '../configuration'; +import { GlyphChars } from '../constants'; import { Container } from '../container'; import { GitReference, GitTagReference, RepositoryChange, RepositoryChangeEvent } from '../git/git'; import { GitUri } from '../git/gitUri'; -import { RepositoryFolderNode, RepositoryNode, TagsNode, unknownGitUri, ViewNode } from './nodes'; -import { debug, gate } from '../system'; +import { + BranchOrTagFolderNode, + RepositoryFolderNode, + RepositoryNode, + TagsNode, + unknownGitUri, + ViewNode, +} from './nodes'; +import { debug, gate, Strings } from '../system'; import { ViewBase } from './viewBase'; -import { BranchOrTagFolderNode } from './nodes/branchOrTagFolderNode'; export class TagsRepositoryNode extends RepositoryFolderNode { async getChildren(): Promise { @@ -63,6 +70,10 @@ export class TagsViewNode extends ViewNode { if (this.children.length === 1) { const [child] = this.children; + if (!child.repo.supportsChangeEvents) { + this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`; + } + const tags = await child.repo.getTags(); if (tags.length === 0) { this.view.message = 'No tags could be found.';