@@ -8,10 +8,13 @@ import { Extensions, IOutputChannelRegistry, IOutputService, IOutputChannel, OUT
8
8
import { MainThreadOutputServiceShape , MainContext , ExtHostOutputServiceShape , ExtHostContext } from '../common/extHost.protocol.js' ;
9
9
import { extHostNamedCustomer , IExtHostContext } from '../../services/extensions/common/extHostCustomers.js' ;
10
10
import { UriComponents , URI } from '../../../base/common/uri.js' ;
11
- import { Disposable , toDisposable } from '../../../base/common/lifecycle.js' ;
11
+ import { Disposable , MutableDisposable , toDisposable } from '../../../base/common/lifecycle.js' ;
12
12
import { Event } from '../../../base/common/event.js' ;
13
13
import { IViewsService } from '../../services/views/common/viewsService.js' ;
14
14
import { isNumber } from '../../../base/common/types.js' ;
15
+ import { IConfigurationService } from '../../../platform/configuration/common/configuration.js' ;
16
+ import { IStatusbarEntry , IStatusbarEntryAccessor , IStatusbarService , StatusbarAlignment } from '../../services/statusbar/browser/statusbar.js' ;
17
+ import { localize } from '../../../nls.js' ;
15
18
16
19
@extHostNamedCustomer ( MainContext . MainThreadOutputService )
17
20
export class MainThreadOutputService extends Disposable implements MainThreadOutputServiceShape {
@@ -21,21 +24,30 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
21
24
private readonly _proxy : ExtHostOutputServiceShape ;
22
25
private readonly _outputService : IOutputService ;
23
26
private readonly _viewsService : IViewsService ;
27
+ private readonly _configurationService : IConfigurationService ;
28
+ private readonly _statusbarService : IStatusbarService ;
29
+
30
+ private readonly _outputStatusItem = this . _register ( new MutableDisposable < IStatusbarEntryAccessor > ( ) ) ;
24
31
25
32
constructor (
26
33
extHostContext : IExtHostContext ,
27
34
@IOutputService outputService : IOutputService ,
28
35
@IViewsService viewsService : IViewsService ,
36
+ @IConfigurationService configurationService : IConfigurationService ,
37
+ @IStatusbarService statusbarService : IStatusbarService ,
29
38
) {
30
39
super ( ) ;
31
40
this . _outputService = outputService ;
32
41
this . _viewsService = viewsService ;
42
+ this . _configurationService = configurationService ;
43
+ this . _statusbarService = statusbarService ;
33
44
34
45
this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostOutputService ) ;
35
46
36
47
const setVisibleChannel = ( ) => {
37
48
const visibleChannel = this . _viewsService . isViewVisible ( OUTPUT_VIEW_ID ) ? this . _outputService . getActiveChannel ( ) : undefined ;
38
49
this . _proxy . $setVisibleChannel ( visibleChannel ? visibleChannel . id : null ) ;
50
+ this . _outputStatusItem . value = undefined ;
39
51
} ;
40
52
this . _register ( Event . any < any > ( this . _outputService . onActiveOutputChannel , Event . filter ( this . _viewsService . onDidChangeViewVisibility , ( { id } ) => id === OUTPUT_VIEW_ID ) ) ( ( ) => setVisibleChannel ( ) ) ) ;
41
53
setVisibleChannel ( ) ;
@@ -65,8 +77,39 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
65
77
66
78
public async $reveal ( channelId : string , preserveFocus : boolean ) : Promise < void > {
67
79
const channel = this . _getChannel ( channelId ) ;
68
- if ( channel ) {
69
- this . _outputService . showChannel ( channel . id , preserveFocus ) ;
80
+ if ( ! channel ) {
81
+ return ;
82
+ }
83
+
84
+ const viewsToShowQuietly = this . _configurationService . getValue < Record < string , boolean > | undefined > ( 'workbench.view.showQuietly' ) ?? { } ;
85
+ if ( ! this . _viewsService . isViewVisible ( OUTPUT_VIEW_ID ) && viewsToShowQuietly [ OUTPUT_VIEW_ID ] ) {
86
+ this . _showChannelQuietly ( channel ) ;
87
+ return ;
88
+ }
89
+
90
+ this . _outputService . showChannel ( channel . id , preserveFocus ) ;
91
+ }
92
+
93
+ // Show status bar indicator
94
+ private _showChannelQuietly ( channel : IOutputChannel ) {
95
+ const statusProperties : IStatusbarEntry = {
96
+ name : localize ( 'status.showOutput' , "Show Output" ) ,
97
+ text : '$(output)' ,
98
+ ariaLabel : localize ( 'status.showOutputAria' , "Show {0} Output Channel" , channel . label ) ,
99
+ command : `workbench.action.output.show.${ channel . id } ` ,
100
+ tooltip : localize ( 'status.showOutputTooltip' , "Show {0} Output Channel" , channel . label ) ,
101
+ kind : 'prominent'
102
+ } ;
103
+
104
+ if ( ! this . _outputStatusItem . value ) {
105
+ this . _outputStatusItem . value = this . _statusbarService . addEntry (
106
+ statusProperties ,
107
+ 'status.view.showQuietly' ,
108
+ StatusbarAlignment . RIGHT ,
109
+ { id : 'status.notifications' , alignment : StatusbarAlignment . LEFT }
110
+ ) ;
111
+ } else {
112
+ this . _outputStatusItem . value . update ( statusProperties ) ;
70
113
}
71
114
}
72
115
0 commit comments