@@ -20,7 +20,7 @@ import { IContextKey, IContextKeyService } from '../../../../platform/contextkey
2020import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js' ;
2121import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js' ;
2222import { INotificationService } from '../../../../platform/notification/common/notification.js' ;
23- import { ICreateContributedTerminalProfileOptions , IExtensionTerminalProfile , IPtyHostAttachTarget , IRawTerminalInstanceLayoutInfo , IRawTerminalTabLayoutInfo , IShellLaunchConfig , ITerminalBackend , ITerminalLaunchError , ITerminalLogService , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , TerminalExitReason , TerminalLocation , TerminalLocationString , TitleEventSource } from '../../../../platform/terminal/common/terminal.js' ;
23+ import { ICreateContributedTerminalProfileOptions , IExtensionTerminalProfile , IPtyHostAttachTarget , IRawTerminalInstanceLayoutInfo , IRawTerminalTabLayoutInfo , IShellLaunchConfig , ITerminalBackend , ITerminalLaunchError , ITerminalLogService , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , TerminalExitReason , TerminalLocation , TitleEventSource } from '../../../../platform/terminal/common/terminal.js' ;
2424import { formatMessageForTerminal } from '../../../../platform/terminal/common/terminalStrings.js' ;
2525import { iconForeground } from '../../../../platform/theme/common/colorRegistry.js' ;
2626import { getIconRegistry } from '../../../../platform/theme/common/iconRegistry.js' ;
@@ -107,8 +107,6 @@ export class TerminalService extends Disposable implements ITerminalService {
107107 return this . _reconnectedTerminals . get ( reconnectionOwner ) ;
108108 }
109109
110- get defaultLocation ( ) : TerminalLocation { return this . _terminalConfigurationService . config . defaultLocation === TerminalLocationString . Editor ? TerminalLocation . Editor : TerminalLocation . Panel ; }
111-
112110 private _activeInstance : ITerminalInstance | undefined ;
113111 get activeInstance ( ) : ITerminalInstance | undefined {
114112 // Check if either an editor or panel terminal has focus and return that, regardless of the
@@ -170,7 +168,6 @@ export class TerminalService extends Disposable implements ITerminalService {
170168 @IInstantiationService private _instantiationService : IInstantiationService ,
171169 @IRemoteAgentService private _remoteAgentService : IRemoteAgentService ,
172170 @IConfigurationService private readonly _configurationService : IConfigurationService ,
173- @ITerminalConfigurationService private readonly _terminalConfigService : ITerminalConfigurationService ,
174171 @IWorkbenchEnvironmentService private readonly _environmentService : IWorkbenchEnvironmentService ,
175172 @ITerminalConfigurationService private readonly _terminalConfigurationService : ITerminalConfigurationService ,
176173 @ITerminalEditorService private readonly _terminalEditorService : ITerminalEditorService ,
@@ -203,7 +200,7 @@ export class TerminalService extends Disposable implements ITerminalService {
203200 // down. When shutting down the panel is locked in place so that it is restored upon next
204201 // launch.
205202 this . _register ( this . _terminalGroupService . onDidChangeActiveInstance ( instance => {
206- if ( ! instance && ! this . _isShuttingDown && this . _terminalConfigService . config . hideOnLastClosed ) {
203+ if ( ! instance && ! this . _isShuttingDown && this . _terminalConfigurationService . config . hideOnLastClosed ) {
207204 this . _terminalGroupService . hidePanel ( ) ;
208205 }
209206 if ( instance ?. shellType ) {
@@ -246,25 +243,26 @@ export class TerminalService extends Disposable implements ITerminalService {
246243 const keyMods : IKeyMods | undefined = result . keyMods ;
247244 if ( type === 'createInstance' ) {
248245 const activeInstance = this . getDefaultInstanceHost ( ) . activeInstance ;
246+ const defaultLocation = this . _terminalConfigurationService . defaultLocation ;
249247 let instance ;
250248
251249 if ( result . config && 'id' in result ?. config ) {
252250 await this . createContributedTerminalProfile ( result . config . extensionIdentifier , result . config . id , {
253251 icon : result . config . options ?. icon ,
254252 color : result . config . options ?. color ,
255- location : ! ! ( keyMods ?. alt && activeInstance ) ? { splitActiveTerminal : true } : this . defaultLocation
253+ location : ! ! ( keyMods ?. alt && activeInstance ) ? { splitActiveTerminal : true } : defaultLocation
256254 } ) ;
257255 return ;
258256 } else if ( result . config && 'profileName' in result . config ) {
259257 if ( keyMods ?. alt && activeInstance ) {
260258 // create split, only valid if there's an active instance
261259 instance = await this . createTerminal ( { location : { parentTerminal : activeInstance } , config : result . config , cwd } ) ;
262260 } else {
263- instance = await this . createTerminal ( { location : this . defaultLocation , config : result . config , cwd } ) ;
261+ instance = await this . createTerminal ( { location : defaultLocation , config : result . config , cwd } ) ;
264262 }
265263 }
266264
267- if ( instance && this . defaultLocation !== TerminalLocation . Editor ) {
265+ if ( instance && defaultLocation !== TerminalLocation . Editor ) {
268266 this . _terminalGroupService . showPanel ( true ) ;
269267 this . setActiveInstance ( instance ) ;
270268 return instance ;
@@ -912,7 +910,7 @@ export class TerminalService extends Disposable implements ITerminalService {
912910 }
913911
914912 getDefaultInstanceHost ( ) : ITerminalInstanceHost {
915- if ( this . defaultLocation === TerminalLocation . Editor ) {
913+ if ( this . _terminalConfigurationService . defaultLocation === TerminalLocation . Editor ) {
916914 return this . _terminalEditorService ;
917915 }
918916 return this . _terminalGroupService ;
@@ -1003,7 +1001,7 @@ export class TerminalService extends Disposable implements ITerminalService {
10031001 }
10041002
10051003 this . _evaluateLocalCwd ( shellLaunchConfig ) ;
1006- const location = await this . resolveLocation ( options ?. location ) || this . defaultLocation ;
1004+ const location = await this . resolveLocation ( options ?. location ) || this . _terminalConfigurationService . defaultLocation ;
10071005 const parent = await this . _getSplitParent ( options ?. location ) ;
10081006 this . _terminalHasBeenCreated . set ( true ) ;
10091007 this . _extensionService . activateByEvent ( 'onTerminal:*' ) ;
@@ -1070,7 +1068,7 @@ export class TerminalService extends Disposable implements ITerminalService {
10701068 if ( ! parent ) {
10711069 throw new Error ( 'Cannot split without an active instance' ) ;
10721070 }
1073- shellLaunchConfig . cwd = await getCwdForSplit ( parent , this . _workspaceContextService . getWorkspace ( ) . folders , this . _commandService , this . _terminalConfigService ) ;
1071+ shellLaunchConfig . cwd = await getCwdForSplit ( parent , this . _workspaceContextService . getWorkspace ( ) . folders , this . _commandService , this . _terminalConfigurationService ) ;
10741072 }
10751073 }
10761074 }
0 commit comments