Skip to content

Commit 76180ab

Browse files
committed
Avoids unnecessary satisfies checks
1 parent 6e435c5 commit 76180ab

File tree

8 files changed

+107
-106
lines changed

8 files changed

+107
-106
lines changed

docs/telemetry-events.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/codelens/codeLensProvider.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -499,35 +499,35 @@ export class GitCodeLensProvider implements CodeLensProvider, Disposable {
499499
}
500500

501501
switch (lens.desiredCommand) {
502-
case 'gitlens.copyRemoteCommitUrl' satisfies CodeLensCommands:
502+
case 'gitlens.copyRemoteCommitUrl':
503503
return applyCopyOrOpenCommitOnRemoteCommand<GitRecentChangeCodeLens>(title, lens, recentCommit, true);
504-
case 'gitlens.copyRemoteFileUrl' satisfies CodeLensCommands:
504+
case 'gitlens.copyRemoteFileUrl':
505505
return applyCopyOrOpenFileOnRemoteCommand<GitRecentChangeCodeLens>(title, lens, recentCommit, true);
506-
case 'gitlens.diffWithPrevious' satisfies CodeLensCommands:
506+
case 'gitlens.diffWithPrevious':
507507
return applyDiffWithPreviousCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
508-
case 'gitlens.openCommitOnRemote' satisfies CodeLensCommands:
508+
case 'gitlens.openCommitOnRemote':
509509
return applyCopyOrOpenCommitOnRemoteCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
510-
case 'gitlens.openFileOnRemote' satisfies CodeLensCommands:
510+
case 'gitlens.openFileOnRemote':
511511
return applyCopyOrOpenFileOnRemoteCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
512-
case 'gitlens.revealCommitInView' satisfies CodeLensCommands:
512+
case 'gitlens.revealCommitInView':
513513
return applyRevealCommitInViewCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
514-
case 'gitlens.showCommitsInView' satisfies CodeLensCommands:
514+
case 'gitlens.showCommitsInView':
515515
return applyShowCommitsInViewCommand<GitRecentChangeCodeLens>(title, lens, blame, recentCommit);
516-
case 'gitlens.showQuickCommitDetails' satisfies CodeLensCommands:
516+
case 'gitlens.showQuickCommitDetails':
517517
return applyShowQuickCommitDetailsCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
518-
case 'gitlens.showQuickCommitFileDetails' satisfies CodeLensCommands:
518+
case 'gitlens.showQuickCommitFileDetails':
519519
return applyShowQuickCommitFileDetailsCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
520-
case 'gitlens.showQuickRepoHistory' satisfies CodeLensCommands:
520+
case 'gitlens.showQuickRepoHistory':
521521
return applyShowQuickCurrentBranchHistoryCommand<GitRecentChangeCodeLens>(title, lens);
522-
case 'gitlens.showQuickFileHistory' satisfies CodeLensCommands:
522+
case 'gitlens.showQuickFileHistory':
523523
return applyShowQuickFileHistoryCommand<GitRecentChangeCodeLens>(title, lens);
524-
case 'gitlens.toggleFileBlame' satisfies CodeLensCommands:
524+
case 'gitlens.toggleFileBlame':
525525
return applyToggleFileBlameCommand<GitRecentChangeCodeLens>(title, lens);
526-
case 'gitlens.toggleFileChanges' satisfies CodeLensCommands:
526+
case 'gitlens.toggleFileChanges':
527527
return applyToggleFileChangesCommand<GitRecentChangeCodeLens>(title, lens, recentCommit);
528-
case 'gitlens.toggleFileChangesOnly' satisfies CodeLensCommands:
528+
case 'gitlens.toggleFileChangesOnly':
529529
return applyToggleFileChangesCommand<GitRecentChangeCodeLens>(title, lens, recentCommit, true);
530-
case 'gitlens.toggleFileHeatmap' satisfies CodeLensCommands:
530+
case 'gitlens.toggleFileHeatmap':
531531
return applyToggleFileHeatmapCommand<GitRecentChangeCodeLens>(title, lens);
532532
default:
533533
return lens;
@@ -565,35 +565,35 @@ export class GitCodeLensProvider implements CodeLensProvider, Disposable {
565565
if (commit == null) return applyCommandWithNoClickAction(title, lens);
566566

567567
switch (lens.desiredCommand) {
568-
case 'gitlens.copyRemoteCommitUrl' satisfies CodeLensCommands:
568+
case 'gitlens.copyRemoteCommitUrl':
569569
return applyCopyOrOpenCommitOnRemoteCommand<GitAuthorsCodeLens>(title, lens, commit, true);
570-
case 'gitlens.copyRemoteFileUrl' satisfies CodeLensCommands:
570+
case 'gitlens.copyRemoteFileUrl':
571571
return applyCopyOrOpenFileOnRemoteCommand<GitAuthorsCodeLens>(title, lens, commit, true);
572-
case 'gitlens.diffWithPrevious' satisfies CodeLensCommands:
572+
case 'gitlens.diffWithPrevious':
573573
return applyDiffWithPreviousCommand<GitAuthorsCodeLens>(title, lens, commit);
574-
case 'gitlens.openCommitOnRemote' satisfies CodeLensCommands:
574+
case 'gitlens.openCommitOnRemote':
575575
return applyCopyOrOpenCommitOnRemoteCommand<GitAuthorsCodeLens>(title, lens, commit);
576-
case 'gitlens.openFileOnRemote' satisfies CodeLensCommands:
576+
case 'gitlens.openFileOnRemote':
577577
return applyCopyOrOpenFileOnRemoteCommand<GitAuthorsCodeLens>(title, lens, commit);
578-
case 'gitlens.revealCommitInView' satisfies CodeLensCommands:
578+
case 'gitlens.revealCommitInView':
579579
return applyRevealCommitInViewCommand<GitAuthorsCodeLens>(title, lens, commit);
580-
case 'gitlens.showCommitsInView' satisfies CodeLensCommands:
580+
case 'gitlens.showCommitsInView':
581581
return applyShowCommitsInViewCommand<GitAuthorsCodeLens>(title, lens, blame);
582-
case 'gitlens.showQuickCommitDetails' satisfies CodeLensCommands:
582+
case 'gitlens.showQuickCommitDetails':
583583
return applyShowQuickCommitDetailsCommand<GitAuthorsCodeLens>(title, lens, commit);
584-
case 'gitlens.showQuickCommitFileDetails' satisfies CodeLensCommands:
584+
case 'gitlens.showQuickCommitFileDetails':
585585
return applyShowQuickCommitFileDetailsCommand<GitAuthorsCodeLens>(title, lens, commit);
586-
case 'gitlens.showQuickRepoHistory' satisfies CodeLensCommands:
586+
case 'gitlens.showQuickRepoHistory':
587587
return applyShowQuickCurrentBranchHistoryCommand<GitAuthorsCodeLens>(title, lens);
588-
case 'gitlens.showQuickFileHistory' satisfies CodeLensCommands:
588+
case 'gitlens.showQuickFileHistory':
589589
return applyShowQuickFileHistoryCommand<GitAuthorsCodeLens>(title, lens);
590-
case 'gitlens.toggleFileBlame' satisfies CodeLensCommands:
590+
case 'gitlens.toggleFileBlame':
591591
return applyToggleFileBlameCommand<GitAuthorsCodeLens>(title, lens);
592-
case 'gitlens.toggleFileChanges' satisfies CodeLensCommands:
592+
case 'gitlens.toggleFileChanges':
593593
return applyToggleFileChangesCommand<GitAuthorsCodeLens>(title, lens, commit);
594-
case 'gitlens.toggleFileChangesOnly' satisfies CodeLensCommands:
594+
case 'gitlens.toggleFileChangesOnly':
595595
return applyToggleFileChangesCommand<GitAuthorsCodeLens>(title, lens, commit, true);
596-
case 'gitlens.toggleFileHeatmap' satisfies CodeLensCommands:
596+
case 'gitlens.toggleFileHeatmap':
597597
return applyToggleFileHeatmapCommand<GitAuthorsCodeLens>(title, lens);
598598
default:
599599
return lens;

src/commands/quickCommand.steps.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,9 +2760,9 @@ export async function* ensureAccessStep<
27602760
const detail = promo?.content?.quickpick.detail;
27612761

27622762
switch (feature) {
2763-
case 'graph' satisfies PlusFeatures:
2764-
case 'timeline' satisfies PlusFeatures:
2765-
case 'worktrees' satisfies PlusFeatures:
2763+
case 'graph':
2764+
case 'timeline':
2765+
case 'worktrees':
27662766
placeholder =
27672767
isSubscriptionPaidPlan(access.subscription.required) && access.subscription.current.account != null
27682768
? 'Pro feature — requires GitLens Pro for use on privately-hosted repos'
@@ -2802,7 +2802,7 @@ export async function* ensureAccessStep<
28022802
}
28032803

28042804
switch (feature) {
2805-
case 'launchpad' satisfies PlusFeatures:
2805+
case 'launchpad':
28062806
directives.splice(
28072807
0,
28082808
0,
@@ -2819,7 +2819,7 @@ export async function* ensureAccessStep<
28192819
createQuickPickSeparator(),
28202820
);
28212821
break;
2822-
case 'startWork' satisfies PlusFeatures:
2822+
case 'startWork':
28232823
directives.splice(
28242824
0,
28252825
0,
@@ -2830,7 +2830,7 @@ export async function* ensureAccessStep<
28302830
createQuickPickSeparator(),
28312831
);
28322832
break;
2833-
case 'associateIssueWithBranch' satisfies PlusFeatures:
2833+
case 'associateIssueWithBranch':
28342834
directives.splice(
28352835
0,
28362836
0,
@@ -2841,7 +2841,7 @@ export async function* ensureAccessStep<
28412841
createQuickPickSeparator(),
28422842
);
28432843
break;
2844-
case 'worktrees' satisfies PlusFeatures:
2844+
case 'worktrees':
28452845
directives.splice(
28462846
0,
28472847
0,

src/constants.telemetry.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Config, GraphBranchesVisibility, GraphConfig } from './config';
22
import type { WalkthroughSteps } from './constants';
33
import type { AIProviders } from './constants.ai';
4-
import type { GlCommands } from './constants.commands';
4+
import type { GlCommands, GlCommandsDeprecated } from './constants.commands';
55
import type { IntegrationId, SupportedCloudIntegrationIds } from './constants.integrations';
66
import type { SubscriptionState, SubscriptionStateString } from './constants.subscription';
77
import type { CustomEditorTypes, TreeViewTypes, WebviewTypes, WebviewViewTypes } from './constants.views';
@@ -1048,4 +1048,7 @@ export type TrackedUsageFeatures =
10481048
| `${TreeViewTypes | WebviewViewTypes}View`
10491049
| `${CustomEditorTypes}Editor`;
10501050
export type WalkthroughUsageKeys = 'home:walkthrough:dismissed';
1051-
export type TrackedUsageKeys = `${TrackedUsageFeatures}:shown` | `command:${string}:executed` | WalkthroughUsageKeys;
1051+
export type TrackedUsageKeys =
1052+
| `${TrackedUsageFeatures}:shown`
1053+
| `command:${GlCommands | GlCommandsDeprecated}:executed`
1054+
| WalkthroughUsageKeys;

src/env/node/git/localGitProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
467467
if (supported != null) return supported;
468468

469469
switch (feature) {
470-
case 'stashes' satisfies Features:
471-
case 'timeline' satisfies Features:
470+
case 'stashes':
471+
case 'timeline':
472472
supported = true;
473473
break;
474474
default:

src/plus/integrations/providers/github/githubGitProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
245245
async supports(feature: Features): Promise<boolean> {
246246
let supported;
247247
switch (feature) {
248-
case 'timeline' satisfies Features:
248+
case 'timeline':
249249
supported = true;
250250
break;
251251
default:

src/statusbar/statusBarController.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { ConfigurationChangeEvent, StatusBarItem, TextEditor, Uri } from 'vscode';
22
import { CancellationTokenSource, Disposable, MarkdownString, StatusBarAlignment, window } from 'vscode';
33
import type { ToggleFileChangesAnnotationCommandArgs } from '../commands/toggleFileAnnotations';
4-
import type { StatusBarCommands } from '../config';
54
import { GlyphChars } from '../constants';
65
import type { GlCommands } from '../constants.commands';
76
import type { Container } from '../container';
@@ -254,52 +253,52 @@ export class StatusBarController implements Disposable {
254253

255254
let actionTooltip: string;
256255
switch (cfg.command) {
257-
case 'gitlens.copyRemoteCommitUrl' satisfies StatusBarCommands:
256+
case 'gitlens.copyRemoteCommitUrl':
258257
actionTooltip = 'Click to Copy Remote Commit URL';
259258
break;
260-
case 'gitlens.copyRemoteFileUrl' satisfies StatusBarCommands:
259+
case 'gitlens.copyRemoteFileUrl':
261260
this._statusBarBlame.command = 'gitlens.copyRemoteFileUrlToClipboard' satisfies GlCommands;
262261
actionTooltip = 'Click to Copy Remote File Revision URL';
263262
break;
264-
case 'gitlens.diffWithPrevious' satisfies StatusBarCommands:
263+
case 'gitlens.diffWithPrevious':
265264
this._statusBarBlame.command = 'gitlens.diffLineWithPrevious' satisfies GlCommands;
266265
actionTooltip = 'Click to Open Line Changes with Previous Revision';
267266
break;
268-
case 'gitlens.diffWithWorking' satisfies StatusBarCommands:
267+
case 'gitlens.diffWithWorking':
269268
this._statusBarBlame.command = 'gitlens.diffLineWithWorking' satisfies GlCommands;
270269
actionTooltip = 'Click to Open Line Changes with Working File';
271270
break;
272-
case 'gitlens.openCommitOnRemote' satisfies StatusBarCommands:
271+
case 'gitlens.openCommitOnRemote':
273272
actionTooltip = 'Click to Open Commit on Remote';
274273
break;
275-
case 'gitlens.openFileOnRemote' satisfies StatusBarCommands:
274+
case 'gitlens.openFileOnRemote':
276275
actionTooltip = 'Click to Open Revision on Remote';
277276
break;
278-
case 'gitlens.revealCommitInView' satisfies StatusBarCommands:
277+
case 'gitlens.revealCommitInView':
279278
actionTooltip = 'Click to Reveal Commit in the Side Bar';
280279
break;
281-
case 'gitlens.showCommitsInView' satisfies StatusBarCommands:
280+
case 'gitlens.showCommitsInView':
282281
actionTooltip = 'Click to Search for Commit';
283282
break;
284-
case 'gitlens.showQuickCommitDetails' satisfies StatusBarCommands:
283+
case 'gitlens.showQuickCommitDetails':
285284
actionTooltip = 'Click to Show Commit';
286285
break;
287-
case 'gitlens.showQuickCommitFileDetails' satisfies StatusBarCommands:
286+
case 'gitlens.showQuickCommitFileDetails':
288287
actionTooltip = 'Click to Show Commit (file)';
289288
break;
290-
case 'gitlens.showQuickRepoHistory' satisfies StatusBarCommands:
289+
case 'gitlens.showQuickRepoHistory':
291290
actionTooltip = 'Click to Show Branch History';
292291
break;
293-
case 'gitlens.showQuickFileHistory' satisfies StatusBarCommands:
292+
case 'gitlens.showQuickFileHistory':
294293
actionTooltip = 'Click to Show File History';
295294
break;
296-
case 'gitlens.toggleCodeLens' satisfies StatusBarCommands:
295+
case 'gitlens.toggleCodeLens':
297296
actionTooltip = 'Click to Toggle Git CodeLens';
298297
break;
299-
case 'gitlens.toggleFileBlame' satisfies StatusBarCommands:
298+
case 'gitlens.toggleFileBlame':
300299
actionTooltip = 'Click to Toggle File Blame';
301300
break;
302-
case 'gitlens.toggleFileChanges' satisfies StatusBarCommands: {
301+
case 'gitlens.toggleFileChanges': {
303302
if (commit.file != null) {
304303
this._statusBarBlame.command = createCommand<[Uri, ToggleFileChangesAnnotationCommandArgs]>(
305304
'gitlens.toggleFileChanges',
@@ -314,7 +313,7 @@ export class StatusBarController implements Disposable {
314313
actionTooltip = 'Click to Toggle File Changes';
315314
break;
316315
}
317-
case 'gitlens.toggleFileChangesOnly' satisfies StatusBarCommands: {
316+
case 'gitlens.toggleFileChangesOnly': {
318317
if (commit.file != null) {
319318
this._statusBarBlame.command = createCommand<[Uri, ToggleFileChangesAnnotationCommandArgs]>(
320319
'gitlens.toggleFileChanges',
@@ -329,7 +328,7 @@ export class StatusBarController implements Disposable {
329328
actionTooltip = 'Click to Toggle File Changes';
330329
break;
331330
}
332-
case 'gitlens.toggleFileHeatmap' satisfies StatusBarCommands:
331+
case 'gitlens.toggleFileHeatmap':
333332
actionTooltip = 'Click to Toggle File Heatmap';
334333
break;
335334
}

0 commit comments

Comments
 (0)