@codingame/monaco-vscode-log-service-override 10.1.3 → 11.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.
@@ -1,5 +1,5 @@
1
1
  import { localize } from 'vscode/vscode/vs/nls';
2
2
 
3
- const rendererLogLabel = ( localize(3283, 'Window'));
3
+ const rendererLogLabel = ( localize(2737, 'Window'));
4
4
 
5
5
  export { rendererLogLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-log-service-override",
3
- "version": "10.1.3",
3
+ "version": "11.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@10.1.3",
30
- "@codingame/monaco-vscode-environment-service-override": "10.1.3"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@11.0.0",
30
+ "@codingame/monaco-vscode-environment-service-override": "11.0.0"
31
31
  }
32
32
  }
@@ -6,7 +6,7 @@ import { toFileOperationResult } from 'vscode/vscode/vs/platform/files/common/fi
6
6
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
7
7
  import { IJSONEditingService } from 'vscode/vscode/vs/workbench/services/configuration/common/jsonEditing.service';
8
8
  import { isUndefined, isString } from 'vscode/vscode/vs/base/common/types';
9
- import { EXTENSION_IDENTIFIER_WITH_LOG_REGEX } from '@codingame/monaco-vscode-environment-service-override/vscode/vs/platform/environment/common/environmentService';
9
+ import { EXTENSION_IDENTIFIER_WITH_LOG_REGEX } from 'vscode/vscode/vs/platform/environment/common/environmentService';
10
10
  import { parse } from 'vscode/vscode/vs/base/common/json';
11
11
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
12
12
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
@@ -3,7 +3,7 @@ import { localize2, localize } from 'vscode/vscode/vs/nls';
3
3
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
4
4
  import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
5
5
  import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { SetLogLevelAction } from './logsActions.js';
6
+ import { SetLogLevelAction } from 'vscode/vscode/vs/workbench/contrib/logs/common/logsActions';
7
7
  import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/contributions';
8
8
  import { whenProviderRegistered } from 'vscode/vscode/vs/platform/files/common/files';
9
9
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
@@ -41,7 +41,7 @@ registerAction2(class extends Action2 {
41
41
  constructor() {
42
42
  super({
43
43
  id: 'workbench.action.setDefaultLogLevel',
44
- title: ( localize2(3284, "Set Default Log Level")),
44
+ title: ( localize2(2738, "Set Default Log Level")),
45
45
  category: Categories.Developer,
46
46
  });
47
47
  }
@@ -147,7 +147,7 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
147
147
  }
148
148
  const hasToAppendRemote = existingChannel && logger.resource.scheme === Schemas.vscodeRemote;
149
149
  const id = hasToAppendRemote ? `${logger.id}.remote` : logger.id;
150
- const label = hasToAppendRemote ? ( localize(3285, "{0} (Remote)", logger.name ?? logger.id)) : logger.name ?? logger.id;
150
+ const label = hasToAppendRemote ? ( localize(2739, "{0} (Remote)", logger.name ?? logger.id)) : logger.name ?? logger.id;
151
151
  this.outputChannelRegistry.registerChannel({ id, label, file: logger.resource, log: true, extensionId: logger.extensionId });
152
152
  disposables.add(toDisposable(() => this.outputChannelRegistry.removeChannel(id)));
153
153
  if (remoteLogger) {
@@ -186,7 +186,7 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
186
186
  constructor() {
187
187
  super({
188
188
  id: showWindowLogActionId,
189
- title: ( localize2(3286, "Show Window Log")),
189
+ title: ( localize2(2740, "Show Window Log")),
190
190
  category: Categories.Developer,
191
191
  f1: true
192
192
  });
@@ -1,206 +0,0 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { localize2, localize } from 'vscode/vscode/vs/nls';
3
- import { Action } from 'vscode/vscode/vs/base/common/actions';
4
- import { isLogLevel, LogLevel, LogLevelToLocalizedString } from 'vscode/vscode/vs/platform/log/common/log';
5
- import { ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
6
- import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
7
- import { URI } from 'vscode/vscode/vs/base/common/uri';
8
- import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
- import { basename, dirname, isEqual } from 'vscode/vscode/vs/base/common/resources';
10
- import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output.service';
11
- import { telemetryLogId, extensionTelemetryLogChannelId } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
12
- import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels.service';
13
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
14
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
15
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
16
-
17
- var SetLogLevelAction_1;
18
- let SetLogLevelAction = class SetLogLevelAction extends Action {
19
- static { SetLogLevelAction_1 = this; }
20
- static { this.ID = 'workbench.action.setLogLevel'; }
21
- static { this.TITLE = ( localize2(6168, "Set Log Level...")); }
22
- constructor(id, label, quickInputService, loggerService, outputService, defaultLogLevelsService) {
23
- super(id, label);
24
- this.quickInputService = quickInputService;
25
- this.loggerService = loggerService;
26
- this.outputService = outputService;
27
- this.defaultLogLevelsService = defaultLogLevelsService;
28
- }
29
- async run() {
30
- const logLevelOrChannel = await this.selectLogLevelOrChannel();
31
- if (logLevelOrChannel !== null) {
32
- if (isLogLevel(logLevelOrChannel)) {
33
- this.loggerService.setLogLevel(logLevelOrChannel);
34
- }
35
- else {
36
- await this.setLogLevelForChannel(logLevelOrChannel);
37
- }
38
- }
39
- }
40
- async selectLogLevelOrChannel() {
41
- const defaultLogLevels = await this.defaultLogLevelsService.getDefaultLogLevels();
42
- const extensionLogs = [], logs = [];
43
- const logLevel = this.loggerService.getLogLevel();
44
- for (const channel of this.outputService.getChannelDescriptors()) {
45
- if (!SetLogLevelAction_1.isLevelSettable(channel) || !channel.file) {
46
- continue;
47
- }
48
- const channelLogLevel = this.loggerService.getLogLevel(channel.file) ?? logLevel;
49
- const item = { id: channel.id, resource: channel.file, label: channel.label, description: channelLogLevel !== logLevel ? this.getLabel(channelLogLevel) : undefined, extensionId: channel.extensionId };
50
- if (channel.extensionId) {
51
- extensionLogs.push(item);
52
- }
53
- else {
54
- logs.push(item);
55
- }
56
- }
57
- const entries = [];
58
- entries.push({ type: 'separator', label: ( localize(6169, "All")) });
59
- entries.push(...this.getLogLevelEntries(defaultLogLevels.default, this.loggerService.getLogLevel(), true));
60
- if (extensionLogs.length) {
61
- entries.push({ type: 'separator', label: ( localize(6170, "Extension Logs")) });
62
- entries.push(...extensionLogs.sort((a, b) => a.label.localeCompare(b.label)));
63
- }
64
- entries.push({ type: 'separator', label: ( localize(6171, "Logs")) });
65
- entries.push(...logs.sort((a, b) => a.label.localeCompare(b.label)));
66
- return (
67
- (new Promise((resolve, reject) => {
68
- const disposables = ( (new DisposableStore()));
69
- const quickPick = disposables.add(this.quickInputService.createQuickPick({ useSeparators: true }));
70
- quickPick.placeholder = ( localize(6172, "Set Log Level"));
71
- quickPick.items = entries;
72
- let selectedItem;
73
- disposables.add(quickPick.onDidTriggerItemButton(e => {
74
- quickPick.hide();
75
- this.defaultLogLevelsService.setDefaultLogLevel(e.item.level);
76
- }));
77
- disposables.add(quickPick.onDidAccept(e => {
78
- selectedItem = quickPick.selectedItems[0];
79
- quickPick.hide();
80
- }));
81
- disposables.add(quickPick.onDidHide(() => {
82
- const result = selectedItem ? selectedItem.level ?? selectedItem : null;
83
- disposables.dispose();
84
- resolve(result);
85
- }));
86
- quickPick.show();
87
- }))
88
- );
89
- }
90
- static isLevelSettable(channel) {
91
- return channel.log && channel.file !== undefined && channel.id !== telemetryLogId && channel.id !== extensionTelemetryLogChannelId;
92
- }
93
- async setLogLevelForChannel(logChannel) {
94
- const defaultLogLevels = await this.defaultLogLevelsService.getDefaultLogLevels();
95
- const defaultLogLevel = defaultLogLevels.extensions.find(e => e[0] === logChannel.extensionId?.toLowerCase())?.[1] ?? defaultLogLevels.default;
96
- const currentLogLevel = this.loggerService.getLogLevel(logChannel.resource) ?? defaultLogLevel;
97
- const entries = this.getLogLevelEntries(defaultLogLevel, currentLogLevel, !!logChannel.extensionId);
98
- return (
99
- (new Promise((resolve, reject) => {
100
- const disposables = ( (new DisposableStore()));
101
- const quickPick = disposables.add(this.quickInputService.createQuickPick());
102
- quickPick.placeholder = logChannel ? ( localize(6173, " {0}: Select log level", logChannel?.label)) : ( localize(6174, "Select log level"));
103
- quickPick.items = entries;
104
- quickPick.activeItems = entries.filter((entry) => entry.level === this.loggerService.getLogLevel());
105
- let selectedItem;
106
- disposables.add(quickPick.onDidTriggerItemButton(e => {
107
- quickPick.hide();
108
- this.defaultLogLevelsService.setDefaultLogLevel(e.item.level, logChannel.extensionId);
109
- }));
110
- disposables.add(quickPick.onDidAccept(e => {
111
- selectedItem = quickPick.selectedItems[0];
112
- quickPick.hide();
113
- }));
114
- disposables.add(quickPick.onDidHide(() => {
115
- if (selectedItem) {
116
- this.loggerService.setLogLevel(logChannel.resource, selectedItem.level);
117
- }
118
- disposables.dispose();
119
- resolve();
120
- }));
121
- quickPick.show();
122
- }))
123
- );
124
- }
125
- getLogLevelEntries(defaultLogLevel, currentLogLevel, canSetDefaultLogLevel) {
126
- const button = canSetDefaultLogLevel ? { iconClass: ThemeIcon.asClassName(Codicon.checkAll), tooltip: ( localize(6175, "Set as Default Log Level")) } : undefined;
127
- return [
128
- { label: this.getLabel(LogLevel.Trace, currentLogLevel), level: LogLevel.Trace, description: this.getDescription(LogLevel.Trace, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Trace ? [button] : undefined },
129
- { label: this.getLabel(LogLevel.Debug, currentLogLevel), level: LogLevel.Debug, description: this.getDescription(LogLevel.Debug, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Debug ? [button] : undefined },
130
- { label: this.getLabel(LogLevel.Info, currentLogLevel), level: LogLevel.Info, description: this.getDescription(LogLevel.Info, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Info ? [button] : undefined },
131
- { label: this.getLabel(LogLevel.Warning, currentLogLevel), level: LogLevel.Warning, description: this.getDescription(LogLevel.Warning, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Warning ? [button] : undefined },
132
- { label: this.getLabel(LogLevel.Error, currentLogLevel), level: LogLevel.Error, description: this.getDescription(LogLevel.Error, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Error ? [button] : undefined },
133
- { label: this.getLabel(LogLevel.Off, currentLogLevel), level: LogLevel.Off, description: this.getDescription(LogLevel.Off, defaultLogLevel), buttons: button && defaultLogLevel !== LogLevel.Off ? [button] : undefined },
134
- ];
135
- }
136
- getLabel(level, current) {
137
- const label = LogLevelToLocalizedString(level).value;
138
- return level === current ? `$(check) ${label}` : label;
139
- }
140
- getDescription(level, defaultLogLevel) {
141
- return defaultLogLevel === level ? ( localize(6176, "Default")) : undefined;
142
- }
143
- };
144
- SetLogLevelAction = SetLogLevelAction_1 = ( (__decorate([
145
- ( (__param(2, IQuickInputService))),
146
- ( (__param(3, ILoggerService))),
147
- ( (__param(4, IOutputService))),
148
- ( (__param(5, IDefaultLogLevelsService)))
149
- ], SetLogLevelAction)));
150
- (class OpenWindowSessionLogFileAction extends Action {
151
- static { this.ID = 'workbench.action.openSessionLogFile'; }
152
- static { this.TITLE = ( localize2(6177, "Open Window Log File (Session)...")); }
153
- constructor(id, label, environmentService, fileService, quickInputService, editorService) {
154
- super(id, label);
155
- this.environmentService = environmentService;
156
- this.fileService = fileService;
157
- this.quickInputService = quickInputService;
158
- this.editorService = editorService;
159
- }
160
- async run() {
161
- const sessionResult = await this.quickInputService.pick(this.getSessions().then(sessions => ( (sessions.map((s, index) => ({
162
- id: ( (s.toString())),
163
- label: basename(s),
164
- description: index === 0 ? ( localize(6178, "Current")) : undefined
165
- }))))), {
166
- canPickMany: false,
167
- placeHolder: ( localize(6179, "Select Session"))
168
- });
169
- if (sessionResult) {
170
- const logFileResult = await this.quickInputService.pick(this.getLogFiles(( (URI.parse(sessionResult.id)))).then(logFiles => ( (logFiles.map((s) => ({
171
- id: ( (s.toString())),
172
- label: basename(s)
173
- }))))), {
174
- canPickMany: false,
175
- placeHolder: ( localize(6180, "Select Log file"))
176
- });
177
- if (logFileResult) {
178
- return this.editorService.openEditor({ resource: ( (URI.parse(logFileResult.id))), options: { pinned: true } }).then(() => undefined);
179
- }
180
- }
181
- }
182
- async getSessions() {
183
- const logsPath = this.environmentService.logsHome.with({ scheme: this.environmentService.logFile.scheme });
184
- const result = [logsPath];
185
- const stat = await this.fileService.resolve(dirname(logsPath));
186
- if (stat.children) {
187
- result.push(...( (stat.children
188
- .filter(stat => !isEqual(stat.resource, logsPath) && stat.isDirectory && /^\d{8}T\d{6}$/.test(stat.name))
189
- .sort()
190
- .reverse()
191
- .map(d => d.resource))));
192
- }
193
- return result;
194
- }
195
- async getLogFiles(session) {
196
- const stat = await this.fileService.resolve(session);
197
- if (stat.children) {
198
- return (
199
- (stat.children.filter(stat => !stat.isDirectory).map(stat => stat.resource))
200
- );
201
- }
202
- return [];
203
- }
204
- });
205
-
206
- export { SetLogLevelAction };