@codingame/monaco-vscode-api 3.0.0 → 3.1.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.
Files changed (38) hide show
  1. package/api.js +1 -1
  2. package/assets/continue-tb.png +0 -0
  3. package/assets/pause-tb.png +0 -0
  4. package/assets/restart-tb.png +0 -0
  5. package/assets/run-with-debugging-tb.png +0 -0
  6. package/assets/stepinto-tb.png +0 -0
  7. package/assets/stepout-tb.png +0 -0
  8. package/assets/stepover-tb.png +0 -0
  9. package/assets/stop-tb.png +0 -0
  10. package/contributions.js +2 -0
  11. package/missing-services.js +17 -2
  12. package/package.json +8 -8
  13. package/service-override/tools/editorAssets.js +3 -0
  14. package/services.d.ts +6 -3
  15. package/services.js +17 -3
  16. package/vscode/src/vs/base/common/lifecycle.js +158 -1
  17. package/vscode/src/vs/base/common/observableInternal/autorun.js +3 -1
  18. package/vscode/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -0
  19. package/vscode/src/vs/platform/tunnel/common/tunnel.js +267 -1
  20. package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +1 -1
  21. package/vscode/src/vs/workbench/api/common/extHostNotebookDocument.js +1 -11
  22. package/vscode/src/vs/workbench/browser/actions/developerActions.js +703 -0
  23. package/vscode/src/vs/workbench/browser/actions/media/actions.css.js +4 -0
  24. package/vscode/src/vs/workbench/browser/actions/navigationActions.js +300 -0
  25. package/vscode/src/vs/workbench/browser/actions/textInputActions.js +83 -0
  26. package/vscode/src/vs/workbench/browser/dnd.js +2 -1
  27. package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +323 -8
  28. package/vscode/src/vs/workbench/common/contributions.d.ts +44 -1
  29. package/vscode/src/vs/workbench/common/contributions.js +8 -1
  30. package/vscode/src/vs/workbench/common/views.js +1 -3
  31. package/vscode/src/vs/workbench/contrib/debug/browser/media/all.png.js +11 -0
  32. package/vscode/src/vs/workbench/contrib/files/browser/files.editorPane.contribution.js +67 -0
  33. package/vscode/src/vs/workbench/contrib/logs/common/defaultLogLevels.js +140 -0
  34. package/vscode/src/vs/workbench/services/workspaces/common/workspaceIdentityService.js +102 -0
  35. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -430
  36. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  37. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -510
  38. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
@@ -0,0 +1,703 @@
1
+ import './media/actions.css.js';
2
+ import { localizeWithPath, localize2WithPath } from '../../../nls.js';
3
+ import { IKeybindingService } from '../../../platform/keybinding/common/keybinding.js';
4
+ import { DomEmitter } from '../../../base/browser/event.js';
5
+ import { Color } from '../../../base/common/color.js';
6
+ import { Event, Emitter } from '../../../base/common/event.js';
7
+ import { DisposableStore, toDisposable, dispose, DisposableTracker, setDisposableTracker } from '../../../base/common/lifecycle.js';
8
+ import { createStyleSheet, createCSSRule, getActiveDocument, getDomNodePagePosition, append, $, getWindows, onDidRegisterWindow } from '../../../base/browser/dom.js';
9
+ import { IConfigurationService } from '../../../platform/configuration/common/configuration.js';
10
+ import { IContextKeyService, ContextKeyExpr, RawContextKey } from '../../../platform/contextkey/common/contextkey.js';
11
+ import { StandardKeyboardEvent } from '../../../base/browser/keyboardEvent.js';
12
+ import { RunOnceScheduler } from '../../../base/common/async.js';
13
+ import { ILayoutService } from '../../../platform/layout/browser/layoutService.js';
14
+ import { Registry } from '../../../platform/registry/common/platform.js';
15
+ import { registerAction2, Action2, MenuRegistry } from '../../../platform/actions/common/actions.js';
16
+ import { IStorageService } from '../../../platform/storage/common/storage.js';
17
+ import { clamp } from '../../../base/common/numbers.js';
18
+ import { Extensions } from '../../../platform/configuration/common/configurationRegistry.js';
19
+ import { ILogService } from '../../../platform/log/common/log.js';
20
+ import { IWorkingCopyService } from '../../services/workingCopy/common/workingCopyService.js';
21
+ import { Categories } from '../../../platform/action/common/actionCommonCategories.js';
22
+ import { IWorkingCopyBackupService } from '../../services/workingCopy/common/workingCopyBackup.js';
23
+ import '../../../../../../override/vs/platform/dialogs/common/dialogs.js';
24
+ import { IOutputService } from '../../services/output/common/output.js';
25
+ import { windowLogId } from '../../services/log/common/logConstants.js';
26
+ import { ByteSize } from '../../../platform/files/common/files.js';
27
+ import { IQuickInputService } from '../../../platform/quickinput/common/quickInput.js';
28
+ import { IUserDataProfileService } from '../../services/userDataProfile/common/userDataProfile.js';
29
+ import { IEditorService } from '../../services/editor/common/editorService.js';
30
+ import product from '../../../platform/product/common/product.js';
31
+ import { CommandsRegistry } from '../../../platform/commands/common/commands.js';
32
+ import { IEnvironmentService } from '../../../platform/environment/common/environment.js';
33
+ import { IDialogService } from '../../../platform/dialogs/common/dialogs.js';
34
+ class InspectContextKeysAction extends Action2 {
35
+ constructor() {
36
+ super({
37
+ id: 'workbench.action.inspectContextKeys',
38
+ title: ( localize2WithPath(
39
+ 'vs/workbench/browser/actions/developerActions',
40
+ 'inspect context keys',
41
+ 'Inspect Context Keys'
42
+ )),
43
+ category: Categories.Developer,
44
+ f1: true
45
+ });
46
+ }
47
+ run(accessor) {
48
+ const contextKeyService = accessor.get(IContextKeyService);
49
+ const disposables = ( new DisposableStore());
50
+ const stylesheet = createStyleSheet(undefined, undefined, disposables);
51
+ createCSSRule('*', 'cursor: crosshair !important;', stylesheet);
52
+ const hoverFeedback = document.createElement('div');
53
+ const activeDocument = getActiveDocument();
54
+ activeDocument.body.appendChild(hoverFeedback);
55
+ disposables.add(toDisposable(() => activeDocument.body.removeChild(hoverFeedback)));
56
+ hoverFeedback.style.position = 'absolute';
57
+ hoverFeedback.style.pointerEvents = 'none';
58
+ hoverFeedback.style.backgroundColor = 'rgba(255, 0, 0, 0.5)';
59
+ hoverFeedback.style.zIndex = '1000';
60
+ const onMouseMove = disposables.add(( new DomEmitter(activeDocument, 'mousemove', true)));
61
+ disposables.add(onMouseMove.event(e => {
62
+ const target = e.target;
63
+ const position = getDomNodePagePosition(target);
64
+ hoverFeedback.style.top = `${position.top}px`;
65
+ hoverFeedback.style.left = `${position.left}px`;
66
+ hoverFeedback.style.width = `${position.width}px`;
67
+ hoverFeedback.style.height = `${position.height}px`;
68
+ }));
69
+ const onMouseDown = disposables.add(( new DomEmitter(activeDocument, 'mousedown', true)));
70
+ Event.once(onMouseDown.event)(e => { e.preventDefault(); e.stopPropagation(); }, null, disposables);
71
+ const onMouseUp = disposables.add(( new DomEmitter(activeDocument, 'mouseup', true)));
72
+ Event.once(onMouseUp.event)(e => {
73
+ e.preventDefault();
74
+ e.stopPropagation();
75
+ const context = contextKeyService.getContext(e.target);
76
+ console.log(context.collectAllValues());
77
+ dispose(disposables);
78
+ }, null, disposables);
79
+ }
80
+ }
81
+ class ToggleScreencastModeAction extends Action2 {
82
+ constructor() {
83
+ super({
84
+ id: 'workbench.action.toggleScreencastMode',
85
+ title: ( localize2WithPath(
86
+ 'vs/workbench/browser/actions/developerActions',
87
+ 'toggle screencast mode',
88
+ 'Toggle Screencast Mode'
89
+ )),
90
+ category: Categories.Developer,
91
+ f1: true
92
+ });
93
+ }
94
+ run(accessor) {
95
+ if (ToggleScreencastModeAction.disposable) {
96
+ ToggleScreencastModeAction.disposable.dispose();
97
+ ToggleScreencastModeAction.disposable = undefined;
98
+ return;
99
+ }
100
+ const layoutService = accessor.get(ILayoutService);
101
+ const configurationService = accessor.get(IConfigurationService);
102
+ const keybindingService = accessor.get(IKeybindingService);
103
+ const disposables = ( new DisposableStore());
104
+ const container = layoutService.activeContainer;
105
+ const mouseMarker = append(container, $('.screencast-mouse'));
106
+ disposables.add(toDisposable(() => mouseMarker.remove()));
107
+ const keyboardMarker = append(container, $('.screencast-keyboard'));
108
+ disposables.add(toDisposable(() => keyboardMarker.remove()));
109
+ const onMouseDown = disposables.add(( new Emitter()));
110
+ const onMouseUp = disposables.add(( new Emitter()));
111
+ const onMouseMove = disposables.add(( new Emitter()));
112
+ function registerContainerListeners(container, disposables) {
113
+ disposables.add(disposables.add(( new DomEmitter(container, 'mousedown', true))).event(e => onMouseDown.fire(e)));
114
+ disposables.add(disposables.add(( new DomEmitter(container, 'mouseup', true))).event(e => onMouseUp.fire(e)));
115
+ disposables.add(disposables.add(( new DomEmitter(container, 'mousemove', true))).event(e => onMouseMove.fire(e)));
116
+ }
117
+ for (const { window, disposables } of getWindows()) {
118
+ registerContainerListeners(layoutService.getContainer(window), disposables);
119
+ }
120
+ disposables.add(onDidRegisterWindow(({ window, disposables }) => registerContainerListeners(layoutService.getContainer(window), disposables)));
121
+ disposables.add(layoutService.onDidChangeActiveContainer(() => {
122
+ layoutService.activeContainer.appendChild(mouseMarker);
123
+ layoutService.activeContainer.appendChild(keyboardMarker);
124
+ }));
125
+ const updateMouseIndicatorColor = () => {
126
+ mouseMarker.style.borderColor = ( ( Color.fromHex(configurationService.getValue('screencastMode.mouseIndicatorColor'))).toString());
127
+ };
128
+ let mouseIndicatorSize;
129
+ const updateMouseIndicatorSize = () => {
130
+ mouseIndicatorSize = clamp(configurationService.getValue('screencastMode.mouseIndicatorSize') || 20, 20, 100);
131
+ mouseMarker.style.height = `${mouseIndicatorSize}px`;
132
+ mouseMarker.style.width = `${mouseIndicatorSize}px`;
133
+ };
134
+ updateMouseIndicatorColor();
135
+ updateMouseIndicatorSize();
136
+ disposables.add(onMouseDown.event(e => {
137
+ mouseMarker.style.top = `${e.clientY - mouseIndicatorSize / 2}px`;
138
+ mouseMarker.style.left = `${e.clientX - mouseIndicatorSize / 2}px`;
139
+ mouseMarker.style.display = 'block';
140
+ mouseMarker.style.transform = `scale(${1})`;
141
+ mouseMarker.style.transition = 'transform 0.1s';
142
+ const mouseMoveListener = onMouseMove.event(e => {
143
+ mouseMarker.style.top = `${e.clientY - mouseIndicatorSize / 2}px`;
144
+ mouseMarker.style.left = `${e.clientX - mouseIndicatorSize / 2}px`;
145
+ mouseMarker.style.transform = `scale(${.8})`;
146
+ });
147
+ Event.once(onMouseUp.event)(() => {
148
+ mouseMarker.style.display = 'none';
149
+ mouseMoveListener.dispose();
150
+ });
151
+ }));
152
+ const updateKeyboardFontSize = () => {
153
+ keyboardMarker.style.fontSize = `${clamp(configurationService.getValue('screencastMode.fontSize') || 56, 20, 100)}px`;
154
+ };
155
+ const updateKeyboardMarker = () => {
156
+ keyboardMarker.style.bottom = `${clamp(configurationService.getValue('screencastMode.verticalOffset') || 0, 0, 90)}%`;
157
+ };
158
+ let keyboardMarkerTimeout;
159
+ const updateKeyboardMarkerTimeout = () => {
160
+ keyboardMarkerTimeout = clamp(configurationService.getValue('screencastMode.keyboardOverlayTimeout') || 800, 500, 5000);
161
+ };
162
+ updateKeyboardFontSize();
163
+ updateKeyboardMarker();
164
+ updateKeyboardMarkerTimeout();
165
+ disposables.add(configurationService.onDidChangeConfiguration(e => {
166
+ if (e.affectsConfiguration('screencastMode.verticalOffset')) {
167
+ updateKeyboardMarker();
168
+ }
169
+ if (e.affectsConfiguration('screencastMode.fontSize')) {
170
+ updateKeyboardFontSize();
171
+ }
172
+ if (e.affectsConfiguration('screencastMode.keyboardOverlayTimeout')) {
173
+ updateKeyboardMarkerTimeout();
174
+ }
175
+ if (e.affectsConfiguration('screencastMode.mouseIndicatorColor')) {
176
+ updateMouseIndicatorColor();
177
+ }
178
+ if (e.affectsConfiguration('screencastMode.mouseIndicatorSize')) {
179
+ updateMouseIndicatorSize();
180
+ }
181
+ }));
182
+ const onKeyDown = disposables.add(( new Emitter()));
183
+ const onCompositionStart = disposables.add(( new Emitter()));
184
+ const onCompositionUpdate = disposables.add(( new Emitter()));
185
+ const onCompositionEnd = disposables.add(( new Emitter()));
186
+ function registerWindowListeners(window, disposables) {
187
+ disposables.add(disposables.add(( new DomEmitter(window, 'keydown', true))).event(e => onKeyDown.fire(e)));
188
+ disposables.add(disposables.add(( new DomEmitter(window, 'compositionstart', true))).event(e => onCompositionStart.fire(e)));
189
+ disposables.add(disposables.add(( new DomEmitter(window, 'compositionupdate', true))).event(e => onCompositionUpdate.fire(e)));
190
+ disposables.add(disposables.add(( new DomEmitter(window, 'compositionend', true))).event(e => onCompositionEnd.fire(e)));
191
+ }
192
+ for (const { window, disposables } of getWindows()) {
193
+ registerWindowListeners(window, disposables);
194
+ }
195
+ disposables.add(onDidRegisterWindow(({ window, disposables }) => registerWindowListeners(window, disposables)));
196
+ let length = 0;
197
+ let composing = undefined;
198
+ let imeBackSpace = false;
199
+ const clearKeyboardScheduler = ( new RunOnceScheduler(() => {
200
+ keyboardMarker.textContent = '';
201
+ composing = undefined;
202
+ length = 0;
203
+ }, keyboardMarkerTimeout));
204
+ disposables.add(onCompositionStart.event(e => {
205
+ imeBackSpace = true;
206
+ }));
207
+ disposables.add(onCompositionUpdate.event(e => {
208
+ if (e.data && imeBackSpace) {
209
+ if (length > 20) {
210
+ keyboardMarker.innerText = '';
211
+ length = 0;
212
+ }
213
+ composing = composing ?? append(keyboardMarker, $('span.key'));
214
+ composing.textContent = e.data;
215
+ }
216
+ else if (imeBackSpace) {
217
+ keyboardMarker.innerText = '';
218
+ append(keyboardMarker, $('span.key', {}, `Backspace`));
219
+ }
220
+ clearKeyboardScheduler.schedule();
221
+ }));
222
+ disposables.add(onCompositionEnd.event(e => {
223
+ composing = undefined;
224
+ length++;
225
+ }));
226
+ disposables.add(onKeyDown.event(e => {
227
+ if (e.key === 'Process' || /[\uac00-\ud787\u3131-\u314e\u314f-\u3163\u3041-\u3094\u30a1-\u30f4\u30fc\u3005\u3006\u3024\u4e00-\u9fa5]/u.test(e.key)) {
228
+ if (e.code === 'Backspace') {
229
+ imeBackSpace = true;
230
+ }
231
+ else if (!e.code.includes('Key')) {
232
+ composing = undefined;
233
+ imeBackSpace = false;
234
+ }
235
+ else {
236
+ imeBackSpace = true;
237
+ }
238
+ clearKeyboardScheduler.schedule();
239
+ return;
240
+ }
241
+ if (e.isComposing) {
242
+ return;
243
+ }
244
+ const options = configurationService.getValue('screencastMode.keyboardOptions');
245
+ const event = ( new StandardKeyboardEvent(e));
246
+ const shortcut = keybindingService.softDispatch(event, event.target);
247
+ if (shortcut.kind === 2 && shortcut.commandId && !(options.showSingleEditorCursorMoves ?? true) && (['cursorLeft', 'cursorRight', 'cursorUp', 'cursorDown'].includes(shortcut.commandId))) {
248
+ return;
249
+ }
250
+ if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey
251
+ || length > 20
252
+ || event.keyCode === 1 || event.keyCode === 9
253
+ || event.keyCode === 16 || event.keyCode === 18
254
+ || event.keyCode === 15 || event.keyCode === 17 ) {
255
+ keyboardMarker.innerText = '';
256
+ length = 0;
257
+ }
258
+ const keybinding = keybindingService.resolveKeyboardEvent(event);
259
+ const commandDetails = (this._isKbFound(shortcut) && shortcut.commandId) ? this.getCommandDetails(shortcut.commandId) : undefined;
260
+ let commandAndGroupLabel = commandDetails?.title;
261
+ let keyLabel = keybinding.getLabel();
262
+ if (commandDetails) {
263
+ if ((options.showCommandGroups ?? false) && commandDetails.category) {
264
+ commandAndGroupLabel = `${commandDetails.category}: ${commandAndGroupLabel} `;
265
+ }
266
+ if (this._isKbFound(shortcut) && shortcut.commandId) {
267
+ const keybindings = keybindingService.lookupKeybindings(shortcut.commandId)
268
+ .filter(k => k.getLabel()?.endsWith(keyLabel ?? ''));
269
+ if (keybindings.length > 0) {
270
+ keyLabel = keybindings[keybindings.length - 1].getLabel();
271
+ }
272
+ }
273
+ }
274
+ if ((options.showCommands ?? true) && commandAndGroupLabel) {
275
+ append(keyboardMarker, $('span.title', {}, `${commandAndGroupLabel} `));
276
+ }
277
+ if ((options.showKeys ?? true) || ((options.showKeybindings ?? true) && this._isKbFound(shortcut))) {
278
+ keyLabel = keyLabel?.replace('UpArrow', '↑')
279
+ ?.replace('DownArrow', '↓')
280
+ ?.replace('LeftArrow', '←')
281
+ ?.replace('RightArrow', '→');
282
+ append(keyboardMarker, $('span.key', {}, keyLabel ?? ''));
283
+ }
284
+ length++;
285
+ clearKeyboardScheduler.schedule();
286
+ }));
287
+ ToggleScreencastModeAction.disposable = disposables;
288
+ }
289
+ _isKbFound(resolutionResult) {
290
+ return resolutionResult.kind === 2 ;
291
+ }
292
+ getCommandDetails(commandId) {
293
+ const fromMenuRegistry = MenuRegistry.getCommand(commandId);
294
+ if (fromMenuRegistry) {
295
+ return {
296
+ title: typeof fromMenuRegistry.title === 'string' ? fromMenuRegistry.title : fromMenuRegistry.title.value,
297
+ category: fromMenuRegistry.category ? (typeof fromMenuRegistry.category === 'string' ? fromMenuRegistry.category : fromMenuRegistry.category.value) : undefined
298
+ };
299
+ }
300
+ const fromCommandsRegistry = CommandsRegistry.getCommand(commandId);
301
+ if (fromCommandsRegistry && fromCommandsRegistry.metadata?.description) {
302
+ return { title: typeof fromCommandsRegistry.metadata.description === 'string' ? fromCommandsRegistry.metadata.description : fromCommandsRegistry.metadata.description.value };
303
+ }
304
+ return undefined;
305
+ }
306
+ }
307
+ class LogStorageAction extends Action2 {
308
+ constructor() {
309
+ super({
310
+ id: 'workbench.action.logStorage',
311
+ title: ( localize2WithPath(
312
+ 'vs/workbench/browser/actions/developerActions',
313
+ { key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] },
314
+ "Log Storage Database Contents"
315
+ )),
316
+ category: Categories.Developer,
317
+ f1: true
318
+ });
319
+ }
320
+ run(accessor) {
321
+ const storageService = accessor.get(IStorageService);
322
+ const dialogService = accessor.get(IDialogService);
323
+ storageService.log();
324
+ dialogService.info(( localizeWithPath(
325
+ 'vs/workbench/browser/actions/developerActions',
326
+ 'storageLogDialogMessage',
327
+ "The storage database contents have been logged to the developer tools."
328
+ )), ( localizeWithPath(
329
+ 'vs/workbench/browser/actions/developerActions',
330
+ 'storageLogDialogDetails',
331
+ "Open developer tools from the menu and select the Console tab."
332
+ )));
333
+ }
334
+ }
335
+ class LogWorkingCopiesAction extends Action2 {
336
+ constructor() {
337
+ super({
338
+ id: 'workbench.action.logWorkingCopies',
339
+ title: ( localize2WithPath(
340
+ 'vs/workbench/browser/actions/developerActions',
341
+ { key: 'logWorkingCopies', comment: ['A developer only action to log the working copies that exist.'] },
342
+ "Log Working Copies"
343
+ )),
344
+ category: Categories.Developer,
345
+ f1: true
346
+ });
347
+ }
348
+ async run(accessor) {
349
+ const workingCopyService = accessor.get(IWorkingCopyService);
350
+ const workingCopyBackupService = accessor.get(IWorkingCopyBackupService);
351
+ const logService = accessor.get(ILogService);
352
+ const outputService = accessor.get(IOutputService);
353
+ const backups = await workingCopyBackupService.getBackups();
354
+ const msg = [
355
+ ``,
356
+ `[Working Copies]`,
357
+ ...((workingCopyService.workingCopies.length > 0) ? ( workingCopyService.workingCopies.map(workingCopy => `${workingCopy.isDirty() ? '● ' : ''}${( workingCopy.resource.toString(true))} (typeId: ${workingCopy.typeId || '<no typeId>'})`)) : ['<none>']),
358
+ ``,
359
+ `[Backups]`,
360
+ ...((backups.length > 0) ? ( backups.map(backup => `${( backup.resource.toString(true))} (typeId: ${backup.typeId || '<no typeId>'})`)) : ['<none>']),
361
+ ];
362
+ logService.info(msg.join('\n'));
363
+ outputService.showChannel(windowLogId, true);
364
+ }
365
+ }
366
+ class RemoveLargeStorageEntriesAction extends Action2 {
367
+ static { this.SIZE_THRESHOLD = 1024 * 16; }
368
+ constructor() {
369
+ super({
370
+ id: 'workbench.action.removeLargeStorageDatabaseEntries',
371
+ title: ( localize2WithPath(
372
+ 'vs/workbench/browser/actions/developerActions',
373
+ 'removeLargeStorageDatabaseEntries',
374
+ 'Remove Large Storage Database Entries...'
375
+ )),
376
+ category: Categories.Developer,
377
+ f1: true
378
+ });
379
+ }
380
+ async run(accessor) {
381
+ const storageService = accessor.get(IStorageService);
382
+ const quickInputService = accessor.get(IQuickInputService);
383
+ const userDataProfileService = accessor.get(IUserDataProfileService);
384
+ const dialogService = accessor.get(IDialogService);
385
+ const environmentService = accessor.get(IEnvironmentService);
386
+ const items = [];
387
+ for (const scope of [-1 , 0 , 1 ]) {
388
+ if (scope === 0 && userDataProfileService.currentProfile.isDefault) {
389
+ continue;
390
+ }
391
+ for (const target of [1 , 0 ]) {
392
+ for (const key of ( storageService.keys(scope, target))) {
393
+ const value = storageService.get(key, scope);
394
+ if (value && (!environmentService.isBuilt || value.length > RemoveLargeStorageEntriesAction.SIZE_THRESHOLD)) {
395
+ items.push({
396
+ key,
397
+ scope,
398
+ target,
399
+ size: value.length,
400
+ label: key,
401
+ description: ByteSize.formatSize(value.length),
402
+ detail: ( localizeWithPath(
403
+ 'vs/workbench/browser/actions/developerActions',
404
+ 'largeStorageItemDetail',
405
+ "Scope: {0}, Target: {1}",
406
+ scope === -1 ? ( localizeWithPath('vs/workbench/browser/actions/developerActions', 'global', "Global")) : scope === 0 ? ( localizeWithPath('vs/workbench/browser/actions/developerActions', 'profile', "Profile")) : ( localizeWithPath('vs/workbench/browser/actions/developerActions', 'workspace', "Workspace")),
407
+ target === 1 ? ( localizeWithPath('vs/workbench/browser/actions/developerActions', 'machine', "Machine")) : ( localizeWithPath('vs/workbench/browser/actions/developerActions', 'user', "User"))
408
+ )),
409
+ });
410
+ }
411
+ }
412
+ }
413
+ }
414
+ items.sort((itemA, itemB) => itemB.size - itemA.size);
415
+ const selectedItems = await ( new Promise(resolve => {
416
+ const disposables = ( new DisposableStore());
417
+ const picker = disposables.add(quickInputService.createQuickPick());
418
+ picker.items = items;
419
+ picker.canSelectMany = true;
420
+ picker.ok = false;
421
+ picker.customButton = true;
422
+ picker.hideCheckAll = true;
423
+ picker.customLabel = ( localizeWithPath(
424
+ 'vs/workbench/browser/actions/developerActions',
425
+ 'removeLargeStorageEntriesPickerButton',
426
+ "Remove"
427
+ ));
428
+ picker.placeholder = ( localizeWithPath(
429
+ 'vs/workbench/browser/actions/developerActions',
430
+ 'removeLargeStorageEntriesPickerPlaceholder',
431
+ "Select large entries to remove from storage"
432
+ ));
433
+ if (items.length === 0) {
434
+ picker.description = ( localizeWithPath(
435
+ 'vs/workbench/browser/actions/developerActions',
436
+ 'removeLargeStorageEntriesPickerDescriptionNoEntries',
437
+ "There are no large storage entries to remove."
438
+ ));
439
+ }
440
+ picker.show();
441
+ disposables.add(picker.onDidCustom(() => {
442
+ resolve(picker.selectedItems);
443
+ picker.hide();
444
+ }));
445
+ disposables.add(picker.onDidHide(() => disposables.dispose()));
446
+ }));
447
+ if (selectedItems.length === 0) {
448
+ return;
449
+ }
450
+ const { confirmed } = await dialogService.confirm({
451
+ type: 'warning',
452
+ message: ( localizeWithPath(
453
+ 'vs/workbench/browser/actions/developerActions',
454
+ 'removeLargeStorageEntriesConfirmRemove',
455
+ "Do you want to remove the selected storage entries from the database?"
456
+ )),
457
+ detail: ( localizeWithPath(
458
+ 'vs/workbench/browser/actions/developerActions',
459
+ 'removeLargeStorageEntriesConfirmRemoveDetail',
460
+ "{0}\n\nThis action is irreversible and may result in data loss!",
461
+ ( selectedItems.map(item => item.label)).join('\n')
462
+ )),
463
+ primaryButton: ( localizeWithPath(
464
+ 'vs/workbench/browser/actions/developerActions',
465
+ { key: 'removeLargeStorageEntriesButtonLabel', comment: ['&& denotes a mnemonic'] },
466
+ "&&Remove"
467
+ ))
468
+ });
469
+ if (!confirmed) {
470
+ return;
471
+ }
472
+ const scopesToOptimize = ( new Set());
473
+ for (const item of selectedItems) {
474
+ storageService.remove(item.key, item.scope);
475
+ scopesToOptimize.add(item.scope);
476
+ }
477
+ for (const scope of scopesToOptimize) {
478
+ await storageService.optimize(scope);
479
+ }
480
+ }
481
+ }
482
+ let tracker = undefined;
483
+ let trackedDisposables = ( new Set());
484
+ const DisposablesSnapshotStateContext = ( new RawContextKey('dirtyWorkingCopies', 'stopped'));
485
+ class StartTrackDisposables extends Action2 {
486
+ constructor() {
487
+ super({
488
+ id: 'workbench.action.startTrackDisposables',
489
+ title: ( localize2WithPath(
490
+ 'vs/workbench/browser/actions/developerActions',
491
+ 'startTrackDisposables',
492
+ 'Start Tracking Disposables'
493
+ )),
494
+ category: Categories.Developer,
495
+ f1: true,
496
+ precondition: ( ContextKeyExpr.and(( ( DisposablesSnapshotStateContext.isEqualTo('pending')).negate()), ( ( DisposablesSnapshotStateContext.isEqualTo('started')).negate())))
497
+ });
498
+ }
499
+ run(accessor) {
500
+ const disposablesSnapshotStateContext = DisposablesSnapshotStateContext.bindTo(accessor.get(IContextKeyService));
501
+ disposablesSnapshotStateContext.set('started');
502
+ trackedDisposables.clear();
503
+ tracker = ( new DisposableTracker());
504
+ setDisposableTracker(tracker);
505
+ }
506
+ }
507
+ class SnapshotTrackedDisposables extends Action2 {
508
+ constructor() {
509
+ super({
510
+ id: 'workbench.action.snapshotTrackedDisposables',
511
+ title: ( localize2WithPath(
512
+ 'vs/workbench/browser/actions/developerActions',
513
+ 'snapshotTrackedDisposables',
514
+ 'Snapshot Tracked Disposables'
515
+ )),
516
+ category: Categories.Developer,
517
+ f1: true,
518
+ precondition: ( DisposablesSnapshotStateContext.isEqualTo('started'))
519
+ });
520
+ }
521
+ run(accessor) {
522
+ const disposablesSnapshotStateContext = DisposablesSnapshotStateContext.bindTo(accessor.get(IContextKeyService));
523
+ disposablesSnapshotStateContext.set('pending');
524
+ trackedDisposables = ( new Set(
525
+ tracker?.computeLeakingDisposables(1000)?.leaks.map(disposable => disposable.value)
526
+ ));
527
+ }
528
+ }
529
+ class StopTrackDisposables extends Action2 {
530
+ constructor() {
531
+ super({
532
+ id: 'workbench.action.stopTrackDisposables',
533
+ title: ( localize2WithPath(
534
+ 'vs/workbench/browser/actions/developerActions',
535
+ 'stopTrackDisposables',
536
+ 'Stop Tracking Disposables'
537
+ )),
538
+ category: Categories.Developer,
539
+ f1: true,
540
+ precondition: ( DisposablesSnapshotStateContext.isEqualTo('pending'))
541
+ });
542
+ }
543
+ run(accessor) {
544
+ const editorService = accessor.get(IEditorService);
545
+ const disposablesSnapshotStateContext = DisposablesSnapshotStateContext.bindTo(accessor.get(IContextKeyService));
546
+ disposablesSnapshotStateContext.set('stopped');
547
+ if (tracker) {
548
+ const disposableLeaks = ( new Set());
549
+ for (const disposable of ( new Set(tracker.computeLeakingDisposables(1000)?.leaks)) ?? []) {
550
+ if (( trackedDisposables.has(disposable.value))) {
551
+ disposableLeaks.add(disposable);
552
+ }
553
+ }
554
+ const leaks = tracker.computeLeakingDisposables(1000, Array.from(disposableLeaks));
555
+ if (leaks) {
556
+ editorService.openEditor({ resource: undefined, contents: leaks.details });
557
+ }
558
+ }
559
+ setDisposableTracker(null);
560
+ tracker = undefined;
561
+ trackedDisposables.clear();
562
+ }
563
+ }
564
+ registerAction2(InspectContextKeysAction);
565
+ registerAction2(ToggleScreencastModeAction);
566
+ registerAction2(LogStorageAction);
567
+ registerAction2(LogWorkingCopiesAction);
568
+ registerAction2(RemoveLargeStorageEntriesAction);
569
+ if (!product.commit) {
570
+ registerAction2(StartTrackDisposables);
571
+ registerAction2(SnapshotTrackedDisposables);
572
+ registerAction2(StopTrackDisposables);
573
+ }
574
+ const configurationRegistry = ( Registry.as(Extensions.Configuration));
575
+ configurationRegistry.registerConfiguration({
576
+ id: 'screencastMode',
577
+ order: 9,
578
+ title: ( localizeWithPath(
579
+ 'vs/workbench/browser/actions/developerActions',
580
+ 'screencastModeConfigurationTitle',
581
+ "Screencast Mode"
582
+ )),
583
+ type: 'object',
584
+ properties: {
585
+ 'screencastMode.verticalOffset': {
586
+ type: 'number',
587
+ default: 20,
588
+ minimum: 0,
589
+ maximum: 90,
590
+ description: ( localizeWithPath(
591
+ 'vs/workbench/browser/actions/developerActions',
592
+ 'screencastMode.location.verticalPosition',
593
+ "Controls the vertical offset of the screencast mode overlay from the bottom as a percentage of the workbench height."
594
+ ))
595
+ },
596
+ 'screencastMode.fontSize': {
597
+ type: 'number',
598
+ default: 56,
599
+ minimum: 20,
600
+ maximum: 100,
601
+ description: ( localizeWithPath(
602
+ 'vs/workbench/browser/actions/developerActions',
603
+ 'screencastMode.fontSize',
604
+ "Controls the font size (in pixels) of the screencast mode keyboard."
605
+ ))
606
+ },
607
+ 'screencastMode.keyboardOptions': {
608
+ type: 'object',
609
+ description: ( localizeWithPath(
610
+ 'vs/workbench/browser/actions/developerActions',
611
+ 'screencastMode.keyboardOptions.description',
612
+ "Options for customizing the keyboard overlay in screencast mode."
613
+ )),
614
+ properties: {
615
+ 'showKeys': {
616
+ type: 'boolean',
617
+ default: true,
618
+ description: ( localizeWithPath(
619
+ 'vs/workbench/browser/actions/developerActions',
620
+ 'screencastMode.keyboardOptions.showKeys',
621
+ "Show raw keys."
622
+ ))
623
+ },
624
+ 'showKeybindings': {
625
+ type: 'boolean',
626
+ default: true,
627
+ description: ( localizeWithPath(
628
+ 'vs/workbench/browser/actions/developerActions',
629
+ 'screencastMode.keyboardOptions.showKeybindings',
630
+ "Show keyboard shortcuts."
631
+ ))
632
+ },
633
+ 'showCommands': {
634
+ type: 'boolean',
635
+ default: true,
636
+ description: ( localizeWithPath(
637
+ 'vs/workbench/browser/actions/developerActions',
638
+ 'screencastMode.keyboardOptions.showCommands',
639
+ "Show command names."
640
+ ))
641
+ },
642
+ 'showCommandGroups': {
643
+ type: 'boolean',
644
+ default: false,
645
+ description: ( localizeWithPath(
646
+ 'vs/workbench/browser/actions/developerActions',
647
+ 'screencastMode.keyboardOptions.showCommandGroups',
648
+ "Show command group names, when commands are also shown."
649
+ ))
650
+ },
651
+ 'showSingleEditorCursorMoves': {
652
+ type: 'boolean',
653
+ default: true,
654
+ description: ( localizeWithPath(
655
+ 'vs/workbench/browser/actions/developerActions',
656
+ 'screencastMode.keyboardOptions.showSingleEditorCursorMoves',
657
+ "Show single editor cursor move commands."
658
+ ))
659
+ }
660
+ },
661
+ default: {
662
+ 'showKeys': true,
663
+ 'showKeybindings': true,
664
+ 'showCommands': true,
665
+ 'showCommandGroups': false,
666
+ 'showSingleEditorCursorMoves': true
667
+ },
668
+ additionalProperties: false
669
+ },
670
+ 'screencastMode.keyboardOverlayTimeout': {
671
+ type: 'number',
672
+ default: 800,
673
+ minimum: 500,
674
+ maximum: 5000,
675
+ description: ( localizeWithPath(
676
+ 'vs/workbench/browser/actions/developerActions',
677
+ 'screencastMode.keyboardOverlayTimeout',
678
+ "Controls how long (in milliseconds) the keyboard overlay is shown in screencast mode."
679
+ ))
680
+ },
681
+ 'screencastMode.mouseIndicatorColor': {
682
+ type: 'string',
683
+ format: 'color-hex',
684
+ default: '#FF0000',
685
+ description: ( localizeWithPath(
686
+ 'vs/workbench/browser/actions/developerActions',
687
+ 'screencastMode.mouseIndicatorColor',
688
+ "Controls the color in hex (#RGB, #RGBA, #RRGGBB or #RRGGBBAA) of the mouse indicator in screencast mode."
689
+ ))
690
+ },
691
+ 'screencastMode.mouseIndicatorSize': {
692
+ type: 'number',
693
+ default: 20,
694
+ minimum: 20,
695
+ maximum: 100,
696
+ description: ( localizeWithPath(
697
+ 'vs/workbench/browser/actions/developerActions',
698
+ 'screencastMode.mouseIndicatorSize',
699
+ "Controls the size (in pixels) of the mouse indicator in screencast mode."
700
+ ))
701
+ },
702
+ }
703
+ });