瀏覽代碼

Replaces enums with types

main
Eric Amodio 1 年之前
父節點
當前提交
b7b276796b
共有 14 個文件被更改,包括 126 次插入75 次删除
  1. +7
    -7
      src/annotations/annotations.ts
  2. +7
    -7
      src/annotations/fileAnnotationController.ts
  3. +38
    -17
      src/constants.ts
  4. +8
    -5
      src/git/models/issue.ts
  5. +13
    -4
      src/git/models/pullRequest.ts
  6. +4
    -1
      src/plus/subscription/subscriptionService.ts
  7. +4
    -3
      src/views/nodes/branchNode.ts
  8. +10
    -4
      src/views/nodes/branchTrackingStatusNode.ts
  9. +3
    -2
      src/views/nodes/commitNode.ts
  10. +3
    -2
      src/views/nodes/fileRevisionAsCommitNode.ts
  11. +3
    -2
      src/views/nodes/mergeStatusNode.ts
  12. +3
    -2
      src/views/nodes/rebaseStatusNode.ts
  13. +19
    -18
      src/views/viewDecorationProvider.ts
  14. +4
    -1
      src/views/worktreesView.ts

+ 7
- 7
src/annotations/annotations.ts 查看文件

@ -9,8 +9,8 @@ import type {
import { OverviewRulerLane, ThemeColor, Uri, window } from 'vscode';
import type { Config } from '../config';
import { HeatmapLocations } from '../config';
import type { CoreConfiguration } from '../constants';
import { Colors, GlyphChars } from '../constants';
import type { Colors, CoreConfiguration } from '../constants';
import { GlyphChars } from '../constants';
import type { CommitFormatOptions } from '../git/formatters/commitFormatter';
import { CommitFormatter } from '../git/formatters/commitFormatter';
import type { GitCommit } from '../git/models/commit';
@ -202,10 +202,10 @@ export function getGutterRenderOptions(
}
return {
backgroundColor: new ThemeColor(Colors.GutterBackgroundColor),
backgroundColor: new ThemeColor('gitlens.gutterBackgroundColor' satisfies Colors),
borderStyle: borderStyle,
borderWidth: borderWidth,
color: new ThemeColor(Colors.GutterForegroundColor),
color: new ThemeColor('gitlens.gutterForegroundColor' satisfies Colors),
fontWeight: 'normal',
fontStyle: 'normal',
height: '100%',
@ -214,7 +214,7 @@ export function getGutterRenderOptions(
avatars ? ';padding: 0 0 0 18px' : ''
}`,
width: width,
uncommittedColor: new ThemeColor(Colors.GutterUncommittedForegroundColor),
uncommittedColor: new ThemeColor('gitlens.gutterUncommittedForegroundColor' satisfies Colors),
};
}
@ -241,8 +241,8 @@ export function getInlineDecoration(
return {
renderOptions: {
after: {
backgroundColor: new ThemeColor(Colors.TrailingLineBackgroundColor),
color: new ThemeColor(Colors.TrailingLineForegroundColor),
backgroundColor: new ThemeColor('gitlens.trailingLineBackgroundColor' satisfies Colors),
color: new ThemeColor('gitlens.trailingLineForegroundColor' satisfies Colors),
contentText: pad(message.replace(/ /g, GlyphChars.Space), 1, 1),
fontWeight: 'normal',
fontStyle: 'normal',

+ 7
- 7
src/annotations/fileAnnotationController.ts 查看文件

@ -21,7 +21,7 @@ import {
workspace,
} from 'vscode';
import { AnnotationsToggleMode, BlameHighlightLocations, ChangesLocations, FileAnnotationType } from '../config';
import { Colors } from '../constants';
import type { Colors, CoreColors } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { configuration } from '../system/configuration';
@ -591,7 +591,7 @@ export class FileAnnotationController implements Disposable {
gutterIconSize: 'contain',
overviewRulerLane: OverviewRulerLane.Left,
overviewRulerColor: locations.includes(ChangesLocations.Scrollbar)
? new ThemeColor('editorOverviewRuler.addedForeground')
? new ThemeColor('editorOverviewRuler.addedForeground' satisfies CoreColors)
: undefined,
});
@ -612,7 +612,7 @@ export class FileAnnotationController implements Disposable {
gutterIconSize: 'contain',
overviewRulerLane: OverviewRulerLane.Left,
overviewRulerColor: locations.includes(ChangesLocations.Scrollbar)
? new ThemeColor('editorOverviewRuler.modifiedForeground')
? new ThemeColor('editorOverviewRuler.modifiedForeground' satisfies CoreColors)
: undefined,
});
@ -629,7 +629,7 @@ export class FileAnnotationController implements Disposable {
gutterIconSize: 'contain',
overviewRulerLane: OverviewRulerLane.Left,
overviewRulerColor: locations.includes(ChangesLocations.Scrollbar)
? new ThemeColor('editorOverviewRuler.deletedForeground')
? new ThemeColor('editorOverviewRuler.deletedForeground' satisfies CoreColors)
: undefined,
});
}
@ -643,7 +643,7 @@ export class FileAnnotationController implements Disposable {
const { locations } = highlight;
// TODO@eamodio: Read from the theme color when the API exists
const gutterHighlightColor = '#00bcf2'; // new ThemeColor(Colors.LineHighlightOverviewRulerColor)
const gutterHighlightColor = '#00bcf2'; // new ThemeColor('gitlens.lineHighlightOverviewRulerColor' satisfies Colors)
const gutterHighlightUri = locations.includes(BlameHighlightLocations.Gutter)
? Uri.parse(
`data:image/svg+xml,${encodeURIComponent(
@ -658,10 +658,10 @@ export class FileAnnotationController implements Disposable {
isWholeLine: true,
overviewRulerLane: OverviewRulerLane.Right,
backgroundColor: locations.includes(BlameHighlightLocations.Line)
? new ThemeColor(Colors.LineHighlightBackgroundColor)
? new ThemeColor('gitlens.lineHighlightBackgroundColor' satisfies Colors)
: undefined,
overviewRulerColor: locations.includes(BlameHighlightLocations.Scrollbar)
? new ThemeColor(Colors.LineHighlightOverviewRulerColor)
? new ThemeColor('gitlens.lineHighlightOverviewRulerColor' satisfies Colors)
: undefined,
});
}

+ 38
- 17
src/constants.ts 查看文件

@ -55,23 +55,44 @@ export const enum CharCode {
z = 122,
}
export const enum Colors {
GutterBackgroundColor = 'gitlens.gutterBackgroundColor',
GutterForegroundColor = 'gitlens.gutterForegroundColor',
GutterUncommittedForegroundColor = 'gitlens.gutterUncommittedForegroundColor',
TrailingLineBackgroundColor = 'gitlens.trailingLineBackgroundColor',
TrailingLineForegroundColor = 'gitlens.trailingLineForegroundColor',
LineHighlightBackgroundColor = 'gitlens.lineHighlightBackgroundColor',
LineHighlightOverviewRulerColor = 'gitlens.lineHighlightOverviewRulerColor',
ClosedAutolinkedIssueIconColor = 'gitlens.closedAutolinkedIssueIconColor',
ClosedPullRequestIconColor = 'gitlens.closedPullRequestIconColor',
OpenAutolinkedIssueIconColor = 'gitlens.openAutolinkedIssueIconColor',
OpenPullRequestIconColor = 'gitlens.openPullRequestIconColor',
MergedPullRequestIconColor = 'gitlens.mergedPullRequestIconColor',
UnpublishedChangesIconColor = 'gitlens.unpublishedChangesIconColor',
UnpublishedCommitIconColor = 'gitlens.unpublishedCommitIconColor',
UnpulledChangesIconColor = 'gitlens.unpulledChangesIconColor',
}
export type Colors =
| 'gitlens.closedAutolinkedIssueIconColor'
| 'gitlens.closedPullRequestIconColor'
| 'gitlens.decorations.addedForegroundColor'
| 'gitlens.decorations.branchAheadForegroundColor'
| 'gitlens.decorations.branchBehindForegroundColor'
| 'gitlens.decorations.branchDivergedForegroundColor'
| 'gitlens.decorations.branchMissingUpstreamForegroundColor'
| 'gitlens.decorations.branchUpToDateForegroundColor'
| 'gitlens.decorations.branchUnpublishedForegroundColor'
| 'gitlens.decorations.copiedForegroundColor'
| 'gitlens.decorations.deletedForegroundColor'
| 'gitlens.decorations.ignoredForegroundColor'
| 'gitlens.decorations.modifiedForegroundColor'
| 'gitlens.decorations.renamedForegroundColor'
| 'gitlens.decorations.untrackedForegroundColor'
| 'gitlens.decorations.worktreeView.hasUncommittedChangesForegroundColor'
| 'gitlens.gutterBackgroundColor'
| 'gitlens.gutterForegroundColor'
| 'gitlens.gutterUncommittedForegroundColor'
| 'gitlens.lineHighlightBackgroundColor'
| 'gitlens.lineHighlightOverviewRulerColor'
| 'gitlens.mergedPullRequestIconColor'
| 'gitlens.openAutolinkedIssueIconColor'
| 'gitlens.openPullRequestIconColor'
| 'gitlens.trailingLineBackgroundColor'
| 'gitlens.trailingLineForegroundColor'
| 'gitlens.unpublishedChangesIconColor'
| 'gitlens.unpublishedCommitIconColor'
| 'gitlens.unpulledChangesIconColor';
export type CoreColors =
| 'editorOverviewRuler.addedForeground'
| 'editorOverviewRuler.deletedForeground'
| 'editorOverviewRuler.modifiedForeground'
| 'list.foreground'
| 'list.warningForeground'
| 'statusBarItem.warningBackground';
export const enum Commands {
ActionPrefix = 'gitlens.action.',

+ 8
- 5
src/git/models/issue.ts 查看文件

@ -1,5 +1,5 @@
import { ColorThemeKind, ThemeColor, ThemeIcon, window } from 'vscode';
import { Colors } from '../../constants';
import type { Colors } from '../../constants';
import type { RemoteProviderReference } from './remoteProvider';
export const enum IssueOrPullRequestType {
@ -115,15 +115,18 @@ export function getIssueOrPullRequestMarkdownIcon(issue: IssueOrPullRequest): st
export function getIssueOrPullRequestThemeIcon(issue: IssueOrPullRequest): ThemeIcon {
if (issue.type === IssueOrPullRequestType.PullRequest) {
if (issue.closed) {
return new ThemeIcon('git-pull-request', new ThemeColor(Colors.MergedPullRequestIconColor));
return new ThemeIcon(
'git-pull-request',
new ThemeColor('gitlens.mergedPullRequestIconColor' satisfies Colors),
);
}
return new ThemeIcon('git-pull-request', new ThemeColor(Colors.OpenPullRequestIconColor));
return new ThemeIcon('git-pull-request', new ThemeColor('gitlens.openPullRequestIconColor' satisfies Colors));
}
if (issue.closed) {
return new ThemeIcon('pass', new ThemeColor(Colors.ClosedAutolinkedIssueIconColor));
return new ThemeIcon('pass', new ThemeColor('gitlens.closedAutolinkedIssueIconColor' satisfies Colors));
}
return new ThemeIcon('issues', new ThemeColor(Colors.OpenAutolinkedIssueIconColor));
return new ThemeIcon('issues', new ThemeColor('gitlens.openAutolinkedIssueIconColor' satisfies Colors));
}
export function serializeIssue(value: IssueShape): IssueShape {

+ 13
- 4
src/git/models/pullRequest.ts 查看文件

@ -1,6 +1,6 @@
import { ColorThemeKind, ThemeColor, ThemeIcon, window } from 'vscode';
import { DateStyle } from '../../config';
import { Colors } from '../../constants';
import type { Colors } from '../../constants';
import { Container } from '../../container';
import { formatDate, fromNow } from '../../system/date';
import { memoize } from '../../system/decorators/memoize';
@ -154,11 +154,20 @@ export class PullRequest implements PullRequestShape {
static getThemeIcon(pullRequest: PullRequest): ThemeIcon {
switch (pullRequest.state) {
case PullRequestState.Open:
return new ThemeIcon('git-pull-request', new ThemeColor(Colors.OpenPullRequestIconColor));
return new ThemeIcon(
'git-pull-request',
new ThemeColor('gitlens.openPullRequestIconColor' satisfies Colors),
);
case PullRequestState.Closed:
return new ThemeIcon('git-pull-request-closed', new ThemeColor(Colors.ClosedPullRequestIconColor));
return new ThemeIcon(
'git-pull-request-closed',
new ThemeColor('gitlens.closedPullRequestIconColor' satisfies Colors),
);
case PullRequestState.Merged:
return new ThemeIcon('git-merge', new ThemeColor(Colors.MergedPullRequestIconColor));
return new ThemeIcon(
'git-merge',
new ThemeColor('gitlens.mergedPullRequestIconColor' satisfies Colors),
);
default:
return new ThemeIcon('git-pull-request');
}

+ 4
- 1
src/plus/subscription/subscriptionService.ts 查看文件

@ -22,6 +22,7 @@ import {
} from 'vscode';
import { fetch, getProxyAgent } from '@env/fetch';
import { getPlatform } from '@env/platform';
import type { CoreColors } from '../../constants';
import { Commands } from '../../constants';
import type { Container } from '../../container';
import { setContext } from '../../context';
@ -1040,7 +1041,9 @@ export class SubscriptionService implements Disposable {
if (account?.verified === false) {
this._statusBarSubscription.text = `$(warning) ${effective.name} (Unverified)`;
this._statusBarSubscription.backgroundColor = new ThemeColor('statusBarItem.warningBackground');
this._statusBarSubscription.backgroundColor = new ThemeColor(
'statusBarItem.warningBackground' satisfies CoreColors,
);
this._statusBarSubscription.tooltip = new MarkdownString(
trial
? `**Please verify your email**\n\nBefore you can start your **${effective.name}** trial, please verify your email address.\n\nClick for details`

+ 4
- 3
src/views/nodes/branchNode.ts 查看文件

@ -1,7 +1,8 @@
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
import type { ViewShowBranchComparison } from '../../config';
import { ViewBranchesLayout } from '../../config';
import { Colors, GlyphChars } from '../../constants';
import type { Colors} from '../../constants';
import { GlyphChars } from '../../constants';
import { getContext } from '../../context';
import type { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
@ -426,12 +427,12 @@ export class BranchNode
if (this.branch.state.ahead || this.branch.state.behind) {
if (this.branch.state.ahead) {
contextValue += '+ahead';
color = new ThemeColor(Colors.UnpublishedChangesIconColor);
color = new ThemeColor('gitlens.unpublishedChangesIconColor' satisfies Colors);
iconSuffix = '-green';
}
if (this.branch.state.behind) {
contextValue += '+behind';
color = new ThemeColor(Colors.UnpulledChangesIconColor);
color = new ThemeColor('gitlens.unpulledChangesIconColor' satisfies Colors);
iconSuffix = this.branch.state.ahead ? '-yellow' : '-red';
}
}

+ 10
- 4
src/views/nodes/branchTrackingStatusNode.ts 查看文件

@ -1,5 +1,5 @@
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { Colors } from '../../constants';
import type { Colors } from '../../constants';
import { GitUri } from '../../git/gitUri';
import type { GitBranch, GitTrackingState } from '../../git/models/branch';
import { getRemoteNameFromBranchName } from '../../git/models/branch';
@ -182,7 +182,10 @@ export class BranchTrackingStatusNode extends ViewNode impleme
contextValue = this.root
? ContextValues.StatusAheadOfUpstream
: ContextValues.BranchStatusAheadOfUpstream;
icon = new ThemeIcon('cloud-upload', new ThemeColor(Colors.UnpublishedChangesIconColor));
icon = new ThemeIcon(
'cloud-upload',
new ThemeColor('gitlens.unpublishedChangesIconColor' satisfies Colors),
);
break;
}
@ -203,7 +206,10 @@ export class BranchTrackingStatusNode extends ViewNode impleme
contextValue = this.root
? ContextValues.StatusBehindUpstream
: ContextValues.BranchStatusBehindUpstream;
icon = new ThemeIcon('cloud-download', new ThemeColor(Colors.UnpulledChangesIconColor));
icon = new ThemeIcon(
'cloud-download',
new ThemeColor('gitlens.unpulledChangesIconColor' satisfies Colors),
);
break;
}
@ -240,7 +246,7 @@ export class BranchTrackingStatusNode extends ViewNode impleme
contextValue = this.root ? ContextValues.StatusNoUpstream : ContextValues.BranchStatusNoUpstream;
icon = new ThemeIcon(
'cloud-upload',
remotes.length ? new ThemeColor(Colors.UnpublishedChangesIconColor) : undefined,
remotes.length ? new ThemeColor('gitlens.unpublishedChangesIconColor' satisfies Colors) : undefined,
);
break;

+ 3
- 2
src/views/nodes/commitNode.ts 查看文件

@ -2,7 +2,8 @@ import type { Command } from 'vscode';
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { DiffWithPreviousCommandArgs } from '../../commands';
import { ViewFilesLayout } from '../../config';
import { Colors, Commands } from '../../constants';
import type { Colors} from '../../constants';
import { Commands } from '../../constants';
import { getContext } from '../../context';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import type { GitBranch } from '../../git/models/branch';
@ -176,7 +177,7 @@ export class CommitNode extends ViewRefNode
pendingPullRequest != null
? new ThemeIcon('loading~spin')
: this.unpublished
? new ThemeIcon('arrow-up', new ThemeColor(Colors.UnpublishedCommitIconColor))
? new ThemeIcon('arrow-up', new ThemeColor('gitlens.unpublishedCommitIconColor' satisfies Colors))
: this.view.config.avatars
? await this.commit.getAvatarUri({ defaultStyle: configuration.get('defaultGravatarsStyle') })
: new ThemeIcon('git-commit');

+ 3
- 2
src/views/nodes/fileRevisionAsCommitNode.ts 查看文件

@ -1,7 +1,8 @@
import type { Command, Selection } from 'vscode';
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import type { DiffWithPreviousCommandArgs } from '../../commands';
import { Colors, Commands } from '../../constants';
import type { Colors } from '../../constants';
import { Commands } from '../../constants';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import { StatusFileFormatter } from '../../git/formatters/statusFormatter';
import { GitUri } from '../../git/gitUri';
@ -107,7 +108,7 @@ export class FileRevisionAsCommitNode extends ViewRefFileNode
if (!this.commit.isUncommitted && this.view.config.avatars) {
item.iconPath = this._options.unpublished
? new ThemeIcon('arrow-up', new ThemeColor(Colors.UnpublishedCommitIconColor))
? new ThemeIcon('arrow-up', new ThemeColor('gitlens.unpublishedCommitIconColor' satisfies Colors))
: await this.commit.getAvatarUri({ defaultStyle: configuration.get('defaultGravatarsStyle') });
}

+ 3
- 2
src/views/nodes/mergeStatusNode.ts 查看文件

@ -1,5 +1,6 @@
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ViewFilesLayout } from '../../config';
import type { CoreColors } from '../../constants';
import { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
import type { GitMergeStatus } from '../../git/models/merge';
@ -78,8 +79,8 @@ export class MergeStatusNode extends ViewNode {
item.contextValue = ContextValues.Merge;
item.description = this.status?.hasConflicts ? pluralize('conflict', this.status.conflicts.length) : undefined;
item.iconPath = this.status?.hasConflicts
? new ThemeIcon('warning', new ThemeColor('list.warningForeground'))
: new ThemeIcon('debug-pause', new ThemeColor('list.foreground'));
? new ThemeIcon('warning', new ThemeColor('list.warningForeground' satisfies CoreColors))
: new ThemeIcon('debug-pause', new ThemeColor('list.foreground' satisfies CoreColors));
const markdown = new MarkdownString(
`${`Merging ${

+ 3
- 2
src/views/nodes/rebaseStatusNode.ts 查看文件

@ -2,6 +2,7 @@ import type { Command } from 'vscode';
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import type { DiffWithPreviousCommandArgs } from '../../commands';
import { ViewFilesLayout } from '../../config';
import type { CoreColors } from '../../constants';
import { Commands } from '../../constants';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import { GitUri } from '../../git/gitUri';
@ -93,8 +94,8 @@ export class RebaseStatusNode extends ViewNode {
item.contextValue = ContextValues.Rebase;
item.description = this.status?.hasConflicts ? pluralize('conflict', this.status.conflicts.length) : undefined;
item.iconPath = this.status?.hasConflicts
? new ThemeIcon('warning', new ThemeColor('list.warningForeground'))
: new ThemeIcon('debug-pause', new ThemeColor('list.foreground'));
? new ThemeIcon('warning', new ThemeColor('list.warningForeground' satisfies CoreColors))
: new ThemeIcon('debug-pause', new ThemeColor('list.foreground' satisfies CoreColors));
const markdown = new MarkdownString(
`${`Rebasing ${

+ 19
- 18
src/views/viewDecorationProvider.ts 查看文件

@ -1,5 +1,6 @@
import type { CancellationToken, Event, FileDecoration, FileDecorationProvider, Uri } from 'vscode';
import { Disposable, EventEmitter, ThemeColor, window } from 'vscode';
import type { Colors } from '../constants';
import { GlyphChars } from '../constants';
import { GitBranchStatus } from '../git/models/branch';
@ -56,43 +57,43 @@ export class ViewFileDecorationProvider implements FileDecorationProvider, Dispo
case '!':
return {
badge: 'I',
color: new ThemeColor('gitlens.decorations.ignoredForegroundColor'),
color: new ThemeColor('gitlens.decorations.ignoredForegroundColor' satisfies Colors),
tooltip: 'Ignored',
};
case '?':
return {
badge: 'U',
color: new ThemeColor('gitlens.decorations.untrackedForegroundColor'),
color: new ThemeColor('gitlens.decorations.untrackedForegroundColor' satisfies Colors),
tooltip: 'Untracked',
};
case 'A':
return {
badge: 'A',
color: new ThemeColor('gitlens.decorations.addedForegroundColor'),
color: new ThemeColor('gitlens.decorations.addedForegroundColor' satisfies Colors),
tooltip: 'Added',
};
case 'C':
return {
badge: 'C',
color: new ThemeColor('gitlens.decorations.copiedForegroundColor'),
color: new ThemeColor('gitlens.decorations.copiedForegroundColor' satisfies Colors),
tooltip: 'Copied',
};
case 'D':
return {
badge: 'D',
color: new ThemeColor('gitlens.decorations.deletedForegroundColor'),
color: new ThemeColor('gitlens.decorations.deletedForegroundColor' satisfies Colors),
tooltip: 'Deleted',
};
case 'M':
return {
badge: 'M',
// color: new ThemeColor('gitlens.decorations.modifiedForegroundColor'),
// color: new ThemeColor('gitlens.decorations.modifiedForegroundColor' satisfies Colors),
tooltip: 'Modified',
};
case 'R':
return {
badge: 'R',
color: new ThemeColor('gitlens.decorations.renamedForegroundColor'),
color: new ThemeColor('gitlens.decorations.renamedForegroundColor' satisfies Colors),
tooltip: 'Renamed',
};
default:
@ -107,37 +108,37 @@ export class ViewFileDecorationProvider implements FileDecorationProvider, Dispo
case GitBranchStatus.Ahead:
return {
badge: '▲',
color: new ThemeColor('gitlens.decorations.branchAheadForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchAheadForegroundColor' satisfies Colors),
tooltip: 'Ahead',
};
case GitBranchStatus.Behind:
return {
badge: '▼',
color: new ThemeColor('gitlens.decorations.branchBehindForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchBehindForegroundColor' satisfies Colors),
tooltip: 'Behind',
};
case GitBranchStatus.Diverged:
return {
badge: '▼▲',
color: new ThemeColor('gitlens.decorations.branchDivergedForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchDivergedForegroundColor' satisfies Colors),
tooltip: 'Diverged',
};
case GitBranchStatus.MissingUpstream:
return {
badge: '!',
color: new ThemeColor('gitlens.decorations.branchMissingUpstreamForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchMissingUpstreamForegroundColor' satisfies Colors),
tooltip: 'Missing Upstream',
};
case GitBranchStatus.UpToDate:
return {
badge: '',
color: new ThemeColor('gitlens.decorations.branchUpToDateForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchUpToDateForegroundColor' satisfies Colors),
tooltip: 'Up to Date',
};
case GitBranchStatus.Unpublished:
return {
badge: '▲+',
color: new ThemeColor('gitlens.decorations.branchUnpublishedForegroundColor'),
color: new ThemeColor('gitlens.decorations.branchUnpublishedForegroundColor' satisfies Colors),
tooltip: 'Unpublished',
};
default:
@ -153,19 +154,19 @@ export class ViewFileDecorationProvider implements FileDecorationProvider, Dispo
let color;
switch (status as GitBranchStatus) {
case GitBranchStatus.Ahead:
color = new ThemeColor('gitlens.decorations.branchAheadForegroundColor');
color = new ThemeColor('gitlens.decorations.branchAheadForegroundColor' satisfies Colors);
break;
case GitBranchStatus.Behind:
color = new ThemeColor('gitlens.decorations.branchBehindForegroundColor');
color = new ThemeColor('gitlens.decorations.branchBehindForegroundColor' satisfies Colors);
break;
case GitBranchStatus.Diverged:
color = new ThemeColor('gitlens.decorations.branchDivergedForegroundColor');
color = new ThemeColor('gitlens.decorations.branchDivergedForegroundColor' satisfies Colors);
break;
case GitBranchStatus.UpToDate:
color = new ThemeColor('gitlens.decorations.branchUpToDateForegroundColor');
color = new ThemeColor('gitlens.decorations.branchUpToDateForegroundColor' satisfies Colors);
break;
case GitBranchStatus.Unpublished:
color = new ThemeColor('gitlens.decorations.branchUnpublishedForegroundColor');
color = new ThemeColor('gitlens.decorations.branchUnpublishedForegroundColor' satisfies Colors);
break;
}

+ 4
- 1
src/views/worktreesView.ts 查看文件

@ -2,6 +2,7 @@ import type { CancellationToken, ConfigurationChangeEvent, Disposable, TreeViewV
import { ProgressLocation, ThemeColor, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import type { WorktreesViewConfig } from '../config';
import { ViewFilesLayout, ViewShowBranchComparison } from '../config';
import type { Colors} from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { PlusFeatures } from '../features';
@ -112,7 +113,9 @@ export class WorktreesView extends ViewBase
return {
badge: '●',
color: new ThemeColor('gitlens.decorations.worktreeView.hasUncommittedChangesForegroundColoSr'),
color: new ThemeColor(
'gitlens.decorations.worktreeView.hasUncommittedChangesForegroundColor' as Colors,
),
tooltip: 'Has Uncommitted Changes',
};
},

Loading…
取消
儲存