@@ -17,8 +17,7 @@ import type { ShowQuickCommitCommandArgs } from '../commands/showQuickCommit';
1717import type { ShowQuickCommitFileCommandArgs } from '../commands/showQuickCommitFile' ;
1818import type { ShowQuickFileHistoryCommandArgs } from '../commands/showQuickFileHistory' ;
1919import type { ToggleFileChangesAnnotationCommandArgs } from '../commands/toggleFileAnnotations' ;
20- import type { CodeLensConfig , CodeLensLanguageScope } from '../config' ;
21- import { CodeLensCommand } from '../config' ;
20+ import type { CodeLensCommands , CodeLensConfig , CodeLensLanguageScope } from '../config' ;
2221import { trackableSchemes } from '../constants' ;
2322import type { GlCommands } from '../constants.commands' ;
2423import type { Container } from '../container' ;
@@ -45,7 +44,7 @@ class GitRecentChangeCodeLens extends CodeLens {
4544 public readonly blameRange : Range ,
4645 public readonly isFullRange : boolean ,
4746 range : Range ,
48- public readonly desiredCommand : CodeLensCommand | false ,
47+ public readonly desiredCommand : CodeLensCommands | false ,
4948 command ?: Command | undefined ,
5049 ) {
5150 super ( range , command ) ;
@@ -65,7 +64,7 @@ class GitAuthorsCodeLens extends CodeLens {
6564 public readonly blameRange : Range ,
6665 public readonly isFullRange : boolean ,
6766 range : Range ,
68- public readonly desiredCommand : CodeLensCommand | false ,
67+ public readonly desiredCommand : CodeLensCommands | false ,
6968 ) {
7069 super ( range ) ;
7170 }
@@ -500,35 +499,35 @@ export class GitCodeLensProvider implements CodeLensProvider, Disposable {
500499 }
501500
502501 switch ( lens . desiredCommand ) {
503- case CodeLensCommand . CopyRemoteCommitUrl :
502+ case 'gitlens.copyRemoteCommitUrl' satisfies CodeLensCommands :
504503 return applyCopyOrOpenCommitOnRemoteCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit , true ) ;
505- case CodeLensCommand . CopyRemoteFileUrl :
504+ case 'gitlens.copyRemoteFileUrl' satisfies CodeLensCommands :
506505 return applyCopyOrOpenFileOnRemoteCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit , true ) ;
507- case CodeLensCommand . DiffWithPrevious :
506+ case 'gitlens.diffWithPrevious' satisfies CodeLensCommands :
508507 return applyDiffWithPreviousCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
509- case CodeLensCommand . OpenCommitOnRemote :
508+ case 'gitlens.openCommitOnRemote' satisfies CodeLensCommands :
510509 return applyCopyOrOpenCommitOnRemoteCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
511- case CodeLensCommand . OpenFileOnRemote :
510+ case 'gitlens.openFileOnRemote' satisfies CodeLensCommands :
512511 return applyCopyOrOpenFileOnRemoteCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
513- case CodeLensCommand . RevealCommitInView :
512+ case 'gitlens.revealCommitInView' satisfies CodeLensCommands :
514513 return applyRevealCommitInViewCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
515- case CodeLensCommand . ShowCommitsInView :
514+ case 'gitlens.showCommitsInView' satisfies CodeLensCommands :
516515 return applyShowCommitsInViewCommand < GitRecentChangeCodeLens > ( title , lens , blame , recentCommit ) ;
517- case CodeLensCommand . ShowQuickCommitDetails :
516+ case 'gitlens.showQuickCommitDetails' satisfies CodeLensCommands :
518517 return applyShowQuickCommitDetailsCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
519- case CodeLensCommand . ShowQuickCommitFileDetails :
518+ case 'gitlens.showQuickCommitFileDetails' satisfies CodeLensCommands :
520519 return applyShowQuickCommitFileDetailsCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
521- case CodeLensCommand . ShowQuickCurrentBranchHistory :
520+ case 'gitlens.showQuickRepoHistory' satisfies CodeLensCommands :
522521 return applyShowQuickCurrentBranchHistoryCommand < GitRecentChangeCodeLens > ( title , lens ) ;
523- case CodeLensCommand . ShowQuickFileHistory :
522+ case 'gitlens.showQuickFileHistory' satisfies CodeLensCommands :
524523 return applyShowQuickFileHistoryCommand < GitRecentChangeCodeLens > ( title , lens ) ;
525- case CodeLensCommand . ToggleFileBlame :
524+ case 'gitlens.toggleFileBlame' satisfies CodeLensCommands :
526525 return applyToggleFileBlameCommand < GitRecentChangeCodeLens > ( title , lens ) ;
527- case CodeLensCommand . ToggleFileChanges :
526+ case 'gitlens.toggleFileChanges' satisfies CodeLensCommands :
528527 return applyToggleFileChangesCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit ) ;
529- case CodeLensCommand . ToggleFileChangesOnly :
528+ case 'gitlens.toggleFileChangesOnly' satisfies CodeLensCommands :
530529 return applyToggleFileChangesCommand < GitRecentChangeCodeLens > ( title , lens , recentCommit , true ) ;
531- case CodeLensCommand . ToggleFileHeatmap :
530+ case 'gitlens.toggleFileHeatmap' satisfies CodeLensCommands :
532531 return applyToggleFileHeatmapCommand < GitRecentChangeCodeLens > ( title , lens ) ;
533532 default :
534533 return lens ;
@@ -566,35 +565,35 @@ export class GitCodeLensProvider implements CodeLensProvider, Disposable {
566565 if ( commit == null ) return applyCommandWithNoClickAction ( title , lens ) ;
567566
568567 switch ( lens . desiredCommand ) {
569- case CodeLensCommand . CopyRemoteCommitUrl :
568+ case 'gitlens.copyRemoteCommitUrl' satisfies CodeLensCommands :
570569 return applyCopyOrOpenCommitOnRemoteCommand < GitAuthorsCodeLens > ( title , lens , commit , true ) ;
571- case CodeLensCommand . CopyRemoteFileUrl :
570+ case 'gitlens.copyRemoteFileUrl' satisfies CodeLensCommands :
572571 return applyCopyOrOpenFileOnRemoteCommand < GitAuthorsCodeLens > ( title , lens , commit , true ) ;
573- case CodeLensCommand . DiffWithPrevious :
572+ case 'gitlens.diffWithPrevious' satisfies CodeLensCommands :
574573 return applyDiffWithPreviousCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
575- case CodeLensCommand . OpenCommitOnRemote :
574+ case 'gitlens.openCommitOnRemote' satisfies CodeLensCommands :
576575 return applyCopyOrOpenCommitOnRemoteCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
577- case CodeLensCommand . OpenFileOnRemote :
576+ case 'gitlens.openFileOnRemote' satisfies CodeLensCommands :
578577 return applyCopyOrOpenFileOnRemoteCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
579- case CodeLensCommand . RevealCommitInView :
578+ case 'gitlens.revealCommitInView' satisfies CodeLensCommands :
580579 return applyRevealCommitInViewCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
581- case CodeLensCommand . ShowCommitsInView :
580+ case 'gitlens.showCommitsInView' satisfies CodeLensCommands :
582581 return applyShowCommitsInViewCommand < GitAuthorsCodeLens > ( title , lens , blame ) ;
583- case CodeLensCommand . ShowQuickCommitDetails :
582+ case 'gitlens.showQuickCommitDetails' satisfies CodeLensCommands :
584583 return applyShowQuickCommitDetailsCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
585- case CodeLensCommand . ShowQuickCommitFileDetails :
584+ case 'gitlens.showQuickCommitFileDetails' satisfies CodeLensCommands :
586585 return applyShowQuickCommitFileDetailsCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
587- case CodeLensCommand . ShowQuickCurrentBranchHistory :
586+ case 'gitlens.showQuickRepoHistory' satisfies CodeLensCommands :
588587 return applyShowQuickCurrentBranchHistoryCommand < GitAuthorsCodeLens > ( title , lens ) ;
589- case CodeLensCommand . ShowQuickFileHistory :
588+ case 'gitlens.showQuickFileHistory' satisfies CodeLensCommands :
590589 return applyShowQuickFileHistoryCommand < GitAuthorsCodeLens > ( title , lens ) ;
591- case CodeLensCommand . ToggleFileBlame :
590+ case 'gitlens.toggleFileBlame' satisfies CodeLensCommands :
592591 return applyToggleFileBlameCommand < GitAuthorsCodeLens > ( title , lens ) ;
593- case CodeLensCommand . ToggleFileChanges :
592+ case 'gitlens.toggleFileChanges' satisfies CodeLensCommands :
594593 return applyToggleFileChangesCommand < GitAuthorsCodeLens > ( title , lens , commit ) ;
595- case CodeLensCommand . ToggleFileChangesOnly :
594+ case 'gitlens.toggleFileChangesOnly' satisfies CodeLensCommands :
596595 return applyToggleFileChangesCommand < GitAuthorsCodeLens > ( title , lens , commit , true ) ;
597- case CodeLensCommand . ToggleFileHeatmap :
596+ case 'gitlens.toggleFileHeatmap' satisfies CodeLensCommands :
598597 return applyToggleFileHeatmapCommand < GitAuthorsCodeLens > ( title , lens ) ;
599598 default :
600599 return lens ;
@@ -668,7 +667,7 @@ function applyRevealCommitInViewCommand<T extends GitRecentChangeCodeLens | GitA
668667 commit : GitCommit | undefined ,
669668) : T {
670669 lens . command = createCommand < [ Uri , ShowQuickCommitCommandArgs ] > (
671- commit ?. isUncommitted ? ( '' as CodeLensCommand ) : CodeLensCommand . RevealCommitInView ,
670+ commit ?. isUncommitted ? ( '' as CodeLensCommands ) : 'gitlens.revealCommitInView' ,
672671 title ,
673672 lens . uri ! . toFileUri ( ) ,
674673 {
@@ -709,7 +708,7 @@ function applyShowQuickCommitDetailsCommand<T extends GitRecentChangeCodeLens |
709708 commit : GitCommit | undefined ,
710709) : T {
711710 lens . command = createCommand < [ Uri , ShowQuickCommitCommandArgs ] > (
712- commit ?. isUncommitted ? ( '' as CodeLensCommand ) : CodeLensCommand . ShowQuickCommitDetails ,
711+ commit ?. isUncommitted ? ( '' as CodeLensCommands ) : 'gitlens.showQuickCommitDetails' ,
713712 title ,
714713 lens . uri ! . toFileUri ( ) ,
715714 {
@@ -726,7 +725,7 @@ function applyShowQuickCommitFileDetailsCommand<T extends GitRecentChangeCodeLen
726725 commit : GitCommit | undefined ,
727726) : T {
728727 lens . command = createCommand < [ Uri , ShowQuickCommitFileCommandArgs ] > (
729- commit ?. isUncommitted ? ( '' as CodeLensCommand ) : CodeLensCommand . ShowQuickCommitFileDetails ,
728+ commit ?. isUncommitted ? ( '' as CodeLensCommands ) : 'gitlens.showQuickCommitFileDetails' ,
730729 title ,
731730 lens . uri ! . toFileUri ( ) ,
732731 {
@@ -741,7 +740,7 @@ function applyShowQuickCurrentBranchHistoryCommand<T extends GitRecentChangeCode
741740 title : string ,
742741 lens : T ,
743742) : T {
744- lens . command = createCommand < [ Uri ] > ( CodeLensCommand . ShowQuickCurrentBranchHistory , title , lens . uri ! . toFileUri ( ) ) ;
743+ lens . command = createCommand < [ Uri ] > ( 'gitlens.showQuickRepoHistory' , title , lens . uri ! . toFileUri ( ) ) ;
745744 return lens ;
746745}
747746
@@ -750,7 +749,7 @@ function applyShowQuickFileHistoryCommand<T extends GitRecentChangeCodeLens | Gi
750749 lens : T ,
751750) : T {
752751 lens . command = createCommand < [ Uri , ShowQuickFileHistoryCommandArgs ] > (
753- CodeLensCommand . ShowQuickFileHistory ,
752+ 'gitlens.showQuickFileHistory' ,
754753 title ,
755754 lens . uri ! . toFileUri ( ) ,
756755 {
0 commit comments