1- import type { QuickInputButton , QuickPick } from 'vscode' ;
1+ import type { QuickPick } from 'vscode' ;
22import { commands , Uri } from 'vscode' ;
33import { getAvatarUri } from '../../avatars' ;
44import type {
@@ -28,7 +28,7 @@ import {
2828 UnpinQuickInputButton ,
2929 UnsnoozeQuickInputButton ,
3030} from '../../commands/quickCommand.buttons' ;
31- import type { LaunchpadTelemetryContext , Source , Sources } from '../../constants' ;
31+ import type { LaunchpadTelemetryContext , Source , Sources , TelemetryEvents } from '../../constants' ;
3232import { Commands , previewBadge } from '../../constants' ;
3333import type { Container } from '../../container' ;
3434import type { QuickPickItemOfT } from '../../quickpicks/items/common' ;
@@ -262,8 +262,8 @@ export class FocusCommand extends QuickCommand<State> {
262262 assertsFocusStepState ( state ) ;
263263
264264 if ( this . confirm ( state . confirm ) ) {
265- await this . container . focus . ensureFocusItemCodeSuggestions ( state . item ) ;
266265 this . sendItemActionTelemetry ( 'select' , state . item , state . item . group , context ) ;
266+ await this . container . focus . ensureFocusItemCodeSuggestions ( state . item ) ;
267267
268268 const result = yield * this . confirmStep ( state , context ) ;
269269 if ( result === StepResultBreak ) continue ;
@@ -277,10 +277,9 @@ export class FocusCommand extends QuickCommand<State> {
277277
278278 if ( typeof state . action === 'string' ) {
279279 switch ( state . action ) {
280- case 'merge' : {
280+ case 'merge' :
281281 void this . container . focus . merge ( state . item ) ;
282282 break ;
283- }
284283 case 'open' :
285284 this . container . focus . open ( state . item ) ;
286285 break ;
@@ -467,15 +466,21 @@ export class FocusCommand extends QuickCommand<State> {
467466 onDidClickButton : async ( quickpick , button ) => {
468467 switch ( button ) {
469468 case LaunchpadSettingsQuickInputButton :
469+ this . sendTitleActionTelemetry ( 'settings' , context ) ;
470470 void commands . executeCommand ( 'workbench.action.openSettings' , 'gitlens.launchpad' ) ;
471471 break ;
472+
472473 case FeedbackQuickInputButton :
474+ this . sendTitleActionTelemetry ( 'feedback' , context ) ;
473475 void openUrl ( 'https://github.com/gitkraken/vscode-gitlens/discussions/3286' ) ;
474476 break ;
477+
475478 case OpenInEditorQuickInputButton :
479+ this . sendTitleActionTelemetry ( 'open-in-editor' , context ) ;
476480 void executeCommand ( Commands . ShowFocusPage ) ;
477481 break ;
478482 case RefreshQuickInputButton :
483+ this . sendTitleActionTelemetry ( 'refresh' , context ) ;
479484 await updateItems ( quickpick ) ;
480485 break ;
481486 }
@@ -484,30 +489,36 @@ export class FocusCommand extends QuickCommand<State> {
484489 onDidClickItemButton : async ( quickpick , button , { group, item } ) => {
485490 switch ( button ) {
486491 case OpenOnGitHubQuickInputButton :
492+ this . sendItemActionTelemetry ( 'soft-open' , item , group , context ) ;
487493 this . container . focus . open ( item ) ;
488494 break ;
495+
489496 case SnoozeQuickInputButton :
497+ this . sendItemActionTelemetry ( 'snooze' , item , group , context ) ;
490498 await this . container . focus . snooze ( item ) ;
491499 break ;
492500
493501 case UnsnoozeQuickInputButton :
502+ this . sendItemActionTelemetry ( 'unsnooze' , item , group , context ) ;
494503 await this . container . focus . unsnooze ( item ) ;
495504 break ;
496505
497506 case PinQuickInputButton :
507+ this . sendItemActionTelemetry ( 'pin' , item , group , context ) ;
498508 await this . container . focus . pin ( item ) ;
499509 break ;
500510
501511 case UnpinQuickInputButton :
512+ this . sendItemActionTelemetry ( 'unpin' , item , group , context ) ;
502513 await this . container . focus . unpin ( item ) ;
503514 break ;
504515
505516 case MergeQuickInputButton :
517+ this . sendItemActionTelemetry ( 'merge' , item , group , context ) ;
506518 await this . container . focus . merge ( item ) ;
507519 break ;
508520 }
509521
510- this . sendItemActionTelemetry ( button , item , group , context ) ;
511522 await updateItems ( quickpick ) ;
512523 } ,
513524 } ) ;
@@ -668,16 +679,21 @@ export class FocusCommand extends QuickCommand<State> {
668679 onDidClickItemButton : ( _quickpick , button , item ) => {
669680 switch ( button ) {
670681 case OpenOnGitHubQuickInputButton :
682+ this . sendItemActionTelemetry ( 'soft-open' , state . item , state . item . group , context ) ;
671683 this . container . focus . open ( state . item ) ;
672684 break ;
673685 case OpenOnWebQuickInputButton :
686+ this . sendItemActionTelemetry (
687+ 'open-suggestion-browser' ,
688+ state . item ,
689+ state . item . group ,
690+ context ,
691+ ) ;
674692 if ( isFocusTargetActionQuickPickItem ( item ) ) {
675693 this . container . focus . openCodeSuggestionInBrowser ( item . item . target ) ;
676694 }
677695 break ;
678696 }
679-
680- this . sendItemActionTelemetry ( button , state . item , state . item . group , context ) ;
681697 } ,
682698 } ,
683699 ) ;
@@ -888,7 +904,15 @@ export class FocusCommand extends QuickCommand<State> {
888904 }
889905
890906 private sendItemActionTelemetry (
891- buttonOrAction : QuickInputButton | FocusAction | FocusTargetAction | 'select' ,
907+ actionOrTargetAction :
908+ | FocusAction
909+ | FocusTargetAction
910+ | 'pin'
911+ | 'unpin'
912+ | 'snooze'
913+ | 'unsnooze'
914+ | 'open-suggestion-browser'
915+ | 'select' ,
892916 item : FocusItem ,
893917 group : FocusGroup ,
894918 context : Context ,
@@ -905,34 +929,10 @@ export class FocusCommand extends QuickCommand<State> {
905929 | 'open-suggestion-browser'
906930 | 'select'
907931 | undefined ;
908- if ( typeof buttonOrAction !== 'string' && 'action' in buttonOrAction ) {
909- action = buttonOrAction . action ;
910- } else if ( typeof buttonOrAction === 'string' ) {
911- action = buttonOrAction ;
932+ if ( typeof actionOrTargetAction !== 'string' && 'action' in actionOrTargetAction ) {
933+ action = actionOrTargetAction . action ;
912934 } else {
913- switch ( buttonOrAction ) {
914- case MergeQuickInputButton :
915- action = 'merge' ;
916- break ;
917- case OpenOnGitHubQuickInputButton :
918- action = 'soft-open' ;
919- break ;
920- case PinQuickInputButton :
921- action = 'pin' ;
922- break ;
923- case UnpinQuickInputButton :
924- action = 'unpin' ;
925- break ;
926- case SnoozeQuickInputButton :
927- action = 'snooze' ;
928- break ;
929- case UnsnoozeQuickInputButton :
930- action = 'unsnooze' ;
931- break ;
932- case OpenOnWebQuickInputButton :
933- action = 'open-suggestion-browser' ;
934- break ;
935- }
935+ action = actionOrTargetAction ;
936936 }
937937 if ( action == null ) return ;
938938
@@ -985,6 +985,16 @@ export class FocusCommand extends QuickCommand<State> {
985985 this . source ,
986986 ) ;
987987 }
988+
989+ private sendTitleActionTelemetry ( action : TelemetryEvents [ 'launchpad/title/action' ] [ 'action' ] , context : Context ) {
990+ if ( ! this . container . telemetry . enabled ) return ;
991+
992+ this . container . telemetry . sendEvent (
993+ 'launchpad/title/action' ,
994+ { ...context . telemetryContext ! , action : action } ,
995+ this . source ,
996+ ) ;
997+ }
988998}
989999
9901000async function updateContextItems ( container : Container , context : Context , options ?: { force ?: boolean } ) {
0 commit comments