@@ -23,7 +23,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
23
23
import { INotificationService } from 'vs/platform/notification/common/notification' ;
24
24
import { IKeyMods , IPickOptions , IQuickInputButton , IQuickInputService , IQuickPickItem , IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput' ;
25
25
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
26
- import { ICreateContributedTerminalProfileOptions , IExtensionTerminalProfile , IShellLaunchConfig , ITerminalLaunchError , ITerminalProfile , ITerminalProfileObject , ITerminalProfileType , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , TerminalLocation , TerminalLocationString , TerminalSettingId , TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal' ;
26
+ import { ICreateContributedTerminalProfileOptions , IExtensionTerminalProfile , IShellLaunchConfig , ITerminalLaunchError , ITerminalProfile , ITerminalProfileObject , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , TerminalLocation , TerminalLocationString , TerminalSettingId , TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal' ;
27
27
import { registerTerminalDefaultProfileConfiguration } from 'vs/platform/terminal/common/terminalPlatformConfiguration' ;
28
28
import { iconForeground } from 'vs/platform/theme/common/colorRegistry' ;
29
29
import { IconDefinition } from 'vs/platform/theme/common/iconRegistry' ;
@@ -72,7 +72,7 @@ export class TerminalService implements ITerminalService {
72
72
private _defaultProfileName ?: string ;
73
73
private _profilesReadyBarrier : AutoOpenBarrier ;
74
74
private _availableProfiles : ITerminalProfile [ ] | undefined ;
75
- private _contributedProfiles : IExtensionTerminalProfile [ ] | undefined ;
75
+ private _contributedProfiles : IExtensionTerminalProfile [ ] = [ ] ;
76
76
private _configHelper : TerminalConfigHelper ;
77
77
private _remoteTerminalsInitPromise : Promise < void > | undefined ;
78
78
private _localTerminalsInitPromise : Promise < void > | undefined ;
@@ -89,14 +89,8 @@ export class TerminalService implements ITerminalService {
89
89
this . _refreshAvailableProfiles ( ) ;
90
90
return this . _availableProfiles || [ ] ;
91
91
}
92
- get allProfiles ( ) : ITerminalProfileType [ ] | undefined {
93
- if ( this . _availableProfiles ) {
94
- const profiles : ITerminalProfileType [ ] = [ ] ;
95
- profiles . concat ( this . _availableProfiles ) ;
96
- profiles . concat ( this . _terminalContributionService . terminalProfiles ) ;
97
- return profiles ;
98
- }
99
- return undefined ;
92
+ get contributedProfiles ( ) : IExtensionTerminalProfile [ ] {
93
+ return this . _contributedProfiles || [ ] ;
100
94
}
101
95
get configHelper ( ) : ITerminalConfigHelper { return this . _configHelper ; }
102
96
get instances ( ) : ITerminalInstance [ ] {
@@ -511,9 +505,19 @@ export class TerminalService implements ITerminalService {
511
505
}
512
506
513
507
private async _refreshAvailableProfilesNow ( ) : Promise < void > {
508
+ const platformKey = await this . _getPlatformKey ( ) ;
514
509
const profiles = await this . _detectProfiles ( ) ;
515
510
const profilesChanged = ! equals ( profiles , this . _availableProfiles ) ;
516
- const contributedProfilesChanged = ! equals ( this . _terminalContributionService . terminalProfiles , this . _contributedProfiles ) ;
511
+ const excludedContributedProfiles : string [ ] = [ ] ;
512
+ const configProfiles : { [ key : string ] : any } = this . _configurationService . getValue ( TerminalSettingPrefix . Profiles + platformKey ) ;
513
+ for ( const [ profileName , value ] of Object . entries ( configProfiles ) ) {
514
+ if ( value === null ) {
515
+ excludedContributedProfiles . push ( profileName ) ;
516
+ }
517
+ }
518
+ const filteredContributedProfiles = Array . from ( this . _terminalContributionService . terminalProfiles . filter ( p => ! excludedContributedProfiles . includes ( p . title ) ) ) ;
519
+ const contributedProfilesChanged = ! equals ( filteredContributedProfiles , this . _contributedProfiles ) ;
520
+
517
521
if ( profiles . length === 0 && this . _ifNoProfilesTryAgain ) {
518
522
// available profiles get updated when a terminal is created
519
523
// or relevant config changes.
@@ -525,7 +529,7 @@ export class TerminalService implements ITerminalService {
525
529
}
526
530
if ( profilesChanged || contributedProfilesChanged ) {
527
531
this . _availableProfiles = profiles ;
528
- this . _contributedProfiles = Array . from ( this . _terminalContributionService . terminalProfiles ) ;
532
+ this . _contributedProfiles = filteredContributedProfiles ;
529
533
this . _onDidChangeAvailableProfiles . fire ( this . _availableProfiles ) ;
530
534
this . _profilesReadyBarrier . open ( ) ;
531
535
this . _updateWebContextKey ( ) ;
@@ -534,12 +538,12 @@ export class TerminalService implements ITerminalService {
534
538
}
535
539
536
540
private _updateWebContextKey ( ) : void {
537
- this . _webExtensionContributedProfileContextKey . set ( isWeb && this . _terminalContributionService . terminalProfiles . length > 0 ) ;
541
+ this . _webExtensionContributedProfileContextKey . set ( isWeb && this . _contributedProfiles . length > 0 ) ;
538
542
}
539
543
540
544
private async _refreshPlatformConfig ( profiles : ITerminalProfile [ ] ) {
541
545
const env = await this . _remoteAgentService . getEnvironment ( ) ;
542
- registerTerminalDefaultProfileConfiguration ( { os : env ?. os || OS , profiles } , this . _terminalContributionService . terminalProfiles ) ;
546
+ registerTerminalDefaultProfileConfiguration ( { os : env ?. os || OS , profiles } , this . _contributedProfiles ) ;
543
547
refreshTerminalActions ( profiles ) ;
544
548
}
545
549
@@ -987,7 +991,7 @@ export class TerminalService implements ITerminalService {
987
991
988
992
quickPickItems . push ( { type : 'separator' , label : nls . localize ( 'ICreateContributedTerminalProfileOptions' , "contributed" ) } ) ;
989
993
const contributedProfiles : IProfileQuickPickItem [ ] = [ ] ;
990
- for ( const contributed of this . _terminalContributionService . terminalProfiles ) {
994
+ for ( const contributed of this . contributedProfiles ) {
991
995
if ( typeof contributed . icon === 'string' && contributed . icon . startsWith ( '$(' ) ) {
992
996
contributed . icon = contributed . icon . substring ( 2 , contributed . icon . length - 1 ) ;
993
997
}
0 commit comments