@@ -20,6 +20,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
20
20
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
21
21
import { ILogService } from 'vs/platform/log/common/log' ;
22
22
import { INotificationService } from 'vs/platform/notification/common/notification' ;
23
+ import { IStorageService , StorageScope , StorageTarget , WillSaveStateReason } from 'vs/platform/storage/common/storage' ;
23
24
import { ICreateContributedTerminalProfileOptions , IShellLaunchConfig , ITerminalLaunchError , ITerminalsLayoutInfo , ITerminalsLayoutInfoById , TerminalExitReason , TerminalLocation , TerminalLocationString , TitleEventSource } from 'vs/platform/terminal/common/terminal' ;
24
25
import { formatMessageForTerminal } from 'vs/platform/terminal/common/terminalStrings' ;
25
26
import { iconForeground } from 'vs/platform/theme/common/colorRegistry' ;
@@ -29,6 +30,7 @@ import { IThemeService, Themable, ThemeIcon } from 'vs/platform/theme/common/the
29
30
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
30
31
import { VirtualWorkspaceContext } from 'vs/workbench/common/contextkeys' ;
31
32
import { IEditableData , IViewsService } from 'vs/workbench/common/views' ;
33
+ import { TaskSettingId } from 'vs/workbench/contrib/tasks/common/tasks' ;
32
34
import { ICreateTerminalOptions , IRequestAddInstanceToGroupEvent , ITerminalEditorService , ITerminalExternalLinkProvider , ITerminalGroup , ITerminalGroupService , ITerminalInstance , ITerminalInstanceHost , ITerminalInstanceService , ITerminalLocationOptions , ITerminalService , ITerminalServiceNativeDelegate , TerminalConnectionState , TerminalEditorLocation } from 'vs/workbench/contrib/terminal/browser/terminal' ;
33
35
import { getCwdForSplit } from 'vs/workbench/contrib/terminal/browser/terminalActions' ;
34
36
import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/terminalConfigHelper' ;
@@ -156,6 +158,7 @@ export class TerminalService implements ITerminalService {
156
158
constructor (
157
159
@IContextKeyService private _contextKeyService : IContextKeyService ,
158
160
@ILifecycleService private readonly _lifecycleService : ILifecycleService ,
161
+ @IStorageService private readonly _storageService : IStorageService ,
159
162
@ILogService private readonly _logService : ILogService ,
160
163
@IDialogService private _dialogService : IDialogService ,
161
164
@IInstantiationService private _instantiationService : IInstantiationService ,
@@ -218,6 +221,21 @@ export class TerminalService implements ITerminalService {
218
221
_lifecycleService . onBeforeShutdown ( async e => e . veto ( this . _onBeforeShutdown ( e . reason ) , 'veto.terminal' ) ) ;
219
222
_lifecycleService . onWillShutdown ( e => this . _onWillShutdown ( e ) ) ;
220
223
224
+ if ( this . _configurationService . getValue ( TaskSettingId . Reconnection ) ) {
225
+ // in order to reconnect to tasks, we have to show the panel
226
+ const reconnectToTaskKey = 'reconnectToTasks' ;
227
+ this . _storageService . onWillSaveState ( ( e ) => {
228
+ if ( e . reason === WillSaveStateReason . SHUTDOWN ) {
229
+ this . _storageService . store ( reconnectToTaskKey , this . instances . some ( i => i . shellLaunchConfig . type === 'Task' ) , StorageScope . WORKSPACE , StorageTarget . USER ) ;
230
+ }
231
+ } ) ;
232
+ if ( this . _storageService . getBoolean ( reconnectToTaskKey , StorageScope . WORKSPACE ) ) {
233
+ this . _viewsService . openView ( TERMINAL_VIEW_ID ) . then ( ( ) => {
234
+ this . _storageService . store ( reconnectToTaskKey , false , StorageScope . WORKSPACE , StorageTarget . USER ) ;
235
+ } ) ;
236
+ }
237
+ }
238
+
221
239
// Create async as the class depends on `this`
222
240
timeout ( 0 ) . then ( ( ) => this . _instantiationService . createInstance ( TerminalEditorStyle , document . head ) ) ;
223
241
}
0 commit comments