@@ -66,6 +66,7 @@ type LaunchContext struct {
66
66
wsInfo * supervisor.WorkspaceInfoResponse
67
67
68
68
vmOptionsFile string
69
+ clientVMOptionsFile string
69
70
platformPropertiesFile string
70
71
projectDir string
71
72
configDir string
@@ -542,6 +543,11 @@ func launch(launchCtx *LaunchContext) {
542
543
if err != nil {
543
544
log .WithError (err ).Error ("failed to parse .gitpod.yml" )
544
545
}
546
+ userHomeDir , err := os .UserHomeDir ()
547
+ if err != nil {
548
+ log .WithError (err ).Error ("failed to get user home dir" )
549
+ userHomeDir = "~"
550
+ }
545
551
546
552
// configure vmoptions
547
553
idePrefix := launchCtx .alias
@@ -550,10 +556,16 @@ func launch(launchCtx *LaunchContext) {
550
556
}
551
557
// [idea64|goland64|pycharm64|phpstorm64].vmoptions
552
558
launchCtx .vmOptionsFile = fmt .Sprintf (launchCtx .backendDir + "/bin/%s64.vmoptions" , idePrefix )
559
+ // ~/.config/JetBrains/<name_version>/[idea64|goland64|pycharm64|phpstorm64].vmoptions
560
+ launchCtx .clientVMOptionsFile = fmt .Sprintf ("%s/.config/JetBrains/%s/%s64.vmoptions" , userHomeDir , launchCtx .info .DataDirectoryName , idePrefix )
561
+
553
562
err = configureVMOptions (gitpodConfig , launchCtx .alias , launchCtx .vmOptionsFile )
554
563
if err != nil {
555
564
log .WithError (err ).Error ("failed to configure vmoptions" )
556
565
}
566
+ if err := configureClientSideVMOptions (launchCtx ); err != nil {
567
+ log .WithError (err ).Error ("failed to configure client side vmoptions" )
568
+ }
557
569
558
570
var riderSolutionFile string
559
571
if launchCtx .alias == "rider" {
@@ -792,6 +804,27 @@ func configureVMOptions(config *gitpod.GitpodConfig, alias string, vmOptionsPath
792
804
return writeVMOptions (vmOptionsPath , newOptions )
793
805
}
794
806
807
+ func configureClientSideVMOptions (launchCtx * LaunchContext ) error {
808
+ if launchCtx .alias != "pycharm" {
809
+ return nil
810
+ }
811
+ // ENT-849
812
+ // Add -Dide.browser.jcef.enabled=false for PyCharm
813
+ vmOptionsPath := launchCtx .clientVMOptionsFile
814
+ options , err := readVMOptions (vmOptionsPath )
815
+ if err != nil {
816
+ if errors .Is (err , fs .ErrNotExist ) {
817
+ options = []string {}
818
+ } else {
819
+ return err
820
+ }
821
+ }
822
+ newOptions := deduplicateVMOption (options , []string {"-Dide.browser.jcef.enabled=false" }, func (l , r string ) bool {
823
+ return l == r
824
+ })
825
+ return writeVMOptions (vmOptionsPath , newOptions )
826
+ }
827
+
795
828
func readVMOptions (vmOptionsPath string ) ([]string , error ) {
796
829
content , err := os .ReadFile (vmOptionsPath )
797
830
if err != nil {
@@ -902,9 +935,10 @@ func updateVMOptions(
902
935
}
903
936
*/
904
937
type ProductInfo struct {
905
- BuildNumber string `json:"buildNumber"`
906
- Version string `json:"version"`
907
- ProductCode string `json:"productCode"`
938
+ BuildNumber string `json:"buildNumber"`
939
+ Version string `json:"version"`
940
+ ProductCode string `json:"productCode"`
941
+ DataDirectoryName string `json:"dataDirectoryName"`
908
942
}
909
943
910
944
func resolveProductInfo (backendDir string ) (* ProductInfo , error ) {
0 commit comments