@codingame/monaco-vscode-output-service-override 1.83.7 → 1.83.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/tslib/tslib.es6.js +11 -0
- package/index.js +1 -1
- package/output.d.ts +4 -0
- package/output.js +14 -0
- package/package.json +4 -3
- package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +488 -0
- package/vscode/src/vs/workbench/contrib/output/browser/outputLinkProvider.js +78 -0
- package/vscode/src/vs/workbench/contrib/output/browser/outputServices.js +168 -0
- package/vscode/src/vs/workbench/contrib/output/browser/outputView.js +236 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '
|
|
1
|
+
export { default } from './output.js';
|
package/output.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
2
|
import { LogLevel } from 'vscode/vscode/vs/platform/log/common/log';
|
|
3
3
|
|
|
4
|
+
declare function getServiceOverride(): IEditorOverrideServices;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Provide logLevel via the services `initialize` function `configuration.developmentOptions.logLevel` parameter
|
|
7
|
+
*/
|
|
4
8
|
declare function getServiceOverride(logLevel?: LogLevel): IEditorOverrideServices;
|
|
5
9
|
|
|
6
10
|
export { getServiceOverride as default };
|
package/output.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
2
|
+
import { OutputService } from './vscode/src/vs/workbench/contrib/output/browser/outputServices.js';
|
|
3
|
+
import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
4
|
+
import getServiceOverride$1 from '@codingame/monaco-vscode-log-service-override';
|
|
5
|
+
import './vscode/src/vs/workbench/contrib/output/browser/output.contribution.js';
|
|
6
|
+
|
|
7
|
+
function getServiceOverride(logLevel) {
|
|
8
|
+
return {
|
|
9
|
+
...getServiceOverride$1(logLevel),
|
|
10
|
+
[( IOutputService.toString())]: new SyncDescriptor(OutputService, undefined, true)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-output-service-override",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.9",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.83.
|
|
22
|
-
"monaco-editor": "0.44.0"
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.9",
|
|
22
|
+
"monaco-editor": "0.44.0",
|
|
23
|
+
"@codingame/monaco-vscode-log-service-override": "1.83.9"
|
|
23
24
|
},
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import * as aria from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
4
|
+
import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
5
|
+
import { ModesRegistry } from 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
|
|
6
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
7
|
+
import { registerAction2, Action2, MenuId, MenuRegistry } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
8
|
+
import { OUTPUT_MODE_ID, OUTPUT_MIME, LOG_MODE_ID, LOG_MIME, OUTPUT_VIEW_ID, IOutputService, Extensions as Extensions$3, CONTEXT_IN_OUTPUT, CONTEXT_OUTPUT_SCROLL_LOCK, CONTEXT_ACTIVE_LOG_OUTPUT, ACTIVE_OUTPUT_CHANNEL_CONTEXT } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
9
|
+
import { OutputViewPane } from './outputView.js';
|
|
10
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
11
|
+
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
12
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
13
|
+
import { Extensions, IViewsService } from 'vscode/vscode/vs/workbench/common/views';
|
|
14
|
+
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
15
|
+
import { Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
16
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
17
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
18
|
+
import { assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
19
|
+
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
20
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
21
|
+
import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
22
|
+
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
23
|
+
import { Disposable, toDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
24
|
+
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
25
|
+
|
|
26
|
+
ModesRegistry.registerLanguage({
|
|
27
|
+
id: OUTPUT_MODE_ID,
|
|
28
|
+
extensions: [],
|
|
29
|
+
mimetypes: [OUTPUT_MIME]
|
|
30
|
+
});
|
|
31
|
+
ModesRegistry.registerLanguage({
|
|
32
|
+
id: LOG_MODE_ID,
|
|
33
|
+
extensions: [],
|
|
34
|
+
mimetypes: [LOG_MIME]
|
|
35
|
+
});
|
|
36
|
+
const outputViewIcon = registerIcon('output-view-icon', Codicon.output, ( nls.localizeWithPath(
|
|
37
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
38
|
+
'outputViewIcon',
|
|
39
|
+
'View icon of the output view.'
|
|
40
|
+
)));
|
|
41
|
+
const VIEW_CONTAINER = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
|
|
42
|
+
id: OUTPUT_VIEW_ID,
|
|
43
|
+
title: { value: ( nls.localizeWithPath(
|
|
44
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
45
|
+
'output',
|
|
46
|
+
"Output"
|
|
47
|
+
)), original: 'Output' },
|
|
48
|
+
icon: outputViewIcon,
|
|
49
|
+
order: 1,
|
|
50
|
+
ctorDescriptor: ( new SyncDescriptor(
|
|
51
|
+
ViewPaneContainer,
|
|
52
|
+
[OUTPUT_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]
|
|
53
|
+
)),
|
|
54
|
+
storageId: OUTPUT_VIEW_ID,
|
|
55
|
+
hideIfEmpty: true,
|
|
56
|
+
}, 1 , { doNotRegisterOpenCommand: true });
|
|
57
|
+
( Registry.as(Extensions.ViewsRegistry)).registerViews([{
|
|
58
|
+
id: OUTPUT_VIEW_ID,
|
|
59
|
+
name: ( nls.localizeWithPath(
|
|
60
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
61
|
+
'output',
|
|
62
|
+
"Output"
|
|
63
|
+
)),
|
|
64
|
+
containerIcon: outputViewIcon,
|
|
65
|
+
canMoveView: true,
|
|
66
|
+
canToggleVisibility: false,
|
|
67
|
+
ctorDescriptor: ( new SyncDescriptor(OutputViewPane)),
|
|
68
|
+
openCommandActionDescriptor: {
|
|
69
|
+
id: 'workbench.action.output.toggleOutput',
|
|
70
|
+
mnemonicTitle: ( nls.localizeWithPath(
|
|
71
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
72
|
+
{ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] },
|
|
73
|
+
"&&Output"
|
|
74
|
+
)),
|
|
75
|
+
keybindings: {
|
|
76
|
+
primary: 2048 | 1024 | 51 ,
|
|
77
|
+
linux: {
|
|
78
|
+
primary: KeyChord(2048 | 41 , 2048 | 38 )
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
order: 1,
|
|
82
|
+
}
|
|
83
|
+
}], VIEW_CONTAINER);
|
|
84
|
+
let OutputContribution = class OutputContribution extends Disposable {
|
|
85
|
+
constructor(instantiationService, outputService) {
|
|
86
|
+
super();
|
|
87
|
+
this.outputService = outputService;
|
|
88
|
+
this.registerActions();
|
|
89
|
+
}
|
|
90
|
+
registerActions() {
|
|
91
|
+
this.registerSwitchOutputAction();
|
|
92
|
+
this.registerShowOutputChannelsAction();
|
|
93
|
+
this.registerClearOutputAction();
|
|
94
|
+
this.registerToggleAutoScrollAction();
|
|
95
|
+
this.registerOpenActiveLogOutputFileAction();
|
|
96
|
+
this.registerShowLogsAction();
|
|
97
|
+
this.registerOpenLogFileAction();
|
|
98
|
+
}
|
|
99
|
+
registerSwitchOutputAction() {
|
|
100
|
+
this._register(registerAction2(class extends Action2 {
|
|
101
|
+
constructor() {
|
|
102
|
+
super({
|
|
103
|
+
id: `workbench.output.action.switchBetweenOutputs`,
|
|
104
|
+
title: ( nls.localizeWithPath(
|
|
105
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
106
|
+
'switchBetweenOutputs.label',
|
|
107
|
+
"Switch Output"
|
|
108
|
+
)),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async run(accessor, channelId) {
|
|
112
|
+
if (channelId) {
|
|
113
|
+
accessor.get(IOutputService).showChannel(channelId, true);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
const switchOutputMenu = ( new MenuId('workbench.output.menu.switchOutput'));
|
|
118
|
+
this._register(MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
|
|
119
|
+
submenu: switchOutputMenu,
|
|
120
|
+
title: ( nls.localizeWithPath(
|
|
121
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
122
|
+
'switchToOutput.label',
|
|
123
|
+
"Switch Output"
|
|
124
|
+
)),
|
|
125
|
+
group: 'navigation',
|
|
126
|
+
when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
|
|
127
|
+
order: 1,
|
|
128
|
+
isSelection: true
|
|
129
|
+
}));
|
|
130
|
+
const registeredChannels = ( new Map());
|
|
131
|
+
this._register(toDisposable(() => dispose(( registeredChannels.values()))));
|
|
132
|
+
const registerOutputChannels = (channels) => {
|
|
133
|
+
for (const channel of channels) {
|
|
134
|
+
const title = channel.label;
|
|
135
|
+
const group = channel.extensionId ? '0_ext_outputchannels' : '1_core_outputchannels';
|
|
136
|
+
registeredChannels.set(channel.id, registerAction2(class extends Action2 {
|
|
137
|
+
constructor() {
|
|
138
|
+
super({
|
|
139
|
+
id: `workbench.action.output.show.${channel.id}`,
|
|
140
|
+
title,
|
|
141
|
+
toggled: ( ACTIVE_OUTPUT_CHANNEL_CONTEXT.isEqualTo(channel.id)),
|
|
142
|
+
menu: {
|
|
143
|
+
id: switchOutputMenu,
|
|
144
|
+
group,
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async run(accessor) {
|
|
149
|
+
return accessor.get(IOutputService).showChannel(channel.id, true);
|
|
150
|
+
}
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
registerOutputChannels(this.outputService.getChannelDescriptors());
|
|
155
|
+
const outputChannelRegistry = ( Registry.as(Extensions$3.OutputChannels));
|
|
156
|
+
this._register(outputChannelRegistry.onDidRegisterChannel(e => {
|
|
157
|
+
const channel = this.outputService.getChannelDescriptor(e);
|
|
158
|
+
if (channel) {
|
|
159
|
+
registerOutputChannels([channel]);
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
this._register(outputChannelRegistry.onDidRemoveChannel(e => {
|
|
163
|
+
registeredChannels.get(e)?.dispose();
|
|
164
|
+
registeredChannels.delete(e);
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
registerShowOutputChannelsAction() {
|
|
168
|
+
this._register(registerAction2(class extends Action2 {
|
|
169
|
+
constructor() {
|
|
170
|
+
super({
|
|
171
|
+
id: 'workbench.action.showOutputChannels',
|
|
172
|
+
title: { value: ( nls.localizeWithPath(
|
|
173
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
174
|
+
'showOutputChannels',
|
|
175
|
+
"Show Output Channels..."
|
|
176
|
+
)), original: 'Show Output Channels...' },
|
|
177
|
+
category: { value: ( nls.localizeWithPath(
|
|
178
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
179
|
+
'output',
|
|
180
|
+
"Output"
|
|
181
|
+
)), original: 'Output' },
|
|
182
|
+
f1: true
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async run(accessor) {
|
|
186
|
+
const outputService = accessor.get(IOutputService);
|
|
187
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
188
|
+
const extensionChannels = [], coreChannels = [];
|
|
189
|
+
for (const channel of outputService.getChannelDescriptors()) {
|
|
190
|
+
if (channel.extensionId) {
|
|
191
|
+
extensionChannels.push(channel);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
coreChannels.push(channel);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const entries = [];
|
|
198
|
+
for (const { id, label } of extensionChannels) {
|
|
199
|
+
entries.push({ id, label });
|
|
200
|
+
}
|
|
201
|
+
if (extensionChannels.length && coreChannels.length) {
|
|
202
|
+
entries.push({ type: 'separator' });
|
|
203
|
+
}
|
|
204
|
+
for (const { id, label } of coreChannels) {
|
|
205
|
+
entries.push({ id, label });
|
|
206
|
+
}
|
|
207
|
+
const entry = await quickInputService.pick(entries, { placeHolder: ( nls.localizeWithPath(
|
|
208
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
209
|
+
'selectOutput',
|
|
210
|
+
"Select Output Channel"
|
|
211
|
+
)) });
|
|
212
|
+
if (entry) {
|
|
213
|
+
return outputService.showChannel(entry.id);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
registerClearOutputAction() {
|
|
219
|
+
this._register(registerAction2(class extends Action2 {
|
|
220
|
+
constructor() {
|
|
221
|
+
super({
|
|
222
|
+
id: `workbench.output.action.clearOutput`,
|
|
223
|
+
title: { value: ( nls.localizeWithPath(
|
|
224
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
225
|
+
'clearOutput.label',
|
|
226
|
+
"Clear Output"
|
|
227
|
+
)), original: 'Clear Output' },
|
|
228
|
+
category: Categories.View,
|
|
229
|
+
menu: [{
|
|
230
|
+
id: MenuId.ViewTitle,
|
|
231
|
+
when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
|
|
232
|
+
group: 'navigation',
|
|
233
|
+
order: 2
|
|
234
|
+
}, {
|
|
235
|
+
id: MenuId.CommandPalette
|
|
236
|
+
}, {
|
|
237
|
+
id: MenuId.EditorContext,
|
|
238
|
+
when: CONTEXT_IN_OUTPUT
|
|
239
|
+
}],
|
|
240
|
+
icon: Codicon.clearAll
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
async run(accessor) {
|
|
244
|
+
const outputService = accessor.get(IOutputService);
|
|
245
|
+
const activeChannel = outputService.getActiveChannel();
|
|
246
|
+
if (activeChannel) {
|
|
247
|
+
activeChannel.clear();
|
|
248
|
+
aria.status(( nls.localizeWithPath(
|
|
249
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
250
|
+
'outputCleared',
|
|
251
|
+
"Output was cleared"
|
|
252
|
+
)));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
registerToggleAutoScrollAction() {
|
|
258
|
+
this._register(registerAction2(class extends Action2 {
|
|
259
|
+
constructor() {
|
|
260
|
+
super({
|
|
261
|
+
id: `workbench.output.action.toggleAutoScroll`,
|
|
262
|
+
title: { value: ( nls.localizeWithPath(
|
|
263
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
264
|
+
'toggleAutoScroll',
|
|
265
|
+
"Toggle Auto Scrolling"
|
|
266
|
+
)), original: 'Toggle Auto Scrolling' },
|
|
267
|
+
tooltip: ( nls.localizeWithPath(
|
|
268
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
269
|
+
'outputScrollOff',
|
|
270
|
+
"Turn Auto Scrolling Off"
|
|
271
|
+
)),
|
|
272
|
+
menu: {
|
|
273
|
+
id: MenuId.ViewTitle,
|
|
274
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)))),
|
|
275
|
+
group: 'navigation',
|
|
276
|
+
order: 3,
|
|
277
|
+
},
|
|
278
|
+
icon: Codicon.lock,
|
|
279
|
+
toggled: {
|
|
280
|
+
condition: CONTEXT_OUTPUT_SCROLL_LOCK,
|
|
281
|
+
icon: Codicon.unlock,
|
|
282
|
+
tooltip: ( nls.localizeWithPath(
|
|
283
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
284
|
+
'outputScrollOn',
|
|
285
|
+
"Turn Auto Scrolling On"
|
|
286
|
+
))
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
async run(accessor) {
|
|
291
|
+
const outputView = accessor.get(IViewsService).getActiveViewWithId(OUTPUT_VIEW_ID);
|
|
292
|
+
outputView.scrollLock = !outputView.scrollLock;
|
|
293
|
+
}
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
registerOpenActiveLogOutputFileAction() {
|
|
297
|
+
this._register(registerAction2(class extends Action2 {
|
|
298
|
+
constructor() {
|
|
299
|
+
super({
|
|
300
|
+
id: `workbench.action.openActiveLogOutputFile`,
|
|
301
|
+
title: { value: ( nls.localizeWithPath(
|
|
302
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
303
|
+
'openActiveLogOutputFile',
|
|
304
|
+
"Open Log Output File"
|
|
305
|
+
)), original: 'Open Log Output File' },
|
|
306
|
+
menu: [{
|
|
307
|
+
id: MenuId.ViewTitle,
|
|
308
|
+
when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
|
|
309
|
+
group: 'navigation',
|
|
310
|
+
order: 4
|
|
311
|
+
}],
|
|
312
|
+
icon: Codicon.goToFile,
|
|
313
|
+
precondition: CONTEXT_ACTIVE_LOG_OUTPUT
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
async run(accessor) {
|
|
317
|
+
const outputService = accessor.get(IOutputService);
|
|
318
|
+
const editorService = accessor.get(IEditorService);
|
|
319
|
+
const fileConfigurationService = accessor.get(IFilesConfigurationService);
|
|
320
|
+
const logFileOutputChannelDescriptor = this.getLogFileOutputChannelDescriptor(outputService);
|
|
321
|
+
if (logFileOutputChannelDescriptor) {
|
|
322
|
+
await fileConfigurationService.updateReadonly(logFileOutputChannelDescriptor.file, true);
|
|
323
|
+
await editorService.openEditor({
|
|
324
|
+
resource: logFileOutputChannelDescriptor.file,
|
|
325
|
+
options: {
|
|
326
|
+
pinned: true,
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
getLogFileOutputChannelDescriptor(outputService) {
|
|
332
|
+
const channel = outputService.getActiveChannel();
|
|
333
|
+
if (channel) {
|
|
334
|
+
const descriptor = outputService.getChannelDescriptors().filter(c => c.id === channel.id)[0];
|
|
335
|
+
if (descriptor && descriptor.file && descriptor.log) {
|
|
336
|
+
return descriptor;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
registerShowLogsAction() {
|
|
344
|
+
this._register(registerAction2(class extends Action2 {
|
|
345
|
+
constructor() {
|
|
346
|
+
super({
|
|
347
|
+
id: 'workbench.action.showLogs',
|
|
348
|
+
title: { value: ( nls.localizeWithPath(
|
|
349
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
350
|
+
'showLogs',
|
|
351
|
+
"Show Logs..."
|
|
352
|
+
)), original: 'Show Logs...' },
|
|
353
|
+
category: Categories.Developer,
|
|
354
|
+
menu: {
|
|
355
|
+
id: MenuId.CommandPalette,
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
async run(accessor) {
|
|
360
|
+
const outputService = accessor.get(IOutputService);
|
|
361
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
362
|
+
const extensionLogs = [], logs = [];
|
|
363
|
+
for (const channel of outputService.getChannelDescriptors()) {
|
|
364
|
+
if (channel.log) {
|
|
365
|
+
if (channel.extensionId) {
|
|
366
|
+
extensionLogs.push(channel);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
logs.push(channel);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const entries = [];
|
|
374
|
+
for (const { id, label } of logs) {
|
|
375
|
+
entries.push({ id, label });
|
|
376
|
+
}
|
|
377
|
+
if (extensionLogs.length && logs.length) {
|
|
378
|
+
entries.push({ type: 'separator', label: ( nls.localizeWithPath(
|
|
379
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
380
|
+
'extensionLogs',
|
|
381
|
+
"Extension Logs"
|
|
382
|
+
)) });
|
|
383
|
+
}
|
|
384
|
+
for (const { id, label } of extensionLogs) {
|
|
385
|
+
entries.push({ id, label });
|
|
386
|
+
}
|
|
387
|
+
const entry = await quickInputService.pick(entries, { placeHolder: ( nls.localizeWithPath(
|
|
388
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
389
|
+
'selectlog',
|
|
390
|
+
"Select Log"
|
|
391
|
+
)) });
|
|
392
|
+
if (entry) {
|
|
393
|
+
return outputService.showChannel(entry.id);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}));
|
|
397
|
+
}
|
|
398
|
+
registerOpenLogFileAction() {
|
|
399
|
+
this._register(registerAction2(class extends Action2 {
|
|
400
|
+
constructor() {
|
|
401
|
+
super({
|
|
402
|
+
id: 'workbench.action.openLogFile',
|
|
403
|
+
title: { value: ( nls.localizeWithPath(
|
|
404
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
405
|
+
'openLogFile',
|
|
406
|
+
"Open Log File..."
|
|
407
|
+
)), original: 'Open Log File...' },
|
|
408
|
+
category: Categories.Developer,
|
|
409
|
+
menu: {
|
|
410
|
+
id: MenuId.CommandPalette,
|
|
411
|
+
},
|
|
412
|
+
description: {
|
|
413
|
+
description: 'workbench.action.openLogFile',
|
|
414
|
+
args: [{
|
|
415
|
+
name: 'logFile',
|
|
416
|
+
schema: {
|
|
417
|
+
markdownDescription: ( nls.localizeWithPath(
|
|
418
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
419
|
+
'logFile',
|
|
420
|
+
"The id of the log file to open, for example `\"window\"`. Currently the best way to get this is to get the ID by checking the `workbench.action.output.show.<id>` commands"
|
|
421
|
+
)),
|
|
422
|
+
type: 'string'
|
|
423
|
+
}
|
|
424
|
+
}]
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
async run(accessor, args) {
|
|
429
|
+
const outputService = accessor.get(IOutputService);
|
|
430
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
431
|
+
const editorService = accessor.get(IEditorService);
|
|
432
|
+
const fileConfigurationService = accessor.get(IFilesConfigurationService);
|
|
433
|
+
const entries = ( outputService.getChannelDescriptors().filter(c => c.file && c.log)
|
|
434
|
+
.map(channel => ({ id: channel.id, label: channel.label, channel })));
|
|
435
|
+
const argName = args && typeof args === 'string' ? args : undefined;
|
|
436
|
+
let entry;
|
|
437
|
+
if (argName) {
|
|
438
|
+
entry = entries.find(e => e.id === argName);
|
|
439
|
+
}
|
|
440
|
+
if (!entry) {
|
|
441
|
+
entry = await quickInputService.pick(entries, { placeHolder: ( nls.localizeWithPath(
|
|
442
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
443
|
+
'selectlogFile',
|
|
444
|
+
"Select Log File"
|
|
445
|
+
)) });
|
|
446
|
+
}
|
|
447
|
+
if (entry) {
|
|
448
|
+
const resource = assertIsDefined(entry.channel.file);
|
|
449
|
+
await fileConfigurationService.updateReadonly(resource, true);
|
|
450
|
+
await editorService.openEditor({
|
|
451
|
+
resource,
|
|
452
|
+
options: {
|
|
453
|
+
pinned: true,
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}));
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
OutputContribution = ( __decorate([
|
|
462
|
+
( __param(0, IInstantiationService)),
|
|
463
|
+
( __param(1, IOutputService))
|
|
464
|
+
], OutputContribution));
|
|
465
|
+
( Registry.as(Extensions$1.Workbench)).registerWorkbenchContribution(OutputContribution, 3 );
|
|
466
|
+
( Registry.as(Extensions$2.Configuration)).registerConfiguration({
|
|
467
|
+
id: 'output',
|
|
468
|
+
order: 30,
|
|
469
|
+
title: ( nls.localizeWithPath(
|
|
470
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
471
|
+
'output',
|
|
472
|
+
"Output"
|
|
473
|
+
)),
|
|
474
|
+
type: 'object',
|
|
475
|
+
properties: {
|
|
476
|
+
'output.smartScroll.enabled': {
|
|
477
|
+
type: 'boolean',
|
|
478
|
+
description: ( nls.localizeWithPath(
|
|
479
|
+
'vs/workbench/contrib/output/browser/output.contribution',
|
|
480
|
+
'output.smartScroll.enabled',
|
|
481
|
+
"Enable/disable the ability of smart scrolling in the output view. Smart scrolling allows you to lock scrolling automatically when you click in the output view and unlocks when you click in the last line."
|
|
482
|
+
)),
|
|
483
|
+
default: true,
|
|
484
|
+
scope: 3 ,
|
|
485
|
+
tags: ['output']
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
3
|
+
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
4
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
5
|
+
import { OUTPUT_MODE_ID, LOG_MODE_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
6
|
+
import { createWebWorker } from 'monaco-editor/esm/vs/editor/browser/services/webWorker.js';
|
|
7
|
+
import { dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
8
|
+
import { ILanguageConfigurationService } from 'monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
|
|
9
|
+
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
10
|
+
|
|
11
|
+
var OutputLinkProvider_1;
|
|
12
|
+
let OutputLinkProvider = class OutputLinkProvider {
|
|
13
|
+
static { OutputLinkProvider_1 = this; }
|
|
14
|
+
static { this.DISPOSE_WORKER_TIME = 3 * 60 * 1000; }
|
|
15
|
+
constructor(contextService, modelService, languageConfigurationService, languageFeaturesService) {
|
|
16
|
+
this.contextService = contextService;
|
|
17
|
+
this.modelService = modelService;
|
|
18
|
+
this.languageConfigurationService = languageConfigurationService;
|
|
19
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
20
|
+
this.disposeWorkerScheduler = ( new RunOnceScheduler(() => this.disposeWorker(), OutputLinkProvider_1.DISPOSE_WORKER_TIME));
|
|
21
|
+
this.registerListeners();
|
|
22
|
+
this.updateLinkProviderWorker();
|
|
23
|
+
}
|
|
24
|
+
registerListeners() {
|
|
25
|
+
this.contextService.onDidChangeWorkspaceFolders(() => this.updateLinkProviderWorker());
|
|
26
|
+
}
|
|
27
|
+
updateLinkProviderWorker() {
|
|
28
|
+
const folders = this.contextService.getWorkspace().folders;
|
|
29
|
+
if (folders.length > 0) {
|
|
30
|
+
if (!this.linkProviderRegistration) {
|
|
31
|
+
this.linkProviderRegistration = this.languageFeaturesService.linkProvider.register([{ language: OUTPUT_MODE_ID, scheme: '*' }, { language: LOG_MODE_ID, scheme: '*' }], {
|
|
32
|
+
provideLinks: async (model) => {
|
|
33
|
+
const links = await this.provideLinks(model.uri);
|
|
34
|
+
return links && { links };
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
dispose(this.linkProviderRegistration);
|
|
41
|
+
this.linkProviderRegistration = undefined;
|
|
42
|
+
}
|
|
43
|
+
this.disposeWorker();
|
|
44
|
+
this.disposeWorkerScheduler.cancel();
|
|
45
|
+
}
|
|
46
|
+
getOrCreateWorker() {
|
|
47
|
+
this.disposeWorkerScheduler.schedule();
|
|
48
|
+
if (!this.worker) {
|
|
49
|
+
const createData = {
|
|
50
|
+
workspaceFolders: ( this.contextService.getWorkspace().folders.map(folder => ( folder.uri.toString())))
|
|
51
|
+
};
|
|
52
|
+
this.worker = createWebWorker(this.modelService, this.languageConfigurationService, {
|
|
53
|
+
moduleId: 'vs/workbench/contrib/output/common/outputLinkComputer',
|
|
54
|
+
createData,
|
|
55
|
+
label: 'outputLinkComputer'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return this.worker;
|
|
59
|
+
}
|
|
60
|
+
async provideLinks(modelUri) {
|
|
61
|
+
const linkComputer = await this.getOrCreateWorker().withSyncedResources([modelUri]);
|
|
62
|
+
return linkComputer.computeLinks(( modelUri.toString()));
|
|
63
|
+
}
|
|
64
|
+
disposeWorker() {
|
|
65
|
+
if (this.worker) {
|
|
66
|
+
this.worker.dispose();
|
|
67
|
+
this.worker = undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
OutputLinkProvider = OutputLinkProvider_1 = ( __decorate([
|
|
72
|
+
( __param(0, IWorkspaceContextService)),
|
|
73
|
+
( __param(1, IModelService)),
|
|
74
|
+
( __param(2, ILanguageConfigurationService)),
|
|
75
|
+
( __param(3, ILanguageFeaturesService))
|
|
76
|
+
], OutputLinkProvider));
|
|
77
|
+
|
|
78
|
+
export { OutputLinkProvider };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
4
|
+
import { Disposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
6
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
7
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
8
|
+
import { OUTPUT_SCHEME, LOG_MIME, OUTPUT_MIME, ACTIVE_OUTPUT_CHANNEL_CONTEXT, CONTEXT_ACTIVE_LOG_OUTPUT, Extensions, OUTPUT_VIEW_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
9
|
+
import { OutputLinkProvider } from './outputLinkProvider.js';
|
|
10
|
+
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
11
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
12
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
13
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/common/views';
|
|
14
|
+
import { IOutputChannelModelService } from 'vscode/vscode/vs/workbench/contrib/output/common/outputChannelModelService';
|
|
15
|
+
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
16
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
17
|
+
|
|
18
|
+
const OUTPUT_ACTIVE_CHANNEL_KEY = 'output.activechannel';
|
|
19
|
+
let OutputChannel = class OutputChannel extends Disposable {
|
|
20
|
+
constructor(outputChannelDescriptor, outputChannelModelService, languageService) {
|
|
21
|
+
super();
|
|
22
|
+
this.outputChannelDescriptor = outputChannelDescriptor;
|
|
23
|
+
this.scrollLock = false;
|
|
24
|
+
this.id = outputChannelDescriptor.id;
|
|
25
|
+
this.label = outputChannelDescriptor.label;
|
|
26
|
+
this.uri = ( URI.from({ scheme: OUTPUT_SCHEME, path: this.id }));
|
|
27
|
+
this.model = this._register(outputChannelModelService.createOutputChannelModel(this.id, this.uri, outputChannelDescriptor.languageId ? languageService.createById(outputChannelDescriptor.languageId) : languageService.createByMimeType(outputChannelDescriptor.log ? LOG_MIME : OUTPUT_MIME), outputChannelDescriptor.file));
|
|
28
|
+
}
|
|
29
|
+
append(output) {
|
|
30
|
+
this.model.append(output);
|
|
31
|
+
}
|
|
32
|
+
update(mode, till) {
|
|
33
|
+
this.model.update(mode, till, true);
|
|
34
|
+
}
|
|
35
|
+
clear() {
|
|
36
|
+
this.model.clear();
|
|
37
|
+
}
|
|
38
|
+
replace(value) {
|
|
39
|
+
this.model.replace(value);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
OutputChannel = ( __decorate([
|
|
43
|
+
( __param(1, IOutputChannelModelService)),
|
|
44
|
+
( __param(2, ILanguageService))
|
|
45
|
+
], OutputChannel));
|
|
46
|
+
let OutputService = class OutputService extends Disposable {
|
|
47
|
+
constructor(storageService, instantiationService, textModelResolverService, logService, lifecycleService, viewsService, contextKeyService) {
|
|
48
|
+
super();
|
|
49
|
+
this.storageService = storageService;
|
|
50
|
+
this.instantiationService = instantiationService;
|
|
51
|
+
this.logService = logService;
|
|
52
|
+
this.lifecycleService = lifecycleService;
|
|
53
|
+
this.viewsService = viewsService;
|
|
54
|
+
this.channels = ( new Map());
|
|
55
|
+
this._onActiveOutputChannel = this._register(( new Emitter()));
|
|
56
|
+
this.onActiveOutputChannel = this._onActiveOutputChannel.event;
|
|
57
|
+
this.activeChannelIdInStorage = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, 1 , '');
|
|
58
|
+
this.activeOutputChannelContext = ACTIVE_OUTPUT_CHANNEL_CONTEXT.bindTo(contextKeyService);
|
|
59
|
+
this.activeOutputChannelContext.set(this.activeChannelIdInStorage);
|
|
60
|
+
this._register(this.onActiveOutputChannel(channel => this.activeOutputChannelContext.set(channel)));
|
|
61
|
+
this.activeLogOutputChannelContext = CONTEXT_ACTIVE_LOG_OUTPUT.bindTo(contextKeyService);
|
|
62
|
+
textModelResolverService.registerTextModelContentProvider(OUTPUT_SCHEME, this);
|
|
63
|
+
instantiationService.createInstance(OutputLinkProvider);
|
|
64
|
+
const registry = ( Registry.as(Extensions.OutputChannels));
|
|
65
|
+
for (const channelIdentifier of registry.getChannels()) {
|
|
66
|
+
this.onDidRegisterChannel(channelIdentifier.id);
|
|
67
|
+
}
|
|
68
|
+
this._register(registry.onDidRegisterChannel(this.onDidRegisterChannel, this));
|
|
69
|
+
if (!this.activeChannel) {
|
|
70
|
+
const channels = this.getChannelDescriptors();
|
|
71
|
+
this.setActiveChannel(channels && channels.length > 0 ? this.getChannel(channels[0].id) : undefined);
|
|
72
|
+
}
|
|
73
|
+
this._register(Event.filter(this.viewsService.onDidChangeViewVisibility, e => e.id === OUTPUT_VIEW_ID && e.visible)(() => {
|
|
74
|
+
if (this.activeChannel) {
|
|
75
|
+
this.viewsService.getActiveViewWithId(OUTPUT_VIEW_ID)?.showChannel(this.activeChannel, true);
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
|
|
79
|
+
}
|
|
80
|
+
provideTextContent(resource) {
|
|
81
|
+
const channel = this.getChannel(resource.path);
|
|
82
|
+
if (channel) {
|
|
83
|
+
return channel.model.loadModel();
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
async showChannel(id, preserveFocus) {
|
|
88
|
+
const channel = this.getChannel(id);
|
|
89
|
+
if (this.activeChannel?.id !== channel?.id) {
|
|
90
|
+
this.setActiveChannel(channel);
|
|
91
|
+
this._onActiveOutputChannel.fire(id);
|
|
92
|
+
}
|
|
93
|
+
const outputView = await this.viewsService.openView(OUTPUT_VIEW_ID, !preserveFocus);
|
|
94
|
+
if (outputView && channel) {
|
|
95
|
+
outputView.showChannel(channel, !!preserveFocus);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
getChannel(id) {
|
|
99
|
+
return this.channels.get(id);
|
|
100
|
+
}
|
|
101
|
+
getChannelDescriptor(id) {
|
|
102
|
+
return ( Registry.as(Extensions.OutputChannels)).getChannel(id);
|
|
103
|
+
}
|
|
104
|
+
getChannelDescriptors() {
|
|
105
|
+
return ( Registry.as(Extensions.OutputChannels)).getChannels();
|
|
106
|
+
}
|
|
107
|
+
getActiveChannel() {
|
|
108
|
+
return this.activeChannel;
|
|
109
|
+
}
|
|
110
|
+
async onDidRegisterChannel(channelId) {
|
|
111
|
+
const channel = this.createChannel(channelId);
|
|
112
|
+
this.channels.set(channelId, channel);
|
|
113
|
+
if (!this.activeChannel || this.activeChannelIdInStorage === channelId) {
|
|
114
|
+
this.setActiveChannel(channel);
|
|
115
|
+
this._onActiveOutputChannel.fire(channelId);
|
|
116
|
+
const outputView = this.viewsService.getActiveViewWithId(OUTPUT_VIEW_ID);
|
|
117
|
+
outputView?.showChannel(channel, true);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
createChannel(id) {
|
|
121
|
+
const channelDisposables = [];
|
|
122
|
+
const channel = this.instantiateChannel(id);
|
|
123
|
+
channel.model.onDispose(() => {
|
|
124
|
+
if (this.activeChannel === channel) {
|
|
125
|
+
const channels = this.getChannelDescriptors();
|
|
126
|
+
const channel = channels.length ? this.getChannel(channels[0].id) : undefined;
|
|
127
|
+
if (channel && this.viewsService.isViewVisible(OUTPUT_VIEW_ID)) {
|
|
128
|
+
this.showChannel(channel.id);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.setActiveChannel(undefined);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
( Registry.as(Extensions.OutputChannels)).removeChannel(id);
|
|
135
|
+
dispose(channelDisposables);
|
|
136
|
+
}, channelDisposables);
|
|
137
|
+
return channel;
|
|
138
|
+
}
|
|
139
|
+
instantiateChannel(id) {
|
|
140
|
+
const channelData = ( Registry.as(Extensions.OutputChannels)).getChannel(id);
|
|
141
|
+
if (!channelData) {
|
|
142
|
+
this.logService.error(`Channel '${id}' is not registered yet`);
|
|
143
|
+
throw new Error(`Channel '${id}' is not registered yet`);
|
|
144
|
+
}
|
|
145
|
+
return this.instantiationService.createInstance(OutputChannel, channelData);
|
|
146
|
+
}
|
|
147
|
+
setActiveChannel(channel) {
|
|
148
|
+
this.activeChannel = channel;
|
|
149
|
+
this.activeLogOutputChannelContext.set(!!channel?.outputChannelDescriptor?.file && channel?.outputChannelDescriptor?.log);
|
|
150
|
+
if (this.activeChannel) {
|
|
151
|
+
this.storageService.store(OUTPUT_ACTIVE_CHANNEL_KEY, this.activeChannel.id, 1 , 1 );
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
this.storageService.remove(OUTPUT_ACTIVE_CHANNEL_KEY, 1 );
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
OutputService = ( __decorate([
|
|
159
|
+
( __param(0, IStorageService)),
|
|
160
|
+
( __param(1, IInstantiationService)),
|
|
161
|
+
( __param(2, ITextModelService)),
|
|
162
|
+
( __param(3, ILogService)),
|
|
163
|
+
( __param(4, ILifecycleService)),
|
|
164
|
+
( __param(5, IViewsService)),
|
|
165
|
+
( __param(6, IContextKeyService))
|
|
166
|
+
], OutputService));
|
|
167
|
+
|
|
168
|
+
export { OutputService };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
4
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
5
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
6
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
7
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
8
|
+
import { AbstractTextResourceEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/textResourceEditor';
|
|
9
|
+
import { CONTEXT_OUTPUT_SCROLL_LOCK, OUTPUT_VIEW_ID, CONTEXT_IN_OUTPUT } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
10
|
+
import { registerThemingParticipant, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
11
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
12
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
13
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
14
|
+
import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
15
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
16
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
17
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
18
|
+
import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
|
|
19
|
+
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
20
|
+
import { SIDE_BAR_BACKGROUND } from 'vscode/vscode/vs/workbench/common/theme';
|
|
21
|
+
import { editorBackground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
22
|
+
import { Dimension } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
23
|
+
import { createCancelablePromise } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
24
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
25
|
+
import { ResourceContextKey } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
26
|
+
import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
27
|
+
|
|
28
|
+
let OutputViewPane = class OutputViewPane extends ViewPane {
|
|
29
|
+
get scrollLock() { return !!this.scrollLockContextKey.get(); }
|
|
30
|
+
set scrollLock(scrollLock) { this.scrollLockContextKey.set(scrollLock); }
|
|
31
|
+
constructor(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService) {
|
|
32
|
+
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
33
|
+
this.editorPromise = null;
|
|
34
|
+
this.scrollLockContextKey = CONTEXT_OUTPUT_SCROLL_LOCK.bindTo(this.contextKeyService);
|
|
35
|
+
const editorInstantiationService = instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
|
|
36
|
+
this.editor = editorInstantiationService.createInstance(OutputEditor);
|
|
37
|
+
this._register(this.editor.onTitleAreaUpdate(() => {
|
|
38
|
+
this.updateTitle(this.editor.getTitle());
|
|
39
|
+
this.updateActions();
|
|
40
|
+
}));
|
|
41
|
+
this._register(this.onDidChangeBodyVisibility(() => this.onDidChangeVisibility(this.isBodyVisible())));
|
|
42
|
+
}
|
|
43
|
+
showChannel(channel, preserveFocus) {
|
|
44
|
+
if (this.channelId !== channel.id) {
|
|
45
|
+
this.setInput(channel);
|
|
46
|
+
}
|
|
47
|
+
if (!preserveFocus) {
|
|
48
|
+
this.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
focus() {
|
|
52
|
+
super.focus();
|
|
53
|
+
this.editorPromise?.then(() => this.editor.focus());
|
|
54
|
+
}
|
|
55
|
+
renderBody(container) {
|
|
56
|
+
super.renderBody(container);
|
|
57
|
+
this.editor.create(container);
|
|
58
|
+
container.classList.add('output-view');
|
|
59
|
+
const codeEditor = this.editor.getControl();
|
|
60
|
+
codeEditor.setAriaOptions({ role: 'document', activeDescendant: undefined });
|
|
61
|
+
this._register(codeEditor.onDidChangeModelContent(() => {
|
|
62
|
+
if (!this.scrollLock) {
|
|
63
|
+
this.editor.revealLastLine();
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
this._register(codeEditor.onDidChangeCursorPosition((e) => {
|
|
67
|
+
if (e.reason !== 3 ) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!this.configurationService.getValue('output.smartScroll.enabled')) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const model = codeEditor.getModel();
|
|
74
|
+
if (model) {
|
|
75
|
+
const newPositionLine = e.position.lineNumber;
|
|
76
|
+
const lastLine = model.getLineCount();
|
|
77
|
+
this.scrollLock = lastLine !== newPositionLine;
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
layoutBody(height, width) {
|
|
82
|
+
super.layoutBody(height, width);
|
|
83
|
+
this.editor.layout(( new Dimension(width, height)));
|
|
84
|
+
}
|
|
85
|
+
onDidChangeVisibility(visible) {
|
|
86
|
+
this.editor.setVisible(visible);
|
|
87
|
+
if (!visible) {
|
|
88
|
+
this.clearInput();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
setInput(channel) {
|
|
92
|
+
this.channelId = channel.id;
|
|
93
|
+
const input = this.createInput(channel);
|
|
94
|
+
if (!this.editor.input || !input.matches(this.editor.input)) {
|
|
95
|
+
this.editorPromise?.cancel();
|
|
96
|
+
this.editorPromise = createCancelablePromise(token => this.editor.setInput(this.createInput(channel), { preserveFocus: true }, Object.create(null), token)
|
|
97
|
+
.then(() => this.editor));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
clearInput() {
|
|
101
|
+
this.channelId = undefined;
|
|
102
|
+
this.editor.clearInput();
|
|
103
|
+
this.editorPromise = null;
|
|
104
|
+
}
|
|
105
|
+
createInput(channel) {
|
|
106
|
+
return this.instantiationService.createInstance(TextResourceEditorInput, channel.uri, ( nls.localizeWithPath(
|
|
107
|
+
'vs/workbench/contrib/output/browser/outputView',
|
|
108
|
+
'output model title',
|
|
109
|
+
"{0} - Output",
|
|
110
|
+
channel.label
|
|
111
|
+
)), ( nls.localizeWithPath(
|
|
112
|
+
'vs/workbench/contrib/output/browser/outputView',
|
|
113
|
+
'channel',
|
|
114
|
+
"Output channel for '{0}'",
|
|
115
|
+
channel.label
|
|
116
|
+
)), undefined, undefined);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
OutputViewPane = ( __decorate([
|
|
120
|
+
( __param(1, IKeybindingService)),
|
|
121
|
+
( __param(2, IContextMenuService)),
|
|
122
|
+
( __param(3, IConfigurationService)),
|
|
123
|
+
( __param(4, IContextKeyService)),
|
|
124
|
+
( __param(5, IViewDescriptorService)),
|
|
125
|
+
( __param(6, IInstantiationService)),
|
|
126
|
+
( __param(7, IOpenerService)),
|
|
127
|
+
( __param(8, IThemeService)),
|
|
128
|
+
( __param(9, ITelemetryService))
|
|
129
|
+
], OutputViewPane));
|
|
130
|
+
let OutputEditor = class OutputEditor extends AbstractTextResourceEditor {
|
|
131
|
+
constructor(telemetryService, instantiationService, storageService, configurationService, textResourceConfigurationService, themeService, editorGroupService, editorService, fileService, contextKeyService) {
|
|
132
|
+
super(OUTPUT_VIEW_ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorGroupService, editorService, fileService);
|
|
133
|
+
this.configurationService = configurationService;
|
|
134
|
+
this.resourceContext = this._register(instantiationService.createInstance(ResourceContextKey));
|
|
135
|
+
}
|
|
136
|
+
getId() {
|
|
137
|
+
return OUTPUT_VIEW_ID;
|
|
138
|
+
}
|
|
139
|
+
getTitle() {
|
|
140
|
+
return ( nls.localizeWithPath('vs/workbench/contrib/output/browser/outputView', 'output', "Output"));
|
|
141
|
+
}
|
|
142
|
+
getConfigurationOverrides() {
|
|
143
|
+
const options = super.getConfigurationOverrides();
|
|
144
|
+
options.wordWrap = 'on';
|
|
145
|
+
options.lineNumbers = 'off';
|
|
146
|
+
options.glyphMargin = false;
|
|
147
|
+
options.lineDecorationsWidth = 20;
|
|
148
|
+
options.rulers = [];
|
|
149
|
+
options.folding = false;
|
|
150
|
+
options.scrollBeyondLastLine = false;
|
|
151
|
+
options.renderLineHighlight = 'none';
|
|
152
|
+
options.minimap = { enabled: false };
|
|
153
|
+
options.renderValidationDecorations = 'editable';
|
|
154
|
+
options.padding = undefined;
|
|
155
|
+
options.readOnly = true;
|
|
156
|
+
options.domReadOnly = true;
|
|
157
|
+
options.unicodeHighlight = {
|
|
158
|
+
nonBasicASCII: false,
|
|
159
|
+
invisibleCharacters: false,
|
|
160
|
+
ambiguousCharacters: false,
|
|
161
|
+
};
|
|
162
|
+
const outputConfig = this.configurationService.getValue('[Log]');
|
|
163
|
+
if (outputConfig) {
|
|
164
|
+
if (outputConfig['editor.minimap.enabled']) {
|
|
165
|
+
options.minimap = { enabled: true };
|
|
166
|
+
}
|
|
167
|
+
if ('editor.wordWrap' in outputConfig) {
|
|
168
|
+
options.wordWrap = outputConfig['editor.wordWrap'];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return options;
|
|
172
|
+
}
|
|
173
|
+
getAriaLabel() {
|
|
174
|
+
return this.input ? this.input.getAriaLabel() : ( nls.localizeWithPath(
|
|
175
|
+
'vs/workbench/contrib/output/browser/outputView',
|
|
176
|
+
'outputViewAriaLabel',
|
|
177
|
+
"Output panel"
|
|
178
|
+
));
|
|
179
|
+
}
|
|
180
|
+
async setInput(input, options, context, token) {
|
|
181
|
+
const focus = !(options && options.preserveFocus);
|
|
182
|
+
if (this.input && input.matches(this.input)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (this.input) {
|
|
186
|
+
this.input.dispose();
|
|
187
|
+
}
|
|
188
|
+
await super.setInput(input, options, context, token);
|
|
189
|
+
this.resourceContext.set(input.resource);
|
|
190
|
+
if (focus) {
|
|
191
|
+
this.focus();
|
|
192
|
+
}
|
|
193
|
+
this.revealLastLine();
|
|
194
|
+
}
|
|
195
|
+
clearInput() {
|
|
196
|
+
if (this.input) {
|
|
197
|
+
this.input.dispose();
|
|
198
|
+
}
|
|
199
|
+
super.clearInput();
|
|
200
|
+
this.resourceContext.reset();
|
|
201
|
+
}
|
|
202
|
+
createEditor(parent) {
|
|
203
|
+
parent.setAttribute('role', 'document');
|
|
204
|
+
super.createEditor(parent);
|
|
205
|
+
const scopedContextKeyService = this.scopedContextKeyService;
|
|
206
|
+
if (scopedContextKeyService) {
|
|
207
|
+
CONTEXT_IN_OUTPUT.bindTo(scopedContextKeyService).set(true);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
OutputEditor = ( __decorate([
|
|
212
|
+
( __param(0, ITelemetryService)),
|
|
213
|
+
( __param(1, IInstantiationService)),
|
|
214
|
+
( __param(2, IStorageService)),
|
|
215
|
+
( __param(3, IConfigurationService)),
|
|
216
|
+
( __param(4, ITextResourceConfigurationService)),
|
|
217
|
+
( __param(5, IThemeService)),
|
|
218
|
+
( __param(6, IEditorGroupsService)),
|
|
219
|
+
( __param(7, IEditorService)),
|
|
220
|
+
( __param(8, IFileService)),
|
|
221
|
+
( __param(9, IContextKeyService))
|
|
222
|
+
], OutputEditor));
|
|
223
|
+
registerThemingParticipant((theme, collector) => {
|
|
224
|
+
const sidebarBackground = theme.getColor(SIDE_BAR_BACKGROUND);
|
|
225
|
+
if (sidebarBackground && sidebarBackground !== theme.getColor(editorBackground)) {
|
|
226
|
+
collector.addRule(`
|
|
227
|
+
.monaco-workbench .part.sidebar .output-view .monaco-editor,
|
|
228
|
+
.monaco-workbench .part.sidebar .output-view .monaco-editor .margin,
|
|
229
|
+
.monaco-workbench .part.sidebar .output-view .monaco-editor .monaco-editor-background {
|
|
230
|
+
background-color: ${sidebarBackground};
|
|
231
|
+
}
|
|
232
|
+
`);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export { OutputViewPane };
|