@@ -46,73 +46,63 @@ export abstract class BaseTerminalBackend extends Disposable {
46
46
let hasStarted = false ;
47
47
48
48
// Attach pty host listeners
49
- if ( this . _ptyHostController . onPtyHostExit ) {
50
- this . _register ( this . _ptyHostController . onPtyHostExit ( ( ) => {
51
- this . _logService . error ( `The terminal's pty host process exited, the connection to all terminal processes was lost` ) ;
52
- } ) ) ;
53
- }
54
- if ( this . _ptyHostController . onPtyHostStart ) {
55
- this . onPtyHostConnected ( ( ) => hasStarted = true ) ;
56
- this . _register ( this . _ptyHostController . onPtyHostStart ( ( ) => {
57
- this . _logService . debug ( `The terminal's pty host process is starting` ) ;
58
- // Only fire the _restart_ event after it has started
59
- if ( hasStarted ) {
60
- this . _logService . trace ( 'IPtyHostController#onPtyHostRestart' ) ;
61
- this . _onPtyHostRestart . fire ( ) ;
62
- }
63
- statusBarAccessor ?. dispose ( ) ;
64
- this . _isPtyHostUnresponsive = false ;
65
- } ) ) ;
66
- }
67
- if ( this . _ptyHostController . onPtyHostUnresponsive ) {
68
- this . _register ( this . _ptyHostController . onPtyHostUnresponsive ( ( ) => {
69
- statusBarAccessor ?. dispose ( ) ;
70
- if ( ! unresponsiveStatusBarEntry ) {
71
- unresponsiveStatusBarEntry = {
72
- name : localize ( 'ptyHostStatus' , 'Pty Host Status' ) ,
73
- text : `$(debug-disconnect) ${ localize ( 'ptyHostStatus.short' , 'Pty Host' ) } ` ,
74
- tooltip : localize ( 'nonResponsivePtyHost' , "The connection to the terminal's pty host process is unresponsive, terminals may stop working. Click to manually restart the pty host." ) ,
75
- ariaLabel : localize ( 'ptyHostStatus.ariaLabel' , 'Pty Host is unresponsive' ) ,
76
- command : TerminalCommandId . RestartPtyHost ,
77
- backgroundColor : themeColorFromId ( STATUS_BAR_WARNING_ITEM_BACKGROUND ) ,
78
- color : themeColorFromId ( STATUS_BAR_WARNING_ITEM_FOREGROUND ) ,
79
- } ;
80
- }
81
- statusBarAccessor = statusBarService . addEntry ( unresponsiveStatusBarEntry , 'ptyHostStatus' , StatusbarAlignment . LEFT ) ;
82
- this . _isPtyHostUnresponsive = true ;
83
- this . _onPtyHostUnresponsive . fire ( ) ;
84
- } ) ) ;
85
- }
86
- if ( this . _ptyHostController . onPtyHostResponsive ) {
87
- this . _register ( this . _ptyHostController . onPtyHostResponsive ( ( ) => {
88
- if ( ! this . _isPtyHostUnresponsive ) {
89
- return ;
90
- }
91
- this . _logService . info ( 'The pty host became responsive again' ) ;
92
- statusBarAccessor ?. dispose ( ) ;
93
- this . _isPtyHostUnresponsive = false ;
94
- this . _onPtyHostResponsive . fire ( ) ;
95
- } ) ) ;
96
- }
97
- if ( this . _ptyHostController . onPtyHostRequestResolveVariables ) {
98
- this . _register ( this . _ptyHostController . onPtyHostRequestResolveVariables ( async e => {
99
- // Only answer requests for this workspace
100
- if ( e . workspaceId !== this . _workspaceContextService . getWorkspace ( ) . id ) {
101
- return ;
102
- }
103
- const activeWorkspaceRootUri = historyService . getLastActiveWorkspaceRoot ( Schemas . file ) ;
104
- const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined ( this . _workspaceContextService . getWorkspaceFolder ( activeWorkspaceRootUri ) ) : undefined ;
105
- const resolveCalls : Promise < string > [ ] = e . originalText . map ( t => {
106
- return configurationResolverService . resolveAsync ( lastActiveWorkspaceRoot , t ) ;
107
- } ) ;
108
- const result = await Promise . all ( resolveCalls ) ;
109
- this . _ptyHostController . acceptPtyHostResolvedVariables ?.( e . requestId , result ) ;
110
- } ) ) ;
111
- }
49
+ this . _register ( this . _ptyHostController . onPtyHostExit ( ( ) => {
50
+ this . _logService . error ( `The terminal's pty host process exited, the connection to all terminal processes was lost` ) ;
51
+ } ) ) ;
52
+ this . onPtyHostConnected ( ( ) => hasStarted = true ) ;
53
+ this . _register ( this . _ptyHostController . onPtyHostStart ( ( ) => {
54
+ this . _logService . debug ( `The terminal's pty host process is starting` ) ;
55
+ // Only fire the _restart_ event after it has started
56
+ if ( hasStarted ) {
57
+ this . _logService . trace ( 'IPtyHostController#onPtyHostRestart' ) ;
58
+ this . _onPtyHostRestart . fire ( ) ;
59
+ }
60
+ statusBarAccessor ?. dispose ( ) ;
61
+ this . _isPtyHostUnresponsive = false ;
62
+ } ) ) ;
63
+ this . _register ( this . _ptyHostController . onPtyHostUnresponsive ( ( ) => {
64
+ statusBarAccessor ?. dispose ( ) ;
65
+ if ( ! unresponsiveStatusBarEntry ) {
66
+ unresponsiveStatusBarEntry = {
67
+ name : localize ( 'ptyHostStatus' , 'Pty Host Status' ) ,
68
+ text : `$(debug-disconnect) ${ localize ( 'ptyHostStatus.short' , 'Pty Host' ) } ` ,
69
+ tooltip : localize ( 'nonResponsivePtyHost' , "The connection to the terminal's pty host process is unresponsive, terminals may stop working. Click to manually restart the pty host." ) ,
70
+ ariaLabel : localize ( 'ptyHostStatus.ariaLabel' , 'Pty Host is unresponsive' ) ,
71
+ command : TerminalCommandId . RestartPtyHost ,
72
+ backgroundColor : themeColorFromId ( STATUS_BAR_WARNING_ITEM_BACKGROUND ) ,
73
+ color : themeColorFromId ( STATUS_BAR_WARNING_ITEM_FOREGROUND ) ,
74
+ } ;
75
+ }
76
+ statusBarAccessor = statusBarService . addEntry ( unresponsiveStatusBarEntry , 'ptyHostStatus' , StatusbarAlignment . LEFT ) ;
77
+ this . _isPtyHostUnresponsive = true ;
78
+ this . _onPtyHostUnresponsive . fire ( ) ;
79
+ } ) ) ;
80
+ this . _register ( this . _ptyHostController . onPtyHostResponsive ( ( ) => {
81
+ if ( ! this . _isPtyHostUnresponsive ) {
82
+ return ;
83
+ }
84
+ this . _logService . info ( 'The pty host became responsive again' ) ;
85
+ statusBarAccessor ?. dispose ( ) ;
86
+ this . _isPtyHostUnresponsive = false ;
87
+ this . _onPtyHostResponsive . fire ( ) ;
88
+ } ) ) ;
89
+ this . _register ( this . _ptyHostController . onPtyHostRequestResolveVariables ( async e => {
90
+ // Only answer requests for this workspace
91
+ if ( e . workspaceId !== this . _workspaceContextService . getWorkspace ( ) . id ) {
92
+ return ;
93
+ }
94
+ const activeWorkspaceRootUri = historyService . getLastActiveWorkspaceRoot ( Schemas . file ) ;
95
+ const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined ( this . _workspaceContextService . getWorkspaceFolder ( activeWorkspaceRootUri ) ) : undefined ;
96
+ const resolveCalls : Promise < string > [ ] = e . originalText . map ( t => {
97
+ return configurationResolverService . resolveAsync ( lastActiveWorkspaceRoot , t ) ;
98
+ } ) ;
99
+ const result = await Promise . all ( resolveCalls ) ;
100
+ this . _ptyHostController . acceptPtyHostResolvedVariables ( e . requestId , result ) ;
101
+ } ) ) ;
112
102
}
113
103
114
104
restartPtyHost ( ) : void {
115
- this . _ptyHostController . restartPtyHost ?. ( ) ;
105
+ this . _ptyHostController . restartPtyHost ( ) ;
116
106
}
117
107
118
108
protected _deserializeTerminalState ( serializedState : string | undefined ) : ISerializedTerminalState [ ] | undefined {
0 commit comments