@codingame/monaco-vscode-output-service-override 4.1.0 → 4.1.1

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.
@@ -0,0 +1,3 @@
1
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
2
+
3
+ export { n as default };
@@ -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/output.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
2
- import { OutputService } from 'vscode/vscode/vs/workbench/contrib/output/browser/outputServices';
2
+ import { OutputService } from './vscode/src/vs/workbench/contrib/output/browser/outputServices.js';
3
3
  import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
4
4
  import { IOutputChannelModelService, OutputChannelModelService } from 'vscode/vscode/vs/workbench/contrib/output/common/outputChannelModelService';
5
5
  import getServiceOverride$1 from '@codingame/monaco-vscode-log-service-override';
6
- import 'vscode/vscode/vs/workbench/contrib/output/browser/output.contribution';
6
+ import './vscode/src/vs/workbench/contrib/output/browser/output.contribution.js';
7
7
 
8
8
  function getServiceOverride(logLevel) {
9
9
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-output-service-override",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,8 +18,8 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@4.1.0",
22
- "@codingame/monaco-vscode-log-service-override": "4.1.0"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@4.1.1",
22
+ "@codingame/monaco-vscode-log-service-override": "4.1.1"
23
23
  },
24
24
  "exports": {
25
25
  ".": {
@@ -0,0 +1,614 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
3
+ import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
4
+ import { ModesRegistry } from 'vscode/vscode/vs/editor/common/languages/modesRegistry';
5
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
+ import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
7
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
8
+ import './outputServices.js';
9
+ 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_FILE_OUTPUT, CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE, CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT, ACTIVE_OUTPUT_CHANNEL_CONTEXT, CONTEXT_ACTIVE_OUTPUT_LEVEL } from 'vscode/vscode/vs/workbench/services/output/common/output';
10
+ import { OutputViewPane } from './outputView.js';
11
+ import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/contributions';
12
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
13
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
14
+ import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
15
+ import { Extensions as Extensions$2 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
16
+ import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
17
+ import { AUX_WINDOW_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
18
+ import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
19
+ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
20
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
21
+ import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
22
+ import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
23
+ import { Disposable, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
24
+ import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
25
+ import { IAccessibilitySignalService, AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
26
+ import { LogLevel, ILoggerService, LogLevelToLocalizedString, LogLevelToString } from 'vscode/vscode/vs/platform/log/common/log';
27
+ import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels';
28
+
29
+ ModesRegistry.registerLanguage({
30
+ id: OUTPUT_MODE_ID,
31
+ extensions: [],
32
+ mimetypes: [OUTPUT_MIME]
33
+ });
34
+ ModesRegistry.registerLanguage({
35
+ id: LOG_MODE_ID,
36
+ extensions: [],
37
+ mimetypes: [LOG_MIME]
38
+ });
39
+ const outputViewIcon = registerIcon('output-view-icon', Codicon.output, ( localizeWithPath(
40
+ 'vs/workbench/contrib/output/browser/output.contribution',
41
+ 'outputViewIcon',
42
+ 'View icon of the output view.'
43
+ )));
44
+ const VIEW_CONTAINER = ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
45
+ id: OUTPUT_VIEW_ID,
46
+ title: ( localize2WithPath(
47
+ 'vs/workbench/contrib/output/browser/output.contribution',
48
+ 'output',
49
+ "Output"
50
+ )),
51
+ icon: outputViewIcon,
52
+ order: 1,
53
+ ctorDescriptor: ( new SyncDescriptor(
54
+ ViewPaneContainer,
55
+ [OUTPUT_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]
56
+ )),
57
+ storageId: OUTPUT_VIEW_ID,
58
+ hideIfEmpty: true,
59
+ }, 1 , { doNotRegisterOpenCommand: true });
60
+ ( Registry.as(Extensions.ViewsRegistry)).registerViews([{
61
+ id: OUTPUT_VIEW_ID,
62
+ name: ( localize2WithPath(
63
+ 'vs/workbench/contrib/output/browser/output.contribution',
64
+ 'output',
65
+ "Output"
66
+ )),
67
+ containerIcon: outputViewIcon,
68
+ canMoveView: true,
69
+ canToggleVisibility: false,
70
+ ctorDescriptor: ( new SyncDescriptor(OutputViewPane)),
71
+ openCommandActionDescriptor: {
72
+ id: 'workbench.action.output.toggleOutput',
73
+ mnemonicTitle: ( localizeWithPath(
74
+ 'vs/workbench/contrib/output/browser/output.contribution',
75
+ { key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] },
76
+ "&&Output"
77
+ )),
78
+ keybindings: {
79
+ primary: 2048 | 1024 | 51 ,
80
+ linux: {
81
+ primary: KeyChord(2048 | 41 , 2048 | 38 )
82
+ }
83
+ },
84
+ order: 1,
85
+ }
86
+ }], VIEW_CONTAINER);
87
+ let OutputContribution = class OutputContribution extends Disposable {
88
+ constructor(outputService, editorService, fileConfigurationService) {
89
+ super();
90
+ this.outputService = outputService;
91
+ this.editorService = editorService;
92
+ this.fileConfigurationService = fileConfigurationService;
93
+ this.registerActions();
94
+ }
95
+ registerActions() {
96
+ this.registerSwitchOutputAction();
97
+ this.registerShowOutputChannelsAction();
98
+ this.registerClearOutputAction();
99
+ this.registerToggleAutoScrollAction();
100
+ this.registerOpenActiveOutputFileAction();
101
+ this.registerOpenActiveOutputFileInAuxWindowAction();
102
+ this.registerShowLogsAction();
103
+ this.registerOpenLogFileAction();
104
+ this.registerConfigureActiveOutputLogLevelAction();
105
+ }
106
+ registerSwitchOutputAction() {
107
+ this._register(registerAction2(class extends Action2 {
108
+ constructor() {
109
+ super({
110
+ id: `workbench.output.action.switchBetweenOutputs`,
111
+ title: ( localizeWithPath(
112
+ 'vs/workbench/contrib/output/browser/output.contribution',
113
+ 'switchBetweenOutputs.label',
114
+ "Switch Output"
115
+ )),
116
+ });
117
+ }
118
+ async run(accessor, channelId) {
119
+ if (channelId) {
120
+ accessor.get(IOutputService).showChannel(channelId, true);
121
+ }
122
+ }
123
+ }));
124
+ const switchOutputMenu = ( new MenuId('workbench.output.menu.switchOutput'));
125
+ this._register(MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
126
+ submenu: switchOutputMenu,
127
+ title: ( localizeWithPath(
128
+ 'vs/workbench/contrib/output/browser/output.contribution',
129
+ 'switchToOutput.label',
130
+ "Switch Output"
131
+ )),
132
+ group: 'navigation',
133
+ when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
134
+ order: 1,
135
+ isSelection: true
136
+ }));
137
+ const registeredChannels = ( new Map());
138
+ this._register(toDisposable(() => dispose(( registeredChannels.values()))));
139
+ const registerOutputChannels = (channels) => {
140
+ for (const channel of channels) {
141
+ const title = channel.label;
142
+ const group = channel.extensionId ? '0_ext_outputchannels' : '1_core_outputchannels';
143
+ registeredChannels.set(channel.id, registerAction2(class extends Action2 {
144
+ constructor() {
145
+ super({
146
+ id: `workbench.action.output.show.${channel.id}`,
147
+ title,
148
+ toggled: ( ACTIVE_OUTPUT_CHANNEL_CONTEXT.isEqualTo(channel.id)),
149
+ menu: {
150
+ id: switchOutputMenu,
151
+ group,
152
+ }
153
+ });
154
+ }
155
+ async run(accessor) {
156
+ return accessor.get(IOutputService).showChannel(channel.id, true);
157
+ }
158
+ }));
159
+ }
160
+ };
161
+ registerOutputChannels(this.outputService.getChannelDescriptors());
162
+ const outputChannelRegistry = ( Registry.as(Extensions$3.OutputChannels));
163
+ this._register(outputChannelRegistry.onDidRegisterChannel(e => {
164
+ const channel = this.outputService.getChannelDescriptor(e);
165
+ if (channel) {
166
+ registerOutputChannels([channel]);
167
+ }
168
+ }));
169
+ this._register(outputChannelRegistry.onDidRemoveChannel(e => {
170
+ registeredChannels.get(e)?.dispose();
171
+ registeredChannels.delete(e);
172
+ }));
173
+ }
174
+ registerShowOutputChannelsAction() {
175
+ this._register(registerAction2(class extends Action2 {
176
+ constructor() {
177
+ super({
178
+ id: 'workbench.action.showOutputChannels',
179
+ title: ( localize2WithPath(
180
+ 'vs/workbench/contrib/output/browser/output.contribution',
181
+ 'showOutputChannels',
182
+ "Show Output Channels..."
183
+ )),
184
+ category: ( localize2WithPath(
185
+ 'vs/workbench/contrib/output/browser/output.contribution',
186
+ 'output',
187
+ "Output"
188
+ )),
189
+ f1: true
190
+ });
191
+ }
192
+ async run(accessor) {
193
+ const outputService = accessor.get(IOutputService);
194
+ const quickInputService = accessor.get(IQuickInputService);
195
+ const extensionChannels = [], coreChannels = [];
196
+ for (const channel of outputService.getChannelDescriptors()) {
197
+ if (channel.extensionId) {
198
+ extensionChannels.push(channel);
199
+ }
200
+ else {
201
+ coreChannels.push(channel);
202
+ }
203
+ }
204
+ const entries = [];
205
+ for (const { id, label } of extensionChannels) {
206
+ entries.push({ id, label });
207
+ }
208
+ if (extensionChannels.length && coreChannels.length) {
209
+ entries.push({ type: 'separator' });
210
+ }
211
+ for (const { id, label } of coreChannels) {
212
+ entries.push({ id, label });
213
+ }
214
+ const entry = await quickInputService.pick(entries, { placeHolder: ( localizeWithPath(
215
+ 'vs/workbench/contrib/output/browser/output.contribution',
216
+ 'selectOutput',
217
+ "Select Output Channel"
218
+ )) });
219
+ if (entry) {
220
+ return outputService.showChannel(entry.id);
221
+ }
222
+ }
223
+ }));
224
+ }
225
+ registerClearOutputAction() {
226
+ this._register(registerAction2(class extends Action2 {
227
+ constructor() {
228
+ super({
229
+ id: `workbench.output.action.clearOutput`,
230
+ title: ( localize2WithPath(
231
+ 'vs/workbench/contrib/output/browser/output.contribution',
232
+ 'clearOutput.label',
233
+ "Clear Output"
234
+ )),
235
+ category: Categories.View,
236
+ menu: [{
237
+ id: MenuId.ViewTitle,
238
+ when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
239
+ group: 'navigation',
240
+ order: 2
241
+ }, {
242
+ id: MenuId.CommandPalette
243
+ }, {
244
+ id: MenuId.EditorContext,
245
+ when: CONTEXT_IN_OUTPUT
246
+ }],
247
+ icon: Codicon.clearAll
248
+ });
249
+ }
250
+ async run(accessor) {
251
+ const outputService = accessor.get(IOutputService);
252
+ const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
253
+ const activeChannel = outputService.getActiveChannel();
254
+ if (activeChannel) {
255
+ activeChannel.clear();
256
+ accessibilitySignalService.playSignal(AccessibilitySignal.clear);
257
+ }
258
+ }
259
+ }));
260
+ }
261
+ registerToggleAutoScrollAction() {
262
+ this._register(registerAction2(class extends Action2 {
263
+ constructor() {
264
+ super({
265
+ id: `workbench.output.action.toggleAutoScroll`,
266
+ title: ( localize2WithPath(
267
+ 'vs/workbench/contrib/output/browser/output.contribution',
268
+ 'toggleAutoScroll',
269
+ "Toggle Auto Scrolling"
270
+ )),
271
+ tooltip: ( localizeWithPath(
272
+ 'vs/workbench/contrib/output/browser/output.contribution',
273
+ 'outputScrollOff',
274
+ "Turn Auto Scrolling Off"
275
+ )),
276
+ menu: {
277
+ id: MenuId.ViewTitle,
278
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)))),
279
+ group: 'navigation',
280
+ order: 3,
281
+ },
282
+ icon: Codicon.lock,
283
+ toggled: {
284
+ condition: CONTEXT_OUTPUT_SCROLL_LOCK,
285
+ icon: Codicon.unlock,
286
+ tooltip: ( localizeWithPath(
287
+ 'vs/workbench/contrib/output/browser/output.contribution',
288
+ 'outputScrollOn',
289
+ "Turn Auto Scrolling On"
290
+ ))
291
+ }
292
+ });
293
+ }
294
+ async run(accessor) {
295
+ const outputView = accessor.get(IViewsService).getActiveViewWithId(OUTPUT_VIEW_ID);
296
+ outputView.scrollLock = !outputView.scrollLock;
297
+ }
298
+ }));
299
+ }
300
+ registerOpenActiveOutputFileAction() {
301
+ const that = this;
302
+ this._register(registerAction2(class extends Action2 {
303
+ constructor() {
304
+ super({
305
+ id: `workbench.action.openActiveLogOutputFile`,
306
+ title: ( localize2WithPath(
307
+ 'vs/workbench/contrib/output/browser/output.contribution',
308
+ 'openActiveOutputFile',
309
+ "Open Output in Editor"
310
+ )),
311
+ menu: [{
312
+ id: MenuId.ViewTitle,
313
+ when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
314
+ group: 'navigation',
315
+ order: 4,
316
+ isHiddenByDefault: true
317
+ }],
318
+ icon: Codicon.goToFile,
319
+ precondition: CONTEXT_ACTIVE_FILE_OUTPUT
320
+ });
321
+ }
322
+ async run() {
323
+ that.openActiveOutoutFile();
324
+ }
325
+ }));
326
+ }
327
+ registerOpenActiveOutputFileInAuxWindowAction() {
328
+ const that = this;
329
+ this._register(registerAction2(class extends Action2 {
330
+ constructor() {
331
+ super({
332
+ id: `workbench.action.openActiveLogOutputFileInNewWindow`,
333
+ title: ( localize2WithPath(
334
+ 'vs/workbench/contrib/output/browser/output.contribution',
335
+ 'openActiveOutputFileInNewWindow',
336
+ "Open Output in New Window"
337
+ )),
338
+ menu: [{
339
+ id: MenuId.ViewTitle,
340
+ when: ( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)),
341
+ group: 'navigation',
342
+ order: 5,
343
+ isHiddenByDefault: true
344
+ }],
345
+ icon: Codicon.emptyWindow,
346
+ precondition: CONTEXT_ACTIVE_FILE_OUTPUT
347
+ });
348
+ }
349
+ async run() {
350
+ that.openActiveOutoutFile(AUX_WINDOW_GROUP);
351
+ }
352
+ }));
353
+ }
354
+ async openActiveOutoutFile(group) {
355
+ const fileOutputChannelDescriptor = this.getFileOutputChannelDescriptor();
356
+ if (fileOutputChannelDescriptor) {
357
+ await this.fileConfigurationService.updateReadonly(fileOutputChannelDescriptor.file, true);
358
+ await this.editorService.openEditor({
359
+ resource: fileOutputChannelDescriptor.file,
360
+ options: {
361
+ pinned: true,
362
+ },
363
+ }, group);
364
+ }
365
+ }
366
+ getFileOutputChannelDescriptor() {
367
+ const channel = this.outputService.getActiveChannel();
368
+ if (channel) {
369
+ const descriptor = this.outputService.getChannelDescriptors().filter(c => c.id === channel.id)[0];
370
+ if (descriptor?.file) {
371
+ return descriptor;
372
+ }
373
+ }
374
+ return null;
375
+ }
376
+ registerConfigureActiveOutputLogLevelAction() {
377
+ const that = this;
378
+ const logLevelMenu = ( new MenuId('workbench.output.menu.logLevel'));
379
+ this._register(MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
380
+ submenu: logLevelMenu,
381
+ title: ( localizeWithPath(
382
+ 'vs/workbench/contrib/output/browser/output.contribution',
383
+ 'logLevel.label',
384
+ "Set Log Level..."
385
+ )),
386
+ group: 'navigation',
387
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', OUTPUT_VIEW_ID)), CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE)),
388
+ icon: Codicon.gear,
389
+ order: 6
390
+ }));
391
+ let order = 0;
392
+ const registerLogLevel = (logLevel) => {
393
+ this._register(registerAction2(class extends Action2 {
394
+ constructor() {
395
+ super({
396
+ id: `workbench.action.output.activeOutputLogLevel.${logLevel}`,
397
+ title: LogLevelToLocalizedString(logLevel).value,
398
+ toggled: ( CONTEXT_ACTIVE_OUTPUT_LEVEL.isEqualTo(LogLevelToString(logLevel))),
399
+ menu: {
400
+ id: logLevelMenu,
401
+ order: order++,
402
+ group: '0_level'
403
+ }
404
+ });
405
+ }
406
+ async run(accessor) {
407
+ const channel = that.outputService.getActiveChannel();
408
+ if (channel) {
409
+ const channelDescriptor = that.outputService.getChannelDescriptor(channel.id);
410
+ if (channelDescriptor?.log && channelDescriptor.file) {
411
+ return accessor.get(ILoggerService).setLogLevel(channelDescriptor.file, logLevel);
412
+ }
413
+ }
414
+ }
415
+ }));
416
+ };
417
+ registerLogLevel(LogLevel.Trace);
418
+ registerLogLevel(LogLevel.Debug);
419
+ registerLogLevel(LogLevel.Info);
420
+ registerLogLevel(LogLevel.Warning);
421
+ registerLogLevel(LogLevel.Error);
422
+ registerLogLevel(LogLevel.Off);
423
+ this._register(registerAction2(class extends Action2 {
424
+ constructor() {
425
+ super({
426
+ id: `workbench.action.output.activeOutputLogLevelDefault`,
427
+ title: ( localizeWithPath(
428
+ 'vs/workbench/contrib/output/browser/output.contribution',
429
+ 'logLevelDefault.label',
430
+ "Set As Default"
431
+ )),
432
+ menu: {
433
+ id: logLevelMenu,
434
+ order,
435
+ group: '1_default'
436
+ },
437
+ precondition: ( CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT.negate())
438
+ });
439
+ }
440
+ async run(accessor) {
441
+ const channel = that.outputService.getActiveChannel();
442
+ if (channel) {
443
+ const channelDescriptor = that.outputService.getChannelDescriptor(channel.id);
444
+ if (channelDescriptor?.log && channelDescriptor.file) {
445
+ const logLevel = accessor.get(ILoggerService).getLogLevel(channelDescriptor.file);
446
+ return await accessor.get(IDefaultLogLevelsService).setDefaultLogLevel(logLevel, channelDescriptor.extensionId);
447
+ }
448
+ }
449
+ }
450
+ }));
451
+ }
452
+ registerShowLogsAction() {
453
+ this._register(registerAction2(class extends Action2 {
454
+ constructor() {
455
+ super({
456
+ id: 'workbench.action.showLogs',
457
+ title: ( localize2WithPath(
458
+ 'vs/workbench/contrib/output/browser/output.contribution',
459
+ 'showLogs',
460
+ "Show Logs..."
461
+ )),
462
+ category: Categories.Developer,
463
+ menu: {
464
+ id: MenuId.CommandPalette,
465
+ },
466
+ });
467
+ }
468
+ async run(accessor) {
469
+ const outputService = accessor.get(IOutputService);
470
+ const quickInputService = accessor.get(IQuickInputService);
471
+ const extensionLogs = [], logs = [];
472
+ for (const channel of outputService.getChannelDescriptors()) {
473
+ if (channel.log) {
474
+ if (channel.extensionId) {
475
+ extensionLogs.push(channel);
476
+ }
477
+ else {
478
+ logs.push(channel);
479
+ }
480
+ }
481
+ }
482
+ const entries = [];
483
+ for (const { id, label } of logs) {
484
+ entries.push({ id, label });
485
+ }
486
+ if (extensionLogs.length && logs.length) {
487
+ entries.push({ type: 'separator', label: ( localizeWithPath(
488
+ 'vs/workbench/contrib/output/browser/output.contribution',
489
+ 'extensionLogs',
490
+ "Extension Logs"
491
+ )) });
492
+ }
493
+ for (const { id, label } of extensionLogs) {
494
+ entries.push({ id, label });
495
+ }
496
+ const entry = await quickInputService.pick(entries, { placeHolder: ( localizeWithPath(
497
+ 'vs/workbench/contrib/output/browser/output.contribution',
498
+ 'selectlog',
499
+ "Select Log"
500
+ )) });
501
+ if (entry) {
502
+ return outputService.showChannel(entry.id);
503
+ }
504
+ }
505
+ }));
506
+ }
507
+ registerOpenLogFileAction() {
508
+ this._register(registerAction2(class extends Action2 {
509
+ constructor() {
510
+ super({
511
+ id: 'workbench.action.openLogFile',
512
+ title: ( localize2WithPath(
513
+ 'vs/workbench/contrib/output/browser/output.contribution',
514
+ 'openLogFile',
515
+ "Open Log File..."
516
+ )),
517
+ category: Categories.Developer,
518
+ menu: {
519
+ id: MenuId.CommandPalette,
520
+ },
521
+ metadata: {
522
+ description: 'workbench.action.openLogFile',
523
+ args: [{
524
+ name: 'logFile',
525
+ schema: {
526
+ markdownDescription: ( localizeWithPath(
527
+ 'vs/workbench/contrib/output/browser/output.contribution',
528
+ 'logFile',
529
+ "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"
530
+ )),
531
+ type: 'string'
532
+ }
533
+ }]
534
+ },
535
+ });
536
+ }
537
+ async run(accessor, args) {
538
+ const outputService = accessor.get(IOutputService);
539
+ const quickInputService = accessor.get(IQuickInputService);
540
+ const editorService = accessor.get(IEditorService);
541
+ const fileConfigurationService = accessor.get(IFilesConfigurationService);
542
+ let entry;
543
+ const argName = args && typeof args === 'string' ? args : undefined;
544
+ const extensionChannels = [];
545
+ const coreChannels = [];
546
+ for (const c of outputService.getChannelDescriptors()) {
547
+ if (c.file && c.log) {
548
+ const e = { id: c.id, label: c.label, channel: c };
549
+ if (c.extensionId) {
550
+ extensionChannels.push(e);
551
+ }
552
+ else {
553
+ coreChannels.push(e);
554
+ }
555
+ if (e.id === argName) {
556
+ entry = e;
557
+ }
558
+ }
559
+ }
560
+ if (!entry) {
561
+ const entries = [...extensionChannels.sort((a, b) => a.label.localeCompare(b.label))];
562
+ if (entries.length && coreChannels.length) {
563
+ entries.push({ type: 'separator' });
564
+ entries.push(...coreChannels.sort((a, b) => a.label.localeCompare(b.label)));
565
+ }
566
+ entry = await quickInputService.pick(entries, { placeHolder: ( localizeWithPath(
567
+ 'vs/workbench/contrib/output/browser/output.contribution',
568
+ 'selectlogFile',
569
+ "Select Log File"
570
+ )) });
571
+ }
572
+ if (entry) {
573
+ const resource = assertIsDefined(entry.channel.file);
574
+ await fileConfigurationService.updateReadonly(resource, true);
575
+ await editorService.openEditor({
576
+ resource,
577
+ options: {
578
+ pinned: true,
579
+ }
580
+ });
581
+ }
582
+ }
583
+ }));
584
+ }
585
+ };
586
+ OutputContribution = ( __decorate([
587
+ ( __param(0, IOutputService)),
588
+ ( __param(1, IEditorService)),
589
+ ( __param(2, IFilesConfigurationService))
590
+ ], OutputContribution));
591
+ ( Registry.as(Extensions$1.Workbench)).registerWorkbenchContribution(OutputContribution, 3 );
592
+ ( Registry.as(Extensions$2.Configuration)).registerConfiguration({
593
+ id: 'output',
594
+ order: 30,
595
+ title: ( localizeWithPath(
596
+ 'vs/workbench/contrib/output/browser/output.contribution',
597
+ 'output',
598
+ "Output"
599
+ )),
600
+ type: 'object',
601
+ properties: {
602
+ 'output.smartScroll.enabled': {
603
+ type: 'boolean',
604
+ description: ( localizeWithPath(
605
+ 'vs/workbench/contrib/output/browser/output.contribution',
606
+ 'output.smartScroll.enabled',
607
+ "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."
608
+ )),
609
+ default: true,
610
+ scope: 3 ,
611
+ tags: ['output']
612
+ }
613
+ }
614
+ });
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench .part.panel>.content .pane-body.output-view .monaco-editor,.monaco-workbench .part.panel>.content .pane-body.output-view .monaco-editor .margin,.monaco-workbench .part.panel>.content .pane-body.output-view .monaco-editor .monaco-editor-background,.monaco-workbench .part.sidebar .output-view .monaco-editor,.monaco-workbench .part.sidebar .output-view .monaco-editor .margin,.monaco-workbench .part.sidebar .output-view .monaco-editor .monaco-editor-background{background-color:var(--vscode-outputView-background)}.monaco-workbench .part.panel>.content .pane-body.output-view .sticky-widget,.monaco-workbench .part.sidebar .output-view .sticky-widget{background-color:var(--vscode-outputViewStickyScroll-background,var(--vscode-panel-background))}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,78 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
3
+ import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
4
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
5
+ import { OUTPUT_MODE_ID, LOG_MODE_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
6
+ import { createWebWorker } from 'vscode/vscode/vs/editor/browser/services/webWorker';
7
+ import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
8
+ import { ILanguageConfigurationService } from 'vscode/vscode/vs/editor/common/languages/languageConfigurationRegistry';
9
+ import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
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,202 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
3
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
4
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
+ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
7
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
8
+ import { OUTPUT_SCHEME, LOG_MIME, OUTPUT_MIME, ACTIVE_OUTPUT_CHANNEL_CONTEXT, CONTEXT_ACTIVE_FILE_OUTPUT, CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE, CONTEXT_ACTIVE_OUTPUT_LEVEL, CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT, Extensions, OUTPUT_VIEW_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
9
+ import { OutputLinkProvider } from './outputLinkProvider.js';
10
+ import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
11
+ import { LogLevelToString, ILogService, ILoggerService } from 'vscode/vscode/vs/platform/log/common/log';
12
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
13
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
14
+ import { IOutputChannelModelService } from 'vscode/vscode/vs/workbench/contrib/output/common/outputChannelModelService';
15
+ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
16
+ import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
17
+ import { SetLogLevelAction } from 'vscode/vscode/vs/workbench/contrib/logs/common/logsActions';
18
+ import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels';
19
+
20
+ const OUTPUT_ACTIVE_CHANNEL_KEY = 'output.activechannel';
21
+ let OutputChannel = class OutputChannel extends Disposable {
22
+ constructor(outputChannelDescriptor, outputChannelModelService, languageService) {
23
+ super();
24
+ this.outputChannelDescriptor = outputChannelDescriptor;
25
+ this.scrollLock = false;
26
+ this.id = outputChannelDescriptor.id;
27
+ this.label = outputChannelDescriptor.label;
28
+ this.uri = ( URI.from({ scheme: OUTPUT_SCHEME, path: this.id }));
29
+ 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));
30
+ }
31
+ append(output) {
32
+ this.model.append(output);
33
+ }
34
+ update(mode, till) {
35
+ this.model.update(mode, till, true);
36
+ }
37
+ clear() {
38
+ this.model.clear();
39
+ }
40
+ replace(value) {
41
+ this.model.replace(value);
42
+ }
43
+ };
44
+ OutputChannel = ( __decorate([
45
+ ( __param(1, IOutputChannelModelService)),
46
+ ( __param(2, ILanguageService))
47
+ ], OutputChannel));
48
+ let OutputService = class OutputService extends Disposable {
49
+ constructor(storageService, instantiationService, textModelResolverService, logService, loggerService, lifecycleService, viewsService, contextKeyService, defaultLogLevelsService) {
50
+ super();
51
+ this.storageService = storageService;
52
+ this.instantiationService = instantiationService;
53
+ this.logService = logService;
54
+ this.loggerService = loggerService;
55
+ this.lifecycleService = lifecycleService;
56
+ this.viewsService = viewsService;
57
+ this.defaultLogLevelsService = defaultLogLevelsService;
58
+ this.channels = ( new Map());
59
+ this._onActiveOutputChannel = this._register(( new Emitter()));
60
+ this.onActiveOutputChannel = this._onActiveOutputChannel.event;
61
+ this.activeChannelIdInStorage = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, 1 , '');
62
+ this.activeOutputChannelContext = ACTIVE_OUTPUT_CHANNEL_CONTEXT.bindTo(contextKeyService);
63
+ this.activeOutputChannelContext.set(this.activeChannelIdInStorage);
64
+ this._register(this.onActiveOutputChannel(channel => this.activeOutputChannelContext.set(channel)));
65
+ this.activeFileOutputChannelContext = CONTEXT_ACTIVE_FILE_OUTPUT.bindTo(contextKeyService);
66
+ this.activeOutputChannelLevelSettableContext = CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE.bindTo(contextKeyService);
67
+ this.activeOutputChannelLevelContext = CONTEXT_ACTIVE_OUTPUT_LEVEL.bindTo(contextKeyService);
68
+ this.activeOutputChannelLevelIsDefaultContext = CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT.bindTo(contextKeyService);
69
+ textModelResolverService.registerTextModelContentProvider(OUTPUT_SCHEME, this);
70
+ instantiationService.createInstance(OutputLinkProvider);
71
+ const registry = ( Registry.as(Extensions.OutputChannels));
72
+ for (const channelIdentifier of registry.getChannels()) {
73
+ this.onDidRegisterChannel(channelIdentifier.id);
74
+ }
75
+ this._register(registry.onDidRegisterChannel(this.onDidRegisterChannel, this));
76
+ if (!this.activeChannel) {
77
+ const channels = this.getChannelDescriptors();
78
+ this.setActiveChannel(channels && channels.length > 0 ? this.getChannel(channels[0].id) : undefined);
79
+ }
80
+ this._register(Event.filter(this.viewsService.onDidChangeViewVisibility, e => e.id === OUTPUT_VIEW_ID && e.visible)(() => {
81
+ if (this.activeChannel) {
82
+ this.viewsService.getActiveViewWithId(OUTPUT_VIEW_ID)?.showChannel(this.activeChannel, true);
83
+ }
84
+ }));
85
+ this._register(this.loggerService.onDidChangeLogLevel(_level => {
86
+ this.setLevelContext();
87
+ this.setLevelIsDefaultContext();
88
+ }));
89
+ this._register(this.defaultLogLevelsService.onDidChangeDefaultLogLevels(() => {
90
+ this.setLevelIsDefaultContext();
91
+ }));
92
+ this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
93
+ }
94
+ provideTextContent(resource) {
95
+ const channel = this.getChannel(resource.path);
96
+ if (channel) {
97
+ return channel.model.loadModel();
98
+ }
99
+ return null;
100
+ }
101
+ async showChannel(id, preserveFocus) {
102
+ const channel = this.getChannel(id);
103
+ if (this.activeChannel?.id !== channel?.id) {
104
+ this.setActiveChannel(channel);
105
+ this._onActiveOutputChannel.fire(id);
106
+ }
107
+ const outputView = await this.viewsService.openView(OUTPUT_VIEW_ID, !preserveFocus);
108
+ if (outputView && channel) {
109
+ outputView.showChannel(channel, !!preserveFocus);
110
+ }
111
+ }
112
+ getChannel(id) {
113
+ return this.channels.get(id);
114
+ }
115
+ getChannelDescriptor(id) {
116
+ return ( Registry.as(Extensions.OutputChannels)).getChannel(id);
117
+ }
118
+ getChannelDescriptors() {
119
+ return ( Registry.as(Extensions.OutputChannels)).getChannels();
120
+ }
121
+ getActiveChannel() {
122
+ return this.activeChannel;
123
+ }
124
+ async onDidRegisterChannel(channelId) {
125
+ const channel = this.createChannel(channelId);
126
+ this.channels.set(channelId, channel);
127
+ if (!this.activeChannel || this.activeChannelIdInStorage === channelId) {
128
+ this.setActiveChannel(channel);
129
+ this._onActiveOutputChannel.fire(channelId);
130
+ const outputView = this.viewsService.getActiveViewWithId(OUTPUT_VIEW_ID);
131
+ outputView?.showChannel(channel, true);
132
+ }
133
+ }
134
+ createChannel(id) {
135
+ const channel = this.instantiateChannel(id);
136
+ this._register(Event.once(channel.model.onDispose)(() => {
137
+ if (this.activeChannel === channel) {
138
+ const channels = this.getChannelDescriptors();
139
+ const channel = channels.length ? this.getChannel(channels[0].id) : undefined;
140
+ if (channel && this.viewsService.isViewVisible(OUTPUT_VIEW_ID)) {
141
+ this.showChannel(channel.id);
142
+ }
143
+ else {
144
+ this.setActiveChannel(undefined);
145
+ }
146
+ }
147
+ ( Registry.as(Extensions.OutputChannels)).removeChannel(id);
148
+ }));
149
+ return channel;
150
+ }
151
+ instantiateChannel(id) {
152
+ const channelData = ( Registry.as(Extensions.OutputChannels)).getChannel(id);
153
+ if (!channelData) {
154
+ this.logService.error(`Channel '${id}' is not registered yet`);
155
+ throw new Error(`Channel '${id}' is not registered yet`);
156
+ }
157
+ return this.instantiationService.createInstance(OutputChannel, channelData);
158
+ }
159
+ setLevelContext() {
160
+ const descriptor = this.activeChannel?.outputChannelDescriptor;
161
+ const channelLogLevel = descriptor?.log ? this.loggerService.getLogLevel(descriptor.file) : undefined;
162
+ this.activeOutputChannelLevelContext.set(channelLogLevel !== undefined ? LogLevelToString(channelLogLevel) : '');
163
+ }
164
+ async setLevelIsDefaultContext() {
165
+ const descriptor = this.activeChannel?.outputChannelDescriptor;
166
+ if (descriptor?.log) {
167
+ const channelLogLevel = this.loggerService.getLogLevel(descriptor.file);
168
+ const channelDefaultLogLevel = await this.defaultLogLevelsService.getDefaultLogLevel(descriptor.extensionId);
169
+ this.activeOutputChannelLevelIsDefaultContext.set(channelDefaultLogLevel === channelLogLevel);
170
+ }
171
+ else {
172
+ this.activeOutputChannelLevelIsDefaultContext.set(false);
173
+ }
174
+ }
175
+ setActiveChannel(channel) {
176
+ this.activeChannel = channel;
177
+ const descriptor = channel?.outputChannelDescriptor;
178
+ this.activeFileOutputChannelContext.set(!!descriptor?.file);
179
+ this.activeOutputChannelLevelSettableContext.set(descriptor !== undefined && SetLogLevelAction.isLevelSettable(descriptor));
180
+ this.setLevelIsDefaultContext();
181
+ this.setLevelContext();
182
+ if (this.activeChannel) {
183
+ this.storageService.store(OUTPUT_ACTIVE_CHANNEL_KEY, this.activeChannel.id, 1 , 1 );
184
+ }
185
+ else {
186
+ this.storageService.remove(OUTPUT_ACTIVE_CHANNEL_KEY, 1 );
187
+ }
188
+ }
189
+ };
190
+ OutputService = ( __decorate([
191
+ ( __param(0, IStorageService)),
192
+ ( __param(1, IInstantiationService)),
193
+ ( __param(2, ITextModelService)),
194
+ ( __param(3, ILogService)),
195
+ ( __param(4, ILoggerService)),
196
+ ( __param(5, ILifecycleService)),
197
+ ( __param(6, IViewsService)),
198
+ ( __param(7, IContextKeyService)),
199
+ ( __param(8, IDefaultLogLevelsService))
200
+ ], OutputService));
201
+
202
+ export { OutputService };
@@ -0,0 +1,226 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import './output.css.js';
3
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
+ import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
5
+ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
6
+ import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
7
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
8
+ import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
+ import { AbstractTextResourceEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/textResourceEditor';
10
+ import { CONTEXT_OUTPUT_SCROLL_LOCK, OUTPUT_VIEW_ID, CONTEXT_IN_OUTPUT } from 'vscode/vscode/vs/workbench/services/output/common/output';
11
+ import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
12
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
13
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
14
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
15
+ import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
16
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
17
+ import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
18
+ import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
19
+ import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
20
+ import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
21
+ import { Dimension } from 'vscode/vscode/vs/base/browser/dom';
22
+ import { createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
23
+ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
24
+ import { ResourceContextKey } from 'vscode/vscode/vs/workbench/common/contextkeys';
25
+ import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
26
+ import { computeEditorAriaLabel } from 'vscode/vscode/vs/workbench/browser/editor';
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, ( localizeWithPath(
107
+ 'vs/workbench/contrib/output/browser/outputView',
108
+ 'output model title',
109
+ "{0} - Output",
110
+ channel.label
111
+ )), ( 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) {
132
+ super(OUTPUT_VIEW_ID, editorGroupService.activeGroup , 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 ( localizeWithPath('vs/workbench/contrib/output/browser/outputView', 'output', "Output"));
141
+ }
142
+ getConfigurationOverrides(configuration) {
143
+ const options = super.getConfigurationOverrides(configuration);
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() : ( localizeWithPath(
175
+ 'vs/workbench/contrib/output/browser/outputView',
176
+ 'outputViewAriaLabel',
177
+ "Output panel"
178
+ ));
179
+ }
180
+ computeAriaLabel() {
181
+ return this.input ? computeEditorAriaLabel(this.input, undefined, undefined, this.editorGroupService.count) : this.getAriaLabel();
182
+ }
183
+ async setInput(input, options, context, token) {
184
+ const focus = !(options && options.preserveFocus);
185
+ if (this.input && input.matches(this.input)) {
186
+ return;
187
+ }
188
+ if (this.input) {
189
+ this.input.dispose();
190
+ }
191
+ await super.setInput(input, options, context, token);
192
+ this.resourceContext.set(input.resource);
193
+ if (focus) {
194
+ this.focus();
195
+ }
196
+ this.revealLastLine();
197
+ }
198
+ clearInput() {
199
+ if (this.input) {
200
+ this.input.dispose();
201
+ }
202
+ super.clearInput();
203
+ this.resourceContext.reset();
204
+ }
205
+ createEditor(parent) {
206
+ parent.setAttribute('role', 'document');
207
+ super.createEditor(parent);
208
+ const scopedContextKeyService = this.scopedContextKeyService;
209
+ if (scopedContextKeyService) {
210
+ CONTEXT_IN_OUTPUT.bindTo(scopedContextKeyService).set(true);
211
+ }
212
+ }
213
+ };
214
+ OutputEditor = ( __decorate([
215
+ ( __param(0, ITelemetryService)),
216
+ ( __param(1, IInstantiationService)),
217
+ ( __param(2, IStorageService)),
218
+ ( __param(3, IConfigurationService)),
219
+ ( __param(4, ITextResourceConfigurationService)),
220
+ ( __param(5, IThemeService)),
221
+ ( __param(6, IEditorGroupsService)),
222
+ ( __param(7, IEditorService)),
223
+ ( __param(8, IFileService))
224
+ ], OutputEditor));
225
+
226
+ export { OutputViewPane };