Skip to content

Commit 887234e

Browse files
committed
Removes GlCommand usages
1 parent ec581ef commit 887234e

File tree

86 files changed

+248
-414
lines changed

Some content is hidden

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

86 files changed

+248
-414
lines changed

contributions.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,9 +3682,6 @@
36823682
"label": "Show Cloud Patches View",
36833683
"commandPalette": "gitlens:enabled && gitlens:gk:organization:drafts:enabled"
36843684
},
3685-
"gitlens.showFileHistoryInView": {
3686-
"label": "Open File History"
3687-
},
36883685
"gitlens.showFileHistoryView": {
36893686
"label": "Show File History View",
36903687
"commandPalette": "gitlens:enabled"

package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7219,10 +7219,6 @@
72197219
"title": "Show Cloud Patches View",
72207220
"category": "GitLens"
72217221
},
7222-
{
7223-
"command": "gitlens.showFileHistoryInView",
7224-
"title": "Open File History"
7225-
},
72267222
{
72277223
"command": "gitlens.showFileHistoryView",
72287224
"title": "Show File History View",
@@ -11038,10 +11034,6 @@
1103811034
"command": "gitlens.showDraftsView",
1103911035
"when": "gitlens:enabled && gitlens:gk:organization:drafts:enabled"
1104011036
},
11041-
{
11042-
"command": "gitlens.showFileHistoryInView",
11043-
"when": "false"
11044-
},
1104511037
{
1104611038
"command": "gitlens.showFileHistoryView",
1104711039
"when": "gitlens:enabled"

src/codelens/codeLensProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ function applyToggleFileBlameCommand<T extends GitRecentChangeCodeLens | GitAuth
760760
title: string,
761761
lens: T,
762762
): T {
763-
lens.command = createCommand<[Uri]>(GlCommand.ToggleFileBlame, title, lens.uri!.toFileUri());
763+
lens.command = createCommand<[Uri]>('gitlens.toggleFileBlame', title, lens.uri!.toFileUri());
764764
return lens;
765765
}
766766

@@ -771,7 +771,7 @@ function applyToggleFileChangesCommand<T extends GitRecentChangeCodeLens | GitAu
771771
only?: boolean,
772772
): T {
773773
lens.command = createCommand<[Uri, ToggleFileChangesAnnotationCommandArgs]>(
774-
GlCommand.ToggleFileChanges,
774+
'gitlens.toggleFileChanges',
775775
title,
776776
lens.uri!.toFileUri(),
777777
{
@@ -786,7 +786,7 @@ function applyToggleFileHeatmapCommand<T extends GitRecentChangeCodeLens | GitAu
786786
title: string,
787787
lens: T,
788788
): T {
789-
lens.command = createCommand<[Uri]>(GlCommand.ToggleFileHeatmap, title, lens.uri!.toFileUri());
789+
lens.command = createCommand<[Uri]>('gitlens.toggleFileHeatmap', title, lens.uri!.toFileUri());
790790
return lens;
791791
}
792792

src/commands/addAuthors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { SourceControl } from 'vscode';
2-
import { GlCommand } from '../constants.commands';
32
import type { Container } from '../container';
43
import { executeGitCommand } from '../git/actions';
54
import { command } from '../system/-webview/command';
@@ -8,7 +7,7 @@ import { GlCommandBase } from './commandBase';
87
@command()
98
export class AddAuthorsCommand extends GlCommandBase {
109
constructor(private readonly container: Container) {
11-
super(GlCommand.AddAuthors);
10+
super('gitlens.addAuthors');
1211
}
1312

1413
execute(sourceControl: SourceControl): Promise<void> {

src/commands/closeUnchangedFiles.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Uri } from 'vscode';
22
import { TabInputCustom, TabInputNotebook, TabInputNotebookDiff, TabInputText, TabInputTextDiff, window } from 'vscode';
3-
import { GlCommand } from '../constants.commands';
43
import type { Container } from '../container';
54
import { showGenericErrorMessage } from '../messages';
65
import { getRepositoryOrShowPicker } from '../quickpicks/repositoryPicker';
@@ -16,7 +15,7 @@ export interface CloseUnchangedFilesCommandArgs {
1615
@command()
1716
export class CloseUnchangedFilesCommand extends GlCommandBase {
1817
constructor(private readonly container: Container) {
19-
super(GlCommand.CloseUnchangedFiles);
18+
super('gitlens.closeUnchangedFiles');
2019
}
2120

2221
async execute(args?: CloseUnchangedFilesCommandArgs): Promise<void> {

src/commands/commandBase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export abstract class GlCommandBase implements Disposable {
3636

3737
abstract execute(...args: any[]): any;
3838

39-
protected _execute(command: string, ...args: any[]): Promise<unknown> {
39+
protected _execute(command: GlCommands, ...args: any[]): Promise<unknown> {
4040
const [context, rest] = parseCommandContext(command, { ...this.contextParsingOptions }, ...args);
4141

4242
// If there an array of contexts, then we want to execute the command for each
@@ -60,7 +60,7 @@ export abstract class ActiveEditorCommand extends GlCommandBase {
6060
return this.execute(context.editor, context.uri, ...args);
6161
}
6262

63-
protected override _execute(command: string, ...args: any[]): any {
63+
protected override _execute(command: GlCommands, ...args: any[]): any {
6464
return super._execute(command, undefined, ...args);
6565
}
6666

@@ -73,7 +73,7 @@ export function getLastCommand(): { command: string; args: any[] } | undefined {
7373
}
7474

7575
export abstract class ActiveEditorCachedCommand extends ActiveEditorCommand {
76-
protected override _execute(command: string, ...args: any[]): any {
76+
protected override _execute(command: GlCommands, ...args: any[]): any {
7777
lastCommand = {
7878
command: command,
7979
args: args,

src/commands/commandContext.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
TextEditor,
77
Uri,
88
} from 'vscode';
9+
import type { GlCommands } from '../constants.commands';
910
import type { ViewNode } from '../views/nodes/abstract/viewNode';
1011

1112
export type CommandContext =
@@ -22,7 +23,7 @@ export type CommandContext =
2223
| CommandViewNodesContext;
2324

2425
export interface CommandContextBase {
25-
command: string;
26+
command: GlCommands;
2627
editor?: TextEditor;
2728
uri?: Uri;
2829

src/commands/commandContext.utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { GitTimelineItem, SourceControl, TextEditor } from 'vscode';
22
import { Uri, window } from 'vscode';
3+
import type { GlCommands } from '../constants.commands';
34
import type { StoredNamedRef } from '../constants.storage';
45
import type { GitBranch } from '../git/models/branch';
56
import { isBranch } from '../git/models/branch';
@@ -157,7 +158,7 @@ export interface CommandContextParsingOptions {
157158
}
158159

159160
export function parseCommandContext(
160-
command: string,
161+
command: GlCommands,
161162
options?: CommandContextParsingOptions,
162163
...args: any[]
163164
): [CommandContext | CommandContext[], any[]] {

src/commands/compareWith.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export class CompareWithCommand extends ActiveEditorCommand {
2121
GlCommand.CompareWith,
2222
GlCommand.CompareHeadWith,
2323
GlCommand.CompareWorkingWith,
24-
GlCommand.Deprecated_DiffHeadWith,
25-
GlCommand.Deprecated_DiffWorkingWith,
24+
/** @deprecated */ 'gitlens.diffHeadWith',
25+
/** @deprecated */ 'gitlens.diffWorkingWith',
2626
]);
2727
}
2828

@@ -33,13 +33,13 @@ export class CompareWithCommand extends ActiveEditorCommand {
3333
break;
3434

3535
case GlCommand.CompareHeadWith:
36-
case GlCommand.Deprecated_DiffHeadWith:
36+
case /** @deprecated */ 'gitlens.diffHeadWith':
3737
args = { ...args };
3838
args.ref1 = 'HEAD';
3939
break;
4040

4141
case GlCommand.CompareWorkingWith:
42-
case GlCommand.Deprecated_DiffWorkingWith:
42+
case /** @deprecated */ 'gitlens.diffWorkingWith':
4343
args = { ...args };
4444
args.ref1 = '';
4545
break;

src/commands/copyCurrentBranch.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 { showGenericErrorMessage } from '../messages';
@@ -13,7 +12,7 @@ import { getCommandUri } from './commandBase.utils';
1312
@command()
1413
export class CopyCurrentBranchCommand extends ActiveEditorCommand {
1514
constructor(private readonly container: Container) {
16-
super(GlCommand.CopyCurrentBranch);
15+
super('gitlens.copyCurrentBranch');
1716
}
1817

1918
async execute(editor?: TextEditor, uri?: Uri): Promise<void> {

0 commit comments

Comments
 (0)