Skip to content

Commit 620e39d

Browse files
committed
Removes GlCommand enum (finally)
1 parent 65f366a commit 620e39d

File tree

93 files changed

+512
-713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+512
-713
lines changed

src/codelens/codeLensProvider.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import type { CodeLensConfig, CodeLensLanguageScope } from '../config';
2121
import { CodeLensCommand } from '../config';
2222
import { trackableSchemes } from '../constants';
2323
import type { GlCommands } from '../constants.commands';
24-
import { GlCommand } from '../constants.commands';
2524
import type { Container } from '../container';
2625
import type { GitUri } from '../git/gitUri';
2726
import type { GitBlame } from '../git/models/blame';
@@ -617,7 +616,7 @@ function applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAut
617616
commit: GitCommit | undefined,
618617
): T {
619618
lens.command = createCommand<[undefined, DiffWithPreviousCommandArgs]>(
620-
GlCommand.DiffWithPrevious,
619+
'gitlens.diffWithPrevious',
621620
title,
622621
undefined,
623622
{
@@ -634,7 +633,7 @@ function applyCopyOrOpenCommitOnRemoteCommand<T extends GitRecentChangeCodeLens
634633
commit: GitCommit,
635634
clipboard: boolean = false,
636635
): T {
637-
lens.command = createCommand<[OpenOnRemoteCommandArgs]>(GlCommand.OpenOnRemote, title, {
636+
lens.command = createCommand<[OpenOnRemoteCommandArgs]>('gitlens.openOnRemote', title, {
638637
resource: {
639638
type: RemoteResourceType.Commit,
640639
sha: commit.sha,
@@ -651,7 +650,7 @@ function applyCopyOrOpenFileOnRemoteCommand<T extends GitRecentChangeCodeLens |
651650
commit: GitCommit,
652651
clipboard: boolean = false,
653652
): T {
654-
lens.command = createCommand<[OpenOnRemoteCommandArgs]>(GlCommand.OpenOnRemote, title, {
653+
lens.command = createCommand<[OpenOnRemoteCommandArgs]>('gitlens.openOnRemote', title, {
655654
resource: {
656655
type: RemoteResourceType.Revision,
657656
fileName: commit.file?.path ?? '',
@@ -694,7 +693,7 @@ function applyShowCommitsInViewCommand<T extends GitRecentChangeCodeLens | GitAu
694693
}
695694

696695
lens.command = createCommand<[ShowCommitsInViewCommandArgs]>(
697-
refs.length === 0 ? ('' as GlCommands) : GlCommand.ShowCommitsInView,
696+
refs.length === 0 ? ('' as GlCommands) : 'gitlens.showCommitsInView',
698697
title,
699698
{
700699
repoPath: blame.repoPath,

src/commands/browseRepoAtRevision.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { TextEditor, Uri } from 'vscode';
2-
import { GlCommand } from '../constants.commands';
32
import type { Container } from '../container';
43
import { GitUri } from '../git/gitUri';
54
import { showGenericErrorMessage } from '../messages';
@@ -22,22 +21,22 @@ export interface BrowseRepoAtRevisionCommandArgs {
2221
export class BrowseRepoAtRevisionCommand extends ActiveEditorCommand {
2322
constructor(private readonly container: Container) {
2423
super([
25-
GlCommand.BrowseRepoAtRevision,
26-
GlCommand.BrowseRepoAtRevisionInNewWindow,
27-
GlCommand.BrowseRepoBeforeRevision,
28-
GlCommand.BrowseRepoBeforeRevisionInNewWindow,
24+
'gitlens.browseRepoAtRevision',
25+
'gitlens.browseRepoAtRevisionInNewWindow',
26+
'gitlens.browseRepoBeforeRevision',
27+
'gitlens.browseRepoBeforeRevisionInNewWindow',
2928
]);
3029
}
3130

3231
protected override preExecute(context: CommandContext, args?: BrowseRepoAtRevisionCommandArgs): Promise<void> {
3332
switch (context.command) {
34-
case GlCommand.BrowseRepoAtRevisionInNewWindow:
33+
case 'gitlens.browseRepoAtRevisionInNewWindow':
3534
args = { ...args, before: false, openInNewWindow: true };
3635
break;
37-
case GlCommand.BrowseRepoBeforeRevision:
36+
case 'gitlens.browseRepoBeforeRevision':
3837
args = { ...args, before: true, openInNewWindow: false };
3938
break;
40-
case GlCommand.BrowseRepoBeforeRevisionInNewWindow:
39+
case 'gitlens.browseRepoBeforeRevisionInNewWindow':
4140
args = { ...args, before: true, openInNewWindow: true };
4241
break;
4342
}

src/commands/compareWith.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { TextEditor, Uri } from 'vscode';
2-
import { GlCommand } from '../constants.commands';
32
import type { Container } from '../container';
43
import { showGenericErrorMessage } from '../messages';
54
import { getBestRepositoryOrShowPicker } from '../quickpicks/repositoryPicker';
@@ -18,24 +17,24 @@ export interface CompareWithCommandArgs {
1817
export class CompareWithCommand extends ActiveEditorCommand {
1918
constructor(private readonly container: Container) {
2019
super(
21-
[GlCommand.CompareWith, GlCommand.CompareHeadWith, GlCommand.CompareWorkingWith],
20+
['gitlens.compareWith', 'gitlens.compareHeadWith', 'gitlens.compareWorkingWith'],
2221
['gitlens.diffHeadWith', 'gitlens.diffWorkingWith'],
2322
);
2423
}
2524

2625
protected override preExecute(context: CommandContext, args?: CompareWithCommandArgs): Promise<void> {
2726
switch (context.command) {
28-
case GlCommand.CompareWith:
27+
case 'gitlens.compareWith':
2928
args = { ...args };
3029
break;
3130

32-
case GlCommand.CompareHeadWith:
31+
case 'gitlens.compareHeadWith':
3332
case /** @deprecated */ 'gitlens.diffHeadWith':
3433
args = { ...args };
3534
args.ref1 = 'HEAD';
3635
break;
3736

38-
case GlCommand.CompareWorkingWith:
37+
case 'gitlens.compareWorkingWith':
3938
case /** @deprecated */ 'gitlens.diffWorkingWith':
4039
args = { ...args };
4140
args.ref1 = '';

src/commands/copyMessageToClipboard.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { TextEditor, Uri } from 'vscode';
22
import { env } from 'vscode';
3-
import { GlCommand } from '../constants.commands';
43
import type { Container } from '../container';
54
import { copyMessageToClipboard } from '../git/actions/commit';
65
import { GitUri } from '../git/gitUri';
@@ -26,7 +25,7 @@ export interface CopyMessageToClipboardCommandArgs {
2625
@command()
2726
export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
2827
constructor(private readonly container: Container) {
29-
super(GlCommand.CopyMessageToClipboard);
28+
super('gitlens.copyMessageToClipboard');
3029
}
3130

3231
protected override async preExecute(

src/commands/copyShaToClipboard.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { TextEditor, Uri } from 'vscode';
22
import { env } from 'vscode';
3-
import { GlCommand } from '../constants.commands';
43
import type { Container } from '../container';
54
import { GitUri } from '../git/gitUri';
65
import { shortenRevision } from '../git/utils/revision.utils';
@@ -25,7 +24,7 @@ export interface CopyShaToClipboardCommandArgs {
2524
@command()
2625
export class CopyShaToClipboardCommand extends ActiveEditorCommand {
2726
constructor(private readonly container: Container) {
28-
super(GlCommand.CopyShaToClipboard);
27+
super('gitlens.copyShaToClipboard');
2928
}
3029

3130
protected override preExecute(context: CommandContext, args?: CopyShaToClipboardCommandArgs): Promise<void> {

src/commands/createPullRequestOnRemote.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { window } from 'vscode';
2-
import { GlCommand } from '../constants.commands';
32
import type { Container } from '../container';
43
import type { GitRemote } from '../git/models/remote';
54
import type { RemoteResource } from '../git/models/remoteResource';
@@ -23,7 +22,7 @@ export interface CreatePullRequestOnRemoteCommandArgs {
2322
@command()
2423
export class CreatePullRequestOnRemoteCommand extends GlCommandBase {
2524
constructor(private readonly container: Container) {
26-
super(GlCommand.CreatePullRequestOnRemote);
25+
super('gitlens.createPullRequestOnRemote');
2726
}
2827

2928
async execute(args?: CreatePullRequestOnRemoteCommandArgs): Promise<void> {
@@ -77,7 +76,7 @@ export class CreatePullRequestOnRemoteCommand extends GlCommandBase {
7776
},
7877
};
7978

80-
void (await executeCommand<OpenOnRemoteCommandArgs>(GlCommand.OpenOnRemote, {
79+
void (await executeCommand<OpenOnRemoteCommandArgs>('gitlens.openOnRemote', {
8180
resource: resource,
8281
remotes: remotes,
8382
}));

src/commands/diffFolderWithRevision.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { TextDocumentShowOptions, TextEditor } from 'vscode';
22
import { FileType, Uri, workspace } from 'vscode';
33
import { GlyphChars } from '../constants';
4-
import { GlCommand } from '../constants.commands';
54
import type { Container } from '../container';
65
import { openFolderCompare } from '../git/actions/commit';
76
import { GitUri } from '../git/gitUri';
@@ -15,6 +14,7 @@ import { Logger } from '../system/logger';
1514
import { pad } from '../system/string';
1615
import { ActiveEditorCommand } from './commandBase';
1716
import { getCommandUri } from './commandBase.utils';
17+
import type { DiffFolderWithRevisionFromCommandArgs } from './diffFolderWithRevisionFrom';
1818

1919
export interface DiffFolderWithRevisionCommandArgs {
2020
uri?: Uri;
@@ -62,7 +62,10 @@ export class DiffFolderWithRevisionCommand extends ActiveEditorCommand {
6262
const pick = await showCommitPicker(log, title, 'Choose a commit to compare with', {
6363
picked: gitUri.sha,
6464
showOtherReferences: [
65-
CommandQuickPickItem.fromCommand('Choose a Branch or Tag...', GlCommand.DiffFolderWithRevisionFrom),
65+
CommandQuickPickItem.fromCommand<DiffFolderWithRevisionFromCommandArgs>(
66+
'Choose a Branch or Tag...',
67+
'gitlens.diffFolderWithRevisionFrom',
68+
),
6669
],
6770
});
6871
if (pick == null) return;

src/commands/diffFolderWithRevisionFrom.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { TextEditor } from 'vscode';
22
import { FileType, Uri, workspace } from 'vscode';
33
import { GlyphChars } from '../constants';
4-
import { GlCommand } from '../constants.commands';
54
import type { Container } from '../container';
65
import { openFolderCompare } from '../git/actions/commit';
76
import { GitUri } from '../git/gitUri';
@@ -24,7 +23,7 @@ export interface DiffFolderWithRevisionFromCommandArgs {
2423
@command()
2524
export class DiffFolderWithRevisionFromCommand extends ActiveEditorCommand {
2625
constructor(private readonly container: Container) {
27-
super(GlCommand.DiffFolderWithRevisionFrom);
26+
super('gitlens.diffFolderWithRevisionFrom');
2827
}
2928

3029
async execute(editor?: TextEditor, uri?: Uri, args?: DiffFolderWithRevisionFromCommandArgs): Promise<any> {

src/commands/diffLineWithPrevious.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { TextDocumentShowOptions, TextEditor, Uri } from 'vscode';
2-
import { GlCommand } from '../constants.commands';
32
import type { Container } from '../container';
43
import { GitUri } from '../git/gitUri';
54
import type { GitCommit } from '../git/models/commit';
@@ -21,7 +20,7 @@ export interface DiffLineWithPreviousCommandArgs {
2120
@command()
2221
export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
2322
constructor(private readonly container: Container) {
24-
super(GlCommand.DiffLineWithPrevious);
23+
super('gitlens.diffLineWithPrevious');
2524
}
2625

2726
protected override preExecute(context: CommandContext, args?: DiffLineWithPreviousCommandArgs): Promise<any> {
@@ -54,7 +53,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
5453
return;
5554
}
5655

57-
void (await executeCommand<DiffWithCommandArgs>(GlCommand.DiffWith, {
56+
void (await executeCommand<DiffWithCommandArgs>('gitlens.diffWith', {
5857
repoPath: diffUris.current.repoPath,
5958
lhs: {
6059
sha: diffUris.previous.sha ?? '',

src/commands/diffLineWithWorking.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { TextDocumentShowOptions, TextEditor, Uri } from 'vscode';
22
import { window } from 'vscode';
3-
import { GlCommand } from '../constants.commands';
43
import type { Container } from '../container';
54
import { GitUri } from '../git/gitUri';
65
import type { GitCommit } from '../git/models/commit';
@@ -23,7 +22,7 @@ export interface DiffLineWithWorkingCommandArgs {
2322
@command()
2423
export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
2524
constructor(private readonly container: Container) {
26-
super(GlCommand.DiffLineWithWorking);
25+
super('gitlens.diffLineWithWorking');
2726
}
2827

2928
protected override preExecute(context: CommandContext, args?: DiffLineWithWorkingCommandArgs): Promise<any> {
@@ -100,7 +99,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
10099
return;
101100
}
102101

103-
void (await executeCommand<DiffWithCommandArgs>(GlCommand.DiffWith, {
102+
void (await executeCommand<DiffWithCommandArgs>('gitlens.diffWith', {
104103
repoPath: args.commit.repoPath,
105104
lhs: {
106105
sha: lhsSha,

0 commit comments

Comments
 (0)