@@ -103,7 +103,7 @@ import * as path from "path";
103
103
import * as grpc from "@grpc/grpc-js" ;
104
104
import { IDEConfig , IDEConfigService } from "../ide-config" ;
105
105
import { EnvVarWithValue } from "@gitpod/gitpod-protocol/src/protocol" ;
106
- import { WithReferrerContext } from "@gitpod/gitpod-protocol/lib/protocol" ;
106
+ import { WithEditorContext , WithReferrerContext } from "@gitpod/gitpod-protocol/lib/protocol" ;
107
107
import { IDEOption , IDEOptions } from "@gitpod/gitpod-protocol/lib/ide-protocol" ;
108
108
import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred" ;
109
109
import { ExtendedUser } from "@gitpod/ws-manager/lib/constraints" ;
@@ -607,8 +607,12 @@ export class WorkspaceStarter {
607
607
user . additionalData . ideSettings = migratted ;
608
608
}
609
609
610
- const ideChoice = user . additionalData ?. ideSettings ?. defaultIde ;
611
- const useLatest = ! ! user . additionalData ?. ideSettings ?. useLatestVersion ;
610
+ const preferenceIDE = user . additionalData ?. ideSettings ?. defaultIde ;
611
+ const perferenceUseLatest = ! ! user . additionalData ?. ideSettings ?. useLatestVersion ;
612
+ const ideChoice = WithEditorContext . is ( workspace . context ) ? workspace . context . ide : preferenceIDE ;
613
+ const useLatest = WithEditorContext . is ( workspace . context )
614
+ ? workspace . context . useLatest ?? false
615
+ : perferenceUseLatest ;
612
616
613
617
// TODO(cw): once we allow changing the IDE in the workspace config (i.e. .gitpod.yml), we must
614
618
// give that value precedence over the default choice.
@@ -618,7 +622,7 @@ export class WorkspaceStarter {
618
622
ideConfig : {
619
623
// We only check user setting because if code(insider) but desktopIde has no latestImage
620
624
// it still need to notice user that this workspace is using latest IDE
621
- useLatest : user . additionalData ?. ideSettings ?. useLatestVersion ,
625
+ useLatest,
622
626
} ,
623
627
} ;
624
628
@@ -635,9 +639,10 @@ export class WorkspaceStarter {
635
639
636
640
const referrerIde = this . resolveReferrerIDE ( workspace , user , ideConfig ) ;
637
641
if ( referrerIde ) {
638
- configuration . desktopIdeImage = useLatest
642
+ configuration . desktopIdeImage = perferenceUseLatest
639
643
? referrerIde . option . latestImage ?? referrerIde . option . image
640
644
: referrerIde . option . image ;
645
+ configuration . ideConfig ! . useLatest = perferenceUseLatest ;
641
646
if ( ! user . additionalData ?. ideSettings ) {
642
647
// A user does not have IDE settings configured yet configure it with a referrer ide as default.
643
648
const additionalData = user ?. additionalData || { } ;
@@ -691,17 +696,24 @@ export class WorkspaceStarter {
691
696
} ,
692
697
configuration,
693
698
} ;
694
- if ( WithReferrerContext . is ( workspace . context ) ) {
699
+
700
+ const trackIDEPreferrer = ( referrer ?: string , referrerIde ?: string , useLatest ?: boolean ) => {
695
701
this . analytics . track ( {
696
702
userId : user . id ,
697
703
event : "ide_referrer" ,
698
704
properties : {
699
705
workspaceId : workspace . id ,
700
706
instanceId : instance . id ,
701
- referrer : workspace . context . referrer ,
702
- referrerIde : workspace . context . referrerIde ,
707
+ referrer,
708
+ useLatest,
709
+ referrerIde,
703
710
} ,
704
711
} ) ;
712
+ } ;
713
+ if ( WithReferrerContext . is ( workspace . context ) ) {
714
+ trackIDEPreferrer ( workspace . context . referrer , workspace . context . referrerIde , perferenceUseLatest ) ;
715
+ } else if ( WithEditorContext . is ( workspace . context ) ) {
716
+ trackIDEPreferrer ( workspace . context . referrer , workspace . context . ide , workspace . context . useLatest ) ;
705
717
}
706
718
return instance ;
707
719
}
0 commit comments