@codingame/monaco-vscode-output-service-override 13.1.6 → 14.0.0

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.
@@ -3,61 +3,124 @@ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
3
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
4
4
  import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
5
5
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
6
- import { IOutputChannel, OutputChannelUpdateMode, IOutputChannelDescriptor } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output";
6
+ import { IOutputChannel, OutputChannelUpdateMode, IOutputChannelDescriptor, IOutputViewFilters, ILogEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output";
7
7
  import { IOutputService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service";
8
8
  import { ITextModelService, ITextModelContentProvider } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService";
9
9
  import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
10
+ import { LogLevel } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log";
10
11
  import { ILoggerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
11
12
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
12
13
  import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
13
14
  import { IOutputChannelModel } from "../common/outputChannelModel.js";
14
15
  import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service";
15
- import { IOutputChannelModelService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/output/common/outputChannelModelService.service";
16
16
  import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language";
17
17
  import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
18
18
  import { IDefaultLogLevelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/logs/common/defaultLogLevels.service";
19
+ import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
20
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
21
+ import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
19
22
  declare class OutputChannel extends Disposable implements IOutputChannel {
20
23
  readonly outputChannelDescriptor: IOutputChannelDescriptor;
24
+ private readonly outputLocation;
25
+ private readonly outputDirPromise;
26
+ private readonly languageService;
27
+ private readonly instantiationService;
21
28
  scrollLock: boolean;
22
29
  readonly model: IOutputChannelModel;
23
30
  readonly id: string;
24
31
  readonly label: string;
25
32
  readonly uri: URI;
26
- constructor(outputChannelDescriptor: IOutputChannelDescriptor, outputChannelModelService: IOutputChannelModelService, languageService: ILanguageService);
33
+ constructor(outputChannelDescriptor: IOutputChannelDescriptor, outputLocation: URI, outputDirPromise: Promise<void>, languageService: ILanguageService, instantiationService: IInstantiationService);
34
+ private createOutputChannelModel;
35
+ getLogEntries(): ReadonlyArray<ILogEntry>;
27
36
  append(output: string): void;
28
37
  update(mode: OutputChannelUpdateMode, till?: number): void;
29
38
  clear(): void;
30
39
  replace(value: string): void;
31
40
  }
41
+ interface IOutputFilterOptions {
42
+ filterHistory: string[];
43
+ trace: boolean;
44
+ debug: boolean;
45
+ info: boolean;
46
+ warning: boolean;
47
+ error: boolean;
48
+ sources: string;
49
+ }
50
+ declare class OutputViewFilters extends Disposable implements IOutputViewFilters {
51
+ private readonly contextKeyService;
52
+ private readonly _onDidChange;
53
+ readonly onDidChange: Event<void>;
54
+ constructor(options: IOutputFilterOptions, contextKeyService: IContextKeyService);
55
+ filterHistory: string[];
56
+ private _filterText;
57
+ get text(): string;
58
+ set text(filterText: string);
59
+ private readonly _trace;
60
+ get trace(): boolean;
61
+ set trace(trace: boolean);
62
+ private readonly _debug;
63
+ get debug(): boolean;
64
+ set debug(debug: boolean);
65
+ private readonly _info;
66
+ get info(): boolean;
67
+ set info(info: boolean);
68
+ private readonly _warning;
69
+ get warning(): boolean;
70
+ set warning(warning: boolean);
71
+ private readonly _error;
72
+ get error(): boolean;
73
+ set error(error: boolean);
74
+ private readonly _categories;
75
+ get categories(): string;
76
+ set categories(categories: string);
77
+ toggleCategory(category: string): void;
78
+ hasCategory(category: string): boolean;
79
+ }
32
80
  export declare class OutputService extends Disposable implements IOutputService, ITextModelContentProvider {
33
81
  private readonly storageService;
34
82
  private readonly instantiationService;
83
+ private readonly textModelService;
35
84
  private readonly logService;
36
85
  private readonly loggerService;
37
86
  private readonly lifecycleService;
38
87
  private readonly viewsService;
39
88
  private readonly defaultLogLevelsService;
89
+ private readonly fileDialogService;
90
+ private readonly fileService;
40
91
  readonly _serviceBrand: undefined;
41
- private channels;
92
+ private readonly channels;
42
93
  private activeChannelIdInStorage;
43
94
  private activeChannel?;
44
95
  private readonly _onActiveOutputChannel;
45
96
  readonly onActiveOutputChannel: Event<string>;
46
97
  private readonly activeOutputChannelContext;
47
98
  private readonly activeFileOutputChannelContext;
99
+ private readonly activeLogOutputChannelContext;
48
100
  private readonly activeOutputChannelLevelSettableContext;
49
101
  private readonly activeOutputChannelLevelContext;
50
102
  private readonly activeOutputChannelLevelIsDefaultContext;
51
- constructor(storageService: IStorageService, instantiationService: IInstantiationService, textModelResolverService: ITextModelService, logService: ILogService, loggerService: ILoggerService, lifecycleService: ILifecycleService, viewsService: IViewsService, contextKeyService: IContextKeyService, defaultLogLevelsService: IDefaultLogLevelsService);
103
+ private readonly outputLocation;
104
+ readonly filters: OutputViewFilters;
105
+ constructor(storageService: IStorageService, instantiationService: IInstantiationService, textModelService: ITextModelService, logService: ILogService, loggerService: ILoggerService, lifecycleService: ILifecycleService, viewsService: IViewsService, contextKeyService: IContextKeyService, defaultLogLevelsService: IDefaultLogLevelsService, fileDialogService: IFileDialogService, fileService: IFileService, environmentService: IWorkbenchEnvironmentService);
52
106
  provideTextContent(resource: URI): Promise<ITextModel> | null;
53
107
  showChannel(id: string, preserveFocus?: boolean): Promise<void>;
54
108
  getChannel(id: string): OutputChannel | undefined;
55
109
  getChannelDescriptor(id: string): IOutputChannelDescriptor | undefined;
56
110
  getChannelDescriptors(): IOutputChannelDescriptor[];
57
111
  getActiveChannel(): IOutputChannel | undefined;
112
+ canSetLogLevel(channel: IOutputChannelDescriptor): boolean;
113
+ getLogLevel(channel: IOutputChannelDescriptor): LogLevel | undefined;
114
+ setLogLevel(channel: IOutputChannelDescriptor, logLevel: LogLevel): void;
115
+ registerCompoundLogChannel(descriptors: IOutputChannelDescriptor[]): string;
116
+ saveOutputAs(...channels: IOutputChannelDescriptor[]): Promise<void>;
58
117
  private onDidRegisterChannel;
118
+ private onDidUpdateChannelSources;
119
+ private onDidRemoveChannel;
59
120
  private createChannel;
121
+ private outputFolderCreationPromise;
60
122
  private instantiateChannel;
123
+ private resetLogLevelFilters;
61
124
  private setLevelContext;
62
125
  private setLevelIsDefaultContext;
63
126
  private setActiveChannel;
@@ -3,34 +3,58 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
3
3
  import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
4
  import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
5
5
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
- import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { Disposable, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
7
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
8
8
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
9
9
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
10
10
  import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
11
- import { 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 '@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output';
11
+ import { LOG_MIME, OUTPUT_MIME, isMultiSourceOutputChannelDescriptor, isSingleSourceOutputChannelDescriptor, SHOW_TRACE_FILTER_CONTEXT, SHOW_DEBUG_FILTER_CONTEXT, SHOW_INFO_FILTER_CONTEXT, SHOW_WARNING_FILTER_CONTEXT, SHOW_ERROR_FILTER_CONTEXT, HIDE_CATEGORY_FILTER_CONTEXT, ACTIVE_OUTPUT_CHANNEL_CONTEXT, CONTEXT_ACTIVE_FILE_OUTPUT, CONTEXT_ACTIVE_LOG_FILE_OUTPUT, CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE, CONTEXT_ACTIVE_OUTPUT_LEVEL, CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT, Extensions, OUTPUT_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output';
12
12
  import { OutputLinkProvider } from './outputLinkProvider.js';
13
13
  import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService';
14
- import { LogLevelToString } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
14
+ import { LogLevel, LogLevelToString } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
15
15
  import { ILogService, ILoggerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
16
16
  import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
17
+ import { MultiFileOutputChannelModel, FileOutputChannelModel, DelegatedOutputChannelModel } from '../common/outputChannelModel.js';
17
18
  import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
18
- import { IOutputChannelModelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/output/common/outputChannelModelService.service';
19
19
  import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language';
20
20
  import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
21
- import { SetLogLevelAction } from '@codingame/monaco-vscode-7b77bc98-d4d5-5442-b972-c926eb6db528-common/vscode/vs/workbench/contrib/logs/common/logsActions';
22
21
  import { IDefaultLogLevelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/logs/common/defaultLogLevels.service';
22
+ import { IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
23
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
24
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
25
+ import { joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
26
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
27
+ import { telemetryLogId, extensionTelemetryLogChannelId } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
28
+ import { toLocalISOString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
29
+ import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
23
30
 
24
31
  const OUTPUT_ACTIVE_CHANNEL_KEY = 'output.activechannel';
25
32
  let OutputChannel = class OutputChannel extends Disposable {
26
- constructor(outputChannelDescriptor, outputChannelModelService, languageService) {
33
+ constructor(outputChannelDescriptor, outputLocation, outputDirPromise, languageService, instantiationService) {
27
34
  super();
28
35
  this.outputChannelDescriptor = outputChannelDescriptor;
36
+ this.outputLocation = outputLocation;
37
+ this.outputDirPromise = outputDirPromise;
38
+ this.languageService = languageService;
39
+ this.instantiationService = instantiationService;
29
40
  this.scrollLock = false;
30
41
  this.id = outputChannelDescriptor.id;
31
42
  this.label = outputChannelDescriptor.label;
32
43
  this.uri = ( URI.from({ scheme: Schemas.outputChannel, path: this.id }));
33
- 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));
44
+ this.model = this._register(this.createOutputChannelModel(this.uri, outputChannelDescriptor));
45
+ }
46
+ createOutputChannelModel(uri, outputChannelDescriptor) {
47
+ const language = outputChannelDescriptor.languageId ? this.languageService.createById(outputChannelDescriptor.languageId) : this.languageService.createByMimeType(outputChannelDescriptor.log ? LOG_MIME : OUTPUT_MIME);
48
+ if (isMultiSourceOutputChannelDescriptor(outputChannelDescriptor)) {
49
+ return this.instantiationService.createInstance(MultiFileOutputChannelModel, uri, language, [...outputChannelDescriptor.source]);
50
+ }
51
+ if (isSingleSourceOutputChannelDescriptor(outputChannelDescriptor)) {
52
+ return this.instantiationService.createInstance(FileOutputChannelModel, uri, language, outputChannelDescriptor.source);
53
+ }
54
+ return this.instantiationService.createInstance(DelegatedOutputChannelModel, this.id, uri, language, this.outputLocation, this.outputDirPromise);
55
+ }
56
+ getLogEntries() {
57
+ return this.model.getLogEntries();
34
58
  }
35
59
  append(output) {
36
60
  this.model.append(output);
@@ -46,37 +70,143 @@ let OutputChannel = class OutputChannel extends Disposable {
46
70
  }
47
71
  };
48
72
  OutputChannel = ( __decorate([
49
- ( __param(1, IOutputChannelModelService)),
50
- ( __param(2, ILanguageService))
73
+ ( __param(3, ILanguageService)),
74
+ ( __param(4, IInstantiationService))
51
75
  ], OutputChannel));
76
+ class OutputViewFilters extends Disposable {
77
+ constructor(options, contextKeyService) {
78
+ super();
79
+ this.contextKeyService = contextKeyService;
80
+ this._onDidChange = this._register(( new Emitter()));
81
+ this.onDidChange = this._onDidChange.event;
82
+ this._filterText = '';
83
+ this._trace = SHOW_TRACE_FILTER_CONTEXT.bindTo(this.contextKeyService);
84
+ this._debug = SHOW_DEBUG_FILTER_CONTEXT.bindTo(this.contextKeyService);
85
+ this._info = SHOW_INFO_FILTER_CONTEXT.bindTo(this.contextKeyService);
86
+ this._warning = SHOW_WARNING_FILTER_CONTEXT.bindTo(this.contextKeyService);
87
+ this._error = SHOW_ERROR_FILTER_CONTEXT.bindTo(this.contextKeyService);
88
+ this._categories = HIDE_CATEGORY_FILTER_CONTEXT.bindTo(this.contextKeyService);
89
+ this._trace.set(options.trace);
90
+ this._debug.set(options.debug);
91
+ this._info.set(options.info);
92
+ this._warning.set(options.warning);
93
+ this._error.set(options.error);
94
+ this._categories.set(options.sources);
95
+ this.filterHistory = options.filterHistory;
96
+ }
97
+ get text() {
98
+ return this._filterText;
99
+ }
100
+ set text(filterText) {
101
+ if (this._filterText !== filterText) {
102
+ this._filterText = filterText;
103
+ this._onDidChange.fire();
104
+ }
105
+ }
106
+ get trace() {
107
+ return !!this._trace.get();
108
+ }
109
+ set trace(trace) {
110
+ if (this._trace.get() !== trace) {
111
+ this._trace.set(trace);
112
+ this._onDidChange.fire();
113
+ }
114
+ }
115
+ get debug() {
116
+ return !!this._debug.get();
117
+ }
118
+ set debug(debug) {
119
+ if (this._debug.get() !== debug) {
120
+ this._debug.set(debug);
121
+ this._onDidChange.fire();
122
+ }
123
+ }
124
+ get info() {
125
+ return !!this._info.get();
126
+ }
127
+ set info(info) {
128
+ if (this._info.get() !== info) {
129
+ this._info.set(info);
130
+ this._onDidChange.fire();
131
+ }
132
+ }
133
+ get warning() {
134
+ return !!this._warning.get();
135
+ }
136
+ set warning(warning) {
137
+ if (this._warning.get() !== warning) {
138
+ this._warning.set(warning);
139
+ this._onDidChange.fire();
140
+ }
141
+ }
142
+ get error() {
143
+ return !!this._error.get();
144
+ }
145
+ set error(error) {
146
+ if (this._error.get() !== error) {
147
+ this._error.set(error);
148
+ this._onDidChange.fire();
149
+ }
150
+ }
151
+ get categories() {
152
+ return this._categories.get() || ',';
153
+ }
154
+ set categories(categories) {
155
+ this._categories.set(categories);
156
+ this._onDidChange.fire();
157
+ }
158
+ toggleCategory(category) {
159
+ const categories = this.categories;
160
+ if (this.hasCategory(category)) {
161
+ this.categories = categories.replace(`,${category},`, ',');
162
+ }
163
+ else {
164
+ this.categories = `${categories}${category},`;
165
+ }
166
+ }
167
+ hasCategory(category) {
168
+ if (category === ',') {
169
+ return false;
170
+ }
171
+ return this.categories.includes(`,${category},`);
172
+ }
173
+ }
52
174
  let OutputService = class OutputService extends Disposable {
53
- constructor(storageService, instantiationService, textModelResolverService, logService, loggerService, lifecycleService, viewsService, contextKeyService, defaultLogLevelsService) {
175
+ constructor(storageService, instantiationService, textModelService, logService, loggerService, lifecycleService, viewsService, contextKeyService, defaultLogLevelsService, fileDialogService, fileService, environmentService) {
54
176
  super();
55
177
  this.storageService = storageService;
56
178
  this.instantiationService = instantiationService;
179
+ this.textModelService = textModelService;
57
180
  this.logService = logService;
58
181
  this.loggerService = loggerService;
59
182
  this.lifecycleService = lifecycleService;
60
183
  this.viewsService = viewsService;
61
184
  this.defaultLogLevelsService = defaultLogLevelsService;
62
- this.channels = ( new Map());
185
+ this.fileDialogService = fileDialogService;
186
+ this.fileService = fileService;
187
+ this.channels = this._register(( new DisposableMap()));
63
188
  this._onActiveOutputChannel = this._register(( new Emitter()));
64
189
  this.onActiveOutputChannel = this._onActiveOutputChannel.event;
190
+ this.outputFolderCreationPromise = null;
65
191
  this.activeChannelIdInStorage = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, StorageScope.WORKSPACE, '');
66
192
  this.activeOutputChannelContext = ACTIVE_OUTPUT_CHANNEL_CONTEXT.bindTo(contextKeyService);
67
193
  this.activeOutputChannelContext.set(this.activeChannelIdInStorage);
68
194
  this._register(this.onActiveOutputChannel(channel => this.activeOutputChannelContext.set(channel)));
69
195
  this.activeFileOutputChannelContext = CONTEXT_ACTIVE_FILE_OUTPUT.bindTo(contextKeyService);
196
+ this.activeLogOutputChannelContext = CONTEXT_ACTIVE_LOG_FILE_OUTPUT.bindTo(contextKeyService);
70
197
  this.activeOutputChannelLevelSettableContext = CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE.bindTo(contextKeyService);
71
198
  this.activeOutputChannelLevelContext = CONTEXT_ACTIVE_OUTPUT_LEVEL.bindTo(contextKeyService);
72
199
  this.activeOutputChannelLevelIsDefaultContext = CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT.bindTo(contextKeyService);
73
- this._register(textModelResolverService.registerTextModelContentProvider(Schemas.outputChannel, this));
200
+ this.outputLocation = joinPath(environmentService.windowLogsPath, `output_${toLocalISOString(( new Date())).replace(/-|:|\.\d+Z$/g, '')}`);
201
+ this._register(textModelService.registerTextModelContentProvider(Schemas.outputChannel, this));
74
202
  this._register(instantiationService.createInstance(OutputLinkProvider));
75
203
  const registry = ( Registry.as(Extensions.OutputChannels));
76
204
  for (const channelIdentifier of registry.getChannels()) {
77
205
  this.onDidRegisterChannel(channelIdentifier.id);
78
206
  }
79
- this._register(registry.onDidRegisterChannel(this.onDidRegisterChannel, this));
207
+ this._register(registry.onDidRegisterChannel(id => this.onDidRegisterChannel(id)));
208
+ this._register(registry.onDidUpdateChannelSources(channel => this.onDidUpdateChannelSources(channel)));
209
+ this._register(registry.onDidRemoveChannel(channel => this.onDidRemoveChannel(channel)));
80
210
  if (!this.activeChannel) {
81
211
  const channels = this.getChannelDescriptors();
82
212
  this.setActiveChannel(channels && channels.length > 0 ? this.getChannel(channels[0].id) : undefined);
@@ -86,7 +216,8 @@ let OutputService = class OutputService extends Disposable {
86
216
  this.viewsService.getActiveViewWithId(OUTPUT_VIEW_ID)?.showChannel(this.activeChannel, true);
87
217
  }
88
218
  }));
89
- this._register(this.loggerService.onDidChangeLogLevel(_level => {
219
+ this._register(this.loggerService.onDidChangeLogLevel(() => {
220
+ this.resetLogLevelFilters();
90
221
  this.setLevelContext();
91
222
  this.setLevelIsDefaultContext();
92
223
  }));
@@ -94,6 +225,15 @@ let OutputService = class OutputService extends Disposable {
94
225
  this.setLevelIsDefaultContext();
95
226
  }));
96
227
  this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
228
+ this.filters = this._register(( new OutputViewFilters({
229
+ filterHistory: [],
230
+ trace: true,
231
+ debug: true,
232
+ info: true,
233
+ warning: true,
234
+ error: true,
235
+ sources: '',
236
+ }, contextKeyService)));
97
237
  }
98
238
  provideTextContent(resource) {
99
239
  const channel = this.getChannel(resource.path);
@@ -125,6 +265,100 @@ let OutputService = class OutputService extends Disposable {
125
265
  getActiveChannel() {
126
266
  return this.activeChannel;
127
267
  }
268
+ canSetLogLevel(channel) {
269
+ return channel.log && channel.id !== telemetryLogId && channel.id !== extensionTelemetryLogChannelId;
270
+ }
271
+ getLogLevel(channel) {
272
+ if (!channel.log) {
273
+ return undefined;
274
+ }
275
+ const sources = isSingleSourceOutputChannelDescriptor(channel) ? [channel.source] : isMultiSourceOutputChannelDescriptor(channel) ? channel.source : [];
276
+ if (sources.length === 0) {
277
+ return undefined;
278
+ }
279
+ const logLevel = this.loggerService.getLogLevel();
280
+ return sources.reduce((prev, curr) => Math.min(prev, this.loggerService.getLogLevel(curr.resource) ?? logLevel), LogLevel.Error);
281
+ }
282
+ setLogLevel(channel, logLevel) {
283
+ if (!channel.log) {
284
+ return;
285
+ }
286
+ const sources = isSingleSourceOutputChannelDescriptor(channel) ? [channel.source] : isMultiSourceOutputChannelDescriptor(channel) ? channel.source : [];
287
+ if (sources.length === 0) {
288
+ return;
289
+ }
290
+ for (const source of sources) {
291
+ this.loggerService.setLogLevel(source.resource, logLevel);
292
+ }
293
+ }
294
+ registerCompoundLogChannel(descriptors) {
295
+ const outputChannelRegistry = ( Registry.as(Extensions.OutputChannels));
296
+ descriptors.sort((a, b) => a.label.localeCompare(b.label));
297
+ const id = ( descriptors.map(r => r.id.toLowerCase())).join('-');
298
+ if (!outputChannelRegistry.getChannel(id)) {
299
+ outputChannelRegistry.registerChannel({
300
+ id,
301
+ label: ( descriptors.map(r => r.label)).join(', '),
302
+ log: ( descriptors.some(r => r.log)),
303
+ user: true,
304
+ source: ( descriptors.map(descriptor => {
305
+ if (isSingleSourceOutputChannelDescriptor(descriptor)) {
306
+ return [{ resource: descriptor.source.resource, name: descriptor.source.name ?? descriptor.label }];
307
+ }
308
+ if (isMultiSourceOutputChannelDescriptor(descriptor)) {
309
+ return descriptor.source;
310
+ }
311
+ const channel = this.getChannel(descriptor.id);
312
+ if (channel) {
313
+ return channel.model.source;
314
+ }
315
+ return [];
316
+ })).flat(),
317
+ });
318
+ }
319
+ return id;
320
+ }
321
+ async saveOutputAs(...channels) {
322
+ let channel;
323
+ if (channels.length > 1) {
324
+ const compoundChannelId = this.registerCompoundLogChannel(channels);
325
+ channel = this.getChannel(compoundChannelId);
326
+ }
327
+ else {
328
+ channel = this.getChannel(channels[0].id);
329
+ }
330
+ if (!channel) {
331
+ return;
332
+ }
333
+ try {
334
+ const name = channels.length > 1 ? 'output' : channels[0].label;
335
+ const uri = await this.fileDialogService.showSaveDialog({
336
+ title: ( localize(8041, "Save Output As")),
337
+ availableFileSystems: [Schemas.file],
338
+ defaultUri: joinPath(await this.fileDialogService.defaultFilePath(), `${name}.log`),
339
+ filters: [{
340
+ name,
341
+ extensions: ['log']
342
+ }]
343
+ });
344
+ if (!uri) {
345
+ return;
346
+ }
347
+ const modelRef = await this.textModelService.createModelReference(channel.uri);
348
+ try {
349
+ await this.fileService.writeFile(uri, VSBuffer.fromString(modelRef.object.textEditorModel.getValue()));
350
+ }
351
+ finally {
352
+ modelRef.dispose();
353
+ }
354
+ return;
355
+ }
356
+ finally {
357
+ if (channels.length > 1) {
358
+ ( Registry.as(Extensions.OutputChannels)).removeChannel(channel.id);
359
+ }
360
+ }
361
+ }
128
362
  async onDidRegisterChannel(channelId) {
129
363
  const channel = this.createChannel(channelId);
130
364
  this.channels.set(channelId, channel);
@@ -135,6 +369,21 @@ let OutputService = class OutputService extends Disposable {
135
369
  outputView?.showChannel(channel, true);
136
370
  }
137
371
  }
372
+ onDidUpdateChannelSources(channel) {
373
+ const outputChannel = this.channels.get(channel.id);
374
+ if (outputChannel) {
375
+ outputChannel.model.updateChannelSources(channel.source);
376
+ }
377
+ }
378
+ onDidRemoveChannel(channel) {
379
+ if (this.activeChannel?.id === channel.id) {
380
+ const channels = this.getChannelDescriptors();
381
+ if (channels[0]) {
382
+ this.showChannel(channels[0].id);
383
+ }
384
+ }
385
+ this.channels.deleteAndDispose(channel.id);
386
+ }
138
387
  createChannel(id) {
139
388
  const channel = this.instantiateChannel(id);
140
389
  this._register(Event.once(channel.model.onDispose)(() => {
@@ -158,18 +407,32 @@ let OutputService = class OutputService extends Disposable {
158
407
  this.logService.error(`Channel '${id}' is not registered yet`);
159
408
  throw ( new Error(`Channel '${id}' is not registered yet`));
160
409
  }
161
- return this.instantiationService.createInstance(OutputChannel, channelData);
410
+ if (!this.outputFolderCreationPromise) {
411
+ this.outputFolderCreationPromise = this.fileService.createFolder(this.outputLocation).then(() => undefined);
412
+ }
413
+ return this.instantiationService.createInstance(OutputChannel, channelData, this.outputLocation, this.outputFolderCreationPromise);
414
+ }
415
+ resetLogLevelFilters() {
416
+ const descriptor = this.activeChannel?.outputChannelDescriptor;
417
+ const channelLogLevel = descriptor ? this.getLogLevel(descriptor) : undefined;
418
+ if (channelLogLevel !== undefined) {
419
+ this.filters.error = channelLogLevel <= LogLevel.Error;
420
+ this.filters.warning = channelLogLevel <= LogLevel.Warning;
421
+ this.filters.info = channelLogLevel <= LogLevel.Info;
422
+ this.filters.debug = channelLogLevel <= LogLevel.Debug;
423
+ this.filters.trace = channelLogLevel <= LogLevel.Trace;
424
+ }
162
425
  }
163
426
  setLevelContext() {
164
427
  const descriptor = this.activeChannel?.outputChannelDescriptor;
165
- const channelLogLevel = descriptor?.log ? this.loggerService.getLogLevel(descriptor.file) : undefined;
428
+ const channelLogLevel = descriptor ? this.getLogLevel(descriptor) : undefined;
166
429
  this.activeOutputChannelLevelContext.set(channelLogLevel !== undefined ? LogLevelToString(channelLogLevel) : '');
167
430
  }
168
431
  async setLevelIsDefaultContext() {
169
432
  const descriptor = this.activeChannel?.outputChannelDescriptor;
170
- if (descriptor?.log) {
171
- const channelLogLevel = this.loggerService.getLogLevel(descriptor.file);
172
- const channelDefaultLogLevel = await this.defaultLogLevelsService.getDefaultLogLevel(descriptor.extensionId);
433
+ const channelLogLevel = descriptor ? this.getLogLevel(descriptor) : undefined;
434
+ if (channelLogLevel !== undefined) {
435
+ const channelDefaultLogLevel = await this.defaultLogLevelsService.getDefaultLogLevel(descriptor?.extensionId);
173
436
  this.activeOutputChannelLevelIsDefaultContext.set(channelDefaultLogLevel === channelLogLevel);
174
437
  }
175
438
  else {
@@ -179,8 +442,9 @@ let OutputService = class OutputService extends Disposable {
179
442
  setActiveChannel(channel) {
180
443
  this.activeChannel = channel;
181
444
  const descriptor = channel?.outputChannelDescriptor;
182
- this.activeFileOutputChannelContext.set(!!descriptor?.file);
183
- this.activeOutputChannelLevelSettableContext.set(descriptor !== undefined && SetLogLevelAction.isLevelSettable(descriptor));
445
+ this.activeFileOutputChannelContext.set(!!descriptor && isSingleSourceOutputChannelDescriptor(descriptor));
446
+ this.activeLogOutputChannelContext.set(!!descriptor?.log);
447
+ this.activeOutputChannelLevelSettableContext.set(descriptor !== undefined && this.canSetLogLevel(descriptor));
184
448
  this.setLevelIsDefaultContext();
185
449
  this.setLevelContext();
186
450
  if (this.activeChannel) {
@@ -200,7 +464,10 @@ OutputService = ( __decorate([
200
464
  ( __param(5, ILifecycleService)),
201
465
  ( __param(6, IViewsService)),
202
466
  ( __param(7, IContextKeyService)),
203
- ( __param(8, IDefaultLogLevelsService))
467
+ ( __param(8, IDefaultLogLevelsService)),
468
+ ( __param(9, IFileDialogService)),
469
+ ( __param(10, IFileService)),
470
+ ( __param(11, IWorkbenchEnvironmentService))
204
471
  ], OutputService));
205
472
 
206
473
  export { OutputService };
@@ -1,29 +1,83 @@
1
+ import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
2
+ import { IEditorOptions as ICodeEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions";
1
3
  import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
4
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
5
+ import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration";
2
6
  import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
3
7
  import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
8
+ import { IEditorOpenContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
9
+ import { AbstractTextResourceEditor } from "@codingame/monaco-vscode-523730aa-81e6-55d7-9916-87ad537fe087-common/vscode/vs/workbench/browser/parts/editor/textResourceEditor";
4
10
  import { IOutputChannel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output";
11
+ import { IOutputService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service";
5
12
  import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
6
13
  import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
7
- import { ViewPane, IViewPaneOptions } from "@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common/vscode/vs/workbench/browser/parts/views/viewPane";
14
+ import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
15
+ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
16
+ import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
17
+ import { IViewPaneOptions, FilterViewPane } from "@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common/vscode/vs/workbench/browser/parts/views/viewPane";
8
18
  import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
9
19
  import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
10
20
  import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
21
+ import { TextResourceEditorInput } from "@codingame/monaco-vscode-ce8c4b18-4e75-55dd-9656-517347af9de7-common/vscode/vs/workbench/common/editor/textResourceEditorInput";
11
22
  import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
23
+ import { ITextEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor";
24
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
25
+ import { IEditorConfiguration } from "@codingame/monaco-vscode-d0fb86d3-2a47-594e-955b-9a24631a7124-common/vscode/vs/workbench/browser/parts/editor/textEditor";
12
26
  import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
13
- export declare class OutputViewPane extends ViewPane {
27
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
28
+ import { ICodeEditorWidgetOptions } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget";
29
+ import { IEditorContribution } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
30
+ export declare class OutputViewPane extends FilterViewPane {
31
+ private readonly outputService;
14
32
  private readonly editor;
15
33
  private channelId;
16
34
  private editorPromise;
17
35
  private readonly scrollLockContextKey;
18
36
  get scrollLock(): boolean;
19
37
  set scrollLock(scrollLock: boolean);
20
- constructor(options: IViewPaneOptions, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, instantiationService: IInstantiationService, openerService: IOpenerService, themeService: IThemeService, telemetryService: ITelemetryService, hoverService: IHoverService);
38
+ private readonly memento;
39
+ private readonly panelState;
40
+ constructor(options: IViewPaneOptions, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, instantiationService: IInstantiationService, openerService: IOpenerService, themeService: IThemeService, telemetryService: ITelemetryService, hoverService: IHoverService, outputService: IOutputService, storageService: IStorageService);
21
41
  showChannel(channel: IOutputChannel, preserveFocus: boolean): void;
22
42
  focus(): void;
43
+ clearFilterText(): void;
23
44
  protected renderBody(container: HTMLElement): void;
24
- protected layoutBody(height: number, width: number): void;
45
+ protected layoutBodyContent(height: number, width: number): void;
25
46
  private onDidChangeVisibility;
26
47
  private setInput;
48
+ private checkMoreFilters;
27
49
  private clearInput;
28
50
  private createInput;
51
+ saveState(): void;
52
+ }
53
+ export declare class OutputEditor extends AbstractTextResourceEditor {
54
+ private readonly configurationService;
55
+ private readonly resourceContext;
56
+ constructor(telemetryService: ITelemetryService, instantiationService: IInstantiationService, storageService: IStorageService, configurationService: IConfigurationService, textResourceConfigurationService: ITextResourceConfigurationService, themeService: IThemeService, editorGroupService: IEditorGroupsService, editorService: IEditorService, fileService: IFileService);
57
+ getId(): string;
58
+ getTitle(): string;
59
+ protected getConfigurationOverrides(configuration: IEditorConfiguration): ICodeEditorOptions;
60
+ protected getAriaLabel(): string;
61
+ protected computeAriaLabel(): string;
62
+ setInput(input: TextResourceEditorInput, options: ITextEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void>;
63
+ clearInput(): void;
64
+ protected createEditor(parent: HTMLElement): void;
65
+ private _getContributions;
66
+ protected getCodeEditorWidgetOptions(): ICodeEditorWidgetOptions;
67
+ }
68
+ export declare class FilterController extends Disposable implements IEditorContribution {
69
+ private readonly editor;
70
+ private readonly outputService;
71
+ static readonly ID = "output.editor.contrib.filterController";
72
+ private readonly modelDisposables;
73
+ private hiddenAreas;
74
+ private readonly categories;
75
+ private readonly decorationsCollection;
76
+ constructor(editor: ICodeEditor, outputService: IOutputService);
77
+ private onDidChangeModel;
78
+ private filter;
79
+ private filterIncremental;
80
+ private compute;
81
+ private shouldShowLogLevel;
82
+ private shouldShowCategory;
29
83
  }