@@ -69,9 +69,9 @@ export class TerminalProfileQuickpick {
69
69
if ( result . profile . args ) {
70
70
newProfile . args = result . profile . args ;
71
71
}
72
- ( profilesConfig as { [ key : string ] : ITerminalProfileObject } ) [ result . profile . profileName ] = newProfile ;
72
+ ( profilesConfig as { [ key : string ] : ITerminalProfileObject } ) [ result . profile . profileName ] = this . _createNewProfileConfig ( result . profile ) ;
73
+ await this . _configurationService . updateValue ( profilesKey , profilesConfig , ConfigurationTarget . USER ) ;
73
74
}
74
- await this . _configurationService . updateValue ( profilesKey , profilesConfig , ConfigurationTarget . USER ) ;
75
75
}
76
76
// Set the default profile
77
77
await this . _configurationService . updateValue ( defaultProfileKey , result . profileName , ConfigurationTarget . USER ) ;
@@ -131,14 +131,10 @@ export class TerminalProfileQuickpick {
131
131
if ( ! name ) {
132
132
return ;
133
133
}
134
- const newConfigValue : { [ key : string ] : ITerminalExecutable } = { ...configProfiles } ;
135
- newConfigValue [ name ] = { path : context . item . profile . path } ;
136
- if ( context . item . profile . args ) {
137
- newConfigValue [ name ] . args = context . item . profile . args ;
138
- }
139
- if ( context . item . profile . env ) {
140
- newConfigValue [ name ] . env = context . item . profile . env ;
141
- }
134
+ const newConfigValue : { [ key : string ] : ITerminalExecutable } = {
135
+ ...configProfiles ,
136
+ [ name ] : this . _createNewProfileConfig ( context . item . profile )
137
+ } ;
142
138
await this . _configurationService . updateValue ( profilesKey , newConfigValue , ConfigurationTarget . USER ) ;
143
139
} ,
144
140
onKeyMods : mods => keyMods = mods
@@ -215,6 +211,17 @@ export class TerminalProfileQuickpick {
215
211
return result ;
216
212
}
217
213
214
+ private _createNewProfileConfig ( profile : ITerminalProfile ) : ITerminalExecutable {
215
+ const result : ITerminalExecutable = { path : profile . path } ;
216
+ if ( profile . args ) {
217
+ result . args = profile . args ;
218
+ }
219
+ if ( profile . env ) {
220
+ result . env = profile . env ;
221
+ }
222
+ return result ;
223
+ }
224
+
218
225
private async _isProfileSafe ( profile : ITerminalProfile | IExtensionTerminalProfile ) : Promise < boolean > {
219
226
const isUnsafePath = 'isUnsafePath' in profile && profile . isUnsafePath ;
220
227
const requiresUnsafePath = 'requiresUnsafePath' in profile && profile . requiresUnsafePath ;
0 commit comments