@@ -66,6 +66,7 @@ type LaunchContext struct {
6666	wsInfo          * supervisor.WorkspaceInfoResponse 
6767
6868	vmOptionsFile           string 
69+ 	clientVMOptionsFile     string 
6970	platformPropertiesFile  string 
7071	projectDir              string 
7172	configDir               string 
@@ -542,6 +543,11 @@ func launch(launchCtx *LaunchContext) {
542543	if  err  !=  nil  {
543544		log .WithError (err ).Error ("failed to parse .gitpod.yml" )
544545	}
546+ 	userHomeDir , err  :=  os .UserHomeDir ()
547+ 	if  err  !=  nil  {
548+ 		log .WithError (err ).Error ("failed to get user home dir" )
549+ 		userHomeDir  =  "~" 
550+ 	}
545551
546552	// configure vmoptions 
547553	idePrefix  :=  launchCtx .alias 
@@ -550,10 +556,16 @@ func launch(launchCtx *LaunchContext) {
550556	}
551557	// [idea64|goland64|pycharm64|phpstorm64].vmoptions 
552558	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+ 
553562	err  =  configureVMOptions (gitpodConfig , launchCtx .alias , launchCtx .vmOptionsFile )
554563	if  err  !=  nil  {
555564		log .WithError (err ).Error ("failed to configure vmoptions" )
556565	}
566+ 	if  err  :=  configureClientSideVMOptions (launchCtx ); err  !=  nil  {
567+ 		log .WithError (err ).Error ("failed to configure client side vmoptions" )
568+ 	}
557569
558570	var  riderSolutionFile  string 
559571	if  launchCtx .alias  ==  "rider"  {
@@ -792,6 +804,27 @@ func configureVMOptions(config *gitpod.GitpodConfig, alias string, vmOptionsPath
792804	return  writeVMOptions (vmOptionsPath , newOptions )
793805}
794806
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+ 
795828func  readVMOptions (vmOptionsPath  string ) ([]string , error ) {
796829	content , err  :=  os .ReadFile (vmOptionsPath )
797830	if  err  !=  nil  {
@@ -902,9 +935,10 @@ func updateVMOptions(
902935	} 
903936*/ 
904937type  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"` 
908942}
909943
910944func  resolveProductInfo (backendDir  string ) (* ProductInfo , error ) {
0 commit comments