@codingame/monaco-vscode-api 1.83.15-next.0 → 1.83.16

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 (53) hide show
  1. package/README.md +430 -0
  2. package/contributions.js +3 -0
  3. package/localExtensionHost.js +3 -2
  4. package/missing-services.js +57 -1
  5. package/monaco-editor-treemending.patch +3375 -3375
  6. package/package.json +6 -6
  7. package/vscode/src/vs/base/common/prefixTree.js +130 -0
  8. package/vscode/src/vs/platform/actions/browser/floatingMenu.js +26 -2
  9. package/vscode/src/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +41 -0
  10. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +566 -0
  11. package/vscode/src/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +29 -0
  12. package/vscode/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +48 -0
  13. package/vscode/src/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +94 -0
  14. package/vscode/src/vs/platform/terminal/common/terminalEnvironment.js +37 -0
  15. package/vscode/src/vs/platform/terminal/common/terminalStrings.js +16 -0
  16. package/vscode/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +319 -0
  17. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +91 -1
  18. package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +423 -0
  19. package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +82 -0
  20. package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +564 -11
  21. package/vscode/src/vs/workbench/contrib/scm/common/scm.js +9 -1
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalExtensions.js +25 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +64 -0
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +538 -0
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +104 -0
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
  29. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
  30. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +799 -0
  31. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +101 -0
  32. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +30 -0
  33. package/vscode/src/vs/workbench/contrib/testing/common/storedValue.js +36 -0
  34. package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +116 -0
  35. package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +172 -1
  36. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +384 -0
  37. package/vscode/src/vs/workbench/contrib/testing/common/testResultService.js +156 -1
  38. package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +156 -0
  39. package/vscode/src/vs/workbench/contrib/testing/common/testService.js +75 -1
  40. package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +9 -1
  41. package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +179 -0
  42. package/vscode/src/vs/workbench/contrib/testing/common/testingContinuousRunService.js +102 -0
  43. package/vscode/src/vs/workbench/contrib/testing/common/testingDecorations.js +29 -0
  44. package/vscode/src/vs/workbench/contrib/testing/common/testingPeekOpener.js +3 -0
  45. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +47 -0
  46. package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +594 -2
  47. package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +307 -1
  48. package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
  49. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
  50. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
  51. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +428 -0
  52. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
  53. package/vscode/src/vs/workbench/services/textfile/common/textfiles.js +6 -2
@@ -0,0 +1,538 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { Separator } from 'monaco-editor/esm/vs/base/common/actions.js';
4
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
5
+ import { Disposable, toDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
6
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
7
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
8
+ import { AudioCue, IAudioCueService } from 'monaco-editor/esm/vs/platform/audioCues/browser/audioCueService.js';
9
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
10
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
11
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
12
+ import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
13
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
14
+ import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
15
+ import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
16
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
17
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
18
+ import { terminalDecorationMark, terminalDecorationIncomplete, terminalDecorationError, terminalDecorationSuccess } from '../terminalIcons.js';
19
+ import { TerminalDecorationHoverManager, updateLayout } from './decorationStyles.js';
20
+ import { TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR, TERMINAL_COMMAND_DECORATION_ERROR_BACKGROUND_COLOR, TERMINAL_COMMAND_DECORATION_SUCCESS_BACKGROUND_COLOR } from '../../common/terminalColorRegistry.js';
21
+ import { ILifecycleService } from '../../../../services/lifecycle/common/lifecycle.js';
22
+ let DecorationAddon = class DecorationAddon extends Disposable {
23
+ constructor(_capabilities, _clipboardService, _contextMenuService, _configurationService, _themeService, _openerService, _quickInputService, lifecycleService, _commandService, instantiationService, _audioCueService, _notificationService) {
24
+ super();
25
+ this._capabilities = _capabilities;
26
+ this._clipboardService = _clipboardService;
27
+ this._contextMenuService = _contextMenuService;
28
+ this._configurationService = _configurationService;
29
+ this._themeService = _themeService;
30
+ this._openerService = _openerService;
31
+ this._quickInputService = _quickInputService;
32
+ this._commandService = _commandService;
33
+ this._audioCueService = _audioCueService;
34
+ this._notificationService = _notificationService;
35
+ this._capabilityDisposables = ( new Map());
36
+ this._decorations = ( new Map());
37
+ this._onDidRequestRunCommand = this._register(( new Emitter()));
38
+ this.onDidRequestRunCommand = this._onDidRequestRunCommand.event;
39
+ this._register(toDisposable(() => this._dispose()));
40
+ this._register(this._configurationService.onDidChangeConfiguration(e => {
41
+ if (e.affectsConfiguration("terminal.integrated.fontSize" ) || e.affectsConfiguration("terminal.integrated.lineHeight" )) {
42
+ this.refreshLayouts();
43
+ }
44
+ else if (e.affectsConfiguration('workbench.colorCustomizations')) {
45
+ this._refreshStyles(true);
46
+ }
47
+ else if (e.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled" )) {
48
+ this._removeCapabilityDisposables(2 );
49
+ this._updateDecorationVisibility();
50
+ }
51
+ }));
52
+ this._register(this._themeService.onDidColorThemeChange(() => this._refreshStyles(true)));
53
+ this._updateDecorationVisibility();
54
+ this._register(this._capabilities.onDidAddCapabilityType(c => this._createCapabilityDisposables(c)));
55
+ this._register(this._capabilities.onDidRemoveCapabilityType(c => this._removeCapabilityDisposables(c)));
56
+ this._register(lifecycleService.onWillShutdown(() => this._disposeAllDecorations()));
57
+ this._terminalDecorationHoverService = instantiationService.createInstance(TerminalDecorationHoverManager);
58
+ }
59
+ _removeCapabilityDisposables(c) {
60
+ const disposables = this._capabilityDisposables.get(c);
61
+ if (disposables) {
62
+ dispose(disposables);
63
+ }
64
+ this._capabilityDisposables.delete(c);
65
+ }
66
+ _createCapabilityDisposables(c) {
67
+ let disposables = [];
68
+ const capability = this._capabilities.get(c);
69
+ if (!capability || ( this._capabilityDisposables.has(c))) {
70
+ return;
71
+ }
72
+ switch (capability.type) {
73
+ case 4 :
74
+ disposables = [capability.onMarkAdded(mark => this.registerMarkDecoration(mark))];
75
+ break;
76
+ case 2 :
77
+ disposables = this._getCommandDetectionListeners(capability);
78
+ break;
79
+ }
80
+ this._capabilityDisposables.set(c, disposables);
81
+ }
82
+ registerMarkDecoration(mark) {
83
+ if (!this._terminal || (!this._showGutterDecorations && !this._showOverviewRulerDecorations)) {
84
+ return undefined;
85
+ }
86
+ if (mark.hidden) {
87
+ return undefined;
88
+ }
89
+ return this.registerCommandDecoration(undefined, undefined, mark);
90
+ }
91
+ _updateDecorationVisibility() {
92
+ const showDecorations = this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled" );
93
+ this._showGutterDecorations = (showDecorations === 'both' || showDecorations === 'gutter');
94
+ this._showOverviewRulerDecorations = (showDecorations === 'both' || showDecorations === 'overviewRuler');
95
+ this._disposeAllDecorations();
96
+ if (this._showGutterDecorations || this._showOverviewRulerDecorations) {
97
+ this._attachToCommandCapability();
98
+ this._updateGutterDecorationVisibility();
99
+ }
100
+ const currentCommand = this._capabilities.get(2 )?.executingCommandObject;
101
+ if (currentCommand) {
102
+ this.registerCommandDecoration(currentCommand, true);
103
+ }
104
+ }
105
+ _disposeAllDecorations() {
106
+ this._placeholderDecoration?.dispose();
107
+ for (const value of ( this._decorations.values())) {
108
+ value.decoration.dispose();
109
+ dispose(value.disposables);
110
+ }
111
+ }
112
+ _updateGutterDecorationVisibility() {
113
+ const commandDecorationElements = document.querySelectorAll("terminal-command-decoration" );
114
+ for (const commandDecorationElement of commandDecorationElements) {
115
+ this._updateCommandDecorationVisibility(commandDecorationElement);
116
+ }
117
+ }
118
+ _updateCommandDecorationVisibility(commandDecorationElement) {
119
+ if (this._showGutterDecorations) {
120
+ commandDecorationElement.classList.remove("hide" );
121
+ }
122
+ else {
123
+ commandDecorationElement.classList.add("hide" );
124
+ }
125
+ }
126
+ refreshLayouts() {
127
+ updateLayout(this._configurationService, this._placeholderDecoration?.element);
128
+ for (const decoration of this._decorations) {
129
+ updateLayout(this._configurationService, decoration[1].decoration.element);
130
+ }
131
+ }
132
+ _refreshStyles(refreshOverviewRulerColors) {
133
+ if (refreshOverviewRulerColors) {
134
+ for (const decoration of ( this._decorations.values())) {
135
+ const color = this._getDecorationCssColor(decoration)?.toString() ?? '';
136
+ if (decoration.decoration.options?.overviewRulerOptions) {
137
+ decoration.decoration.options.overviewRulerOptions.color = color;
138
+ }
139
+ else if (decoration.decoration.options) {
140
+ decoration.decoration.options.overviewRulerOptions = { color };
141
+ }
142
+ }
143
+ }
144
+ this._updateClasses(this._placeholderDecoration?.element);
145
+ for (const decoration of ( this._decorations.values())) {
146
+ this._updateClasses(decoration.decoration.element, decoration.exitCode, decoration.markProperties);
147
+ }
148
+ }
149
+ _dispose() {
150
+ this._terminalDecorationHoverService.dispose();
151
+ for (const disposable of ( this._capabilityDisposables.values())) {
152
+ dispose(disposable);
153
+ }
154
+ this.clearDecorations();
155
+ }
156
+ _clearPlaceholder() {
157
+ this._placeholderDecoration?.dispose();
158
+ this._placeholderDecoration = undefined;
159
+ }
160
+ clearDecorations() {
161
+ this._placeholderDecoration?.marker.dispose();
162
+ this._clearPlaceholder();
163
+ this._disposeAllDecorations();
164
+ this._decorations.clear();
165
+ }
166
+ _attachToCommandCapability() {
167
+ if (( this._capabilities.has(2 ))) {
168
+ this._getCommandDetectionListeners(this._capabilities.get(2 ));
169
+ }
170
+ }
171
+ _getCommandDetectionListeners(capability) {
172
+ if (( this._capabilityDisposables.has(2 ))) {
173
+ const disposables = this._capabilityDisposables.get(2 );
174
+ dispose(disposables);
175
+ this._capabilityDisposables.delete(capability.type);
176
+ }
177
+ const commandDetectionListeners = [];
178
+ if (capability.executingCommandObject?.marker) {
179
+ this.registerCommandDecoration(capability.executingCommandObject, true);
180
+ }
181
+ commandDetectionListeners.push(capability.onCommandStarted(command => this.registerCommandDecoration(command, true)));
182
+ for (const command of capability.commands) {
183
+ this.registerCommandDecoration(command);
184
+ }
185
+ commandDetectionListeners.push(capability.onCommandFinished(command => {
186
+ this.registerCommandDecoration(command);
187
+ if (command.exitCode) {
188
+ this._audioCueService.playAudioCue(AudioCue.terminalCommandFailed);
189
+ }
190
+ }));
191
+ commandDetectionListeners.push(capability.onCommandInvalidated(commands => {
192
+ for (const command of commands) {
193
+ const id = command.marker?.id;
194
+ if (id) {
195
+ const match = this._decorations.get(id);
196
+ if (match) {
197
+ match.decoration.dispose();
198
+ dispose(match.disposables);
199
+ }
200
+ }
201
+ }
202
+ }));
203
+ commandDetectionListeners.push(capability.onCurrentCommandInvalidated((request) => {
204
+ if (request.reason === "noProblemsReported" ) {
205
+ const lastDecoration = Array.from(this._decorations.entries())[this._decorations.size - 1];
206
+ lastDecoration?.[1].decoration.dispose();
207
+ }
208
+ else if (request.reason === "windows" ) {
209
+ this._clearPlaceholder();
210
+ }
211
+ }));
212
+ return commandDetectionListeners;
213
+ }
214
+ activate(terminal) {
215
+ this._terminal = terminal;
216
+ this._attachToCommandCapability();
217
+ }
218
+ registerCommandDecoration(command, beforeCommandExecution, markProperties) {
219
+ if (!this._terminal || (beforeCommandExecution && !command) || (!this._showGutterDecorations && !this._showOverviewRulerDecorations)) {
220
+ return undefined;
221
+ }
222
+ const marker = command?.marker || markProperties?.marker;
223
+ if (!marker) {
224
+ throw new Error(`cannot add a decoration for a command ${JSON.stringify(command)} with no marker`);
225
+ }
226
+ this._clearPlaceholder();
227
+ const color = this._getDecorationCssColor(command)?.toString() ?? '';
228
+ const decoration = this._terminal.registerDecoration({
229
+ marker,
230
+ overviewRulerOptions: this._showOverviewRulerDecorations ? (beforeCommandExecution
231
+ ? { color, position: 'left' }
232
+ : { color, position: command?.exitCode ? 'right' : 'left' }) : undefined
233
+ });
234
+ if (!decoration) {
235
+ return undefined;
236
+ }
237
+ if (beforeCommandExecution) {
238
+ this._placeholderDecoration = decoration;
239
+ }
240
+ decoration.onRender(element => {
241
+ if (element.classList.contains(".xterm-decoration-overview-ruler" )) {
242
+ return;
243
+ }
244
+ if (!this._decorations.get(decoration.marker.id)) {
245
+ decoration.onDispose(() => this._decorations.delete(decoration.marker.id));
246
+ this._decorations.set(decoration.marker.id, {
247
+ decoration,
248
+ disposables: this._createDisposables(element, command, markProperties),
249
+ exitCode: command?.exitCode,
250
+ markProperties: command?.markProperties
251
+ });
252
+ }
253
+ if (!element.classList.contains("codicon" ) || command?.marker?.line === 0) {
254
+ updateLayout(this._configurationService, element);
255
+ this._updateClasses(element, command?.exitCode, command?.markProperties || markProperties);
256
+ }
257
+ });
258
+ return decoration;
259
+ }
260
+ _createDisposables(element, command, markProperties) {
261
+ if (command?.exitCode === undefined && !command?.markProperties) {
262
+ return [];
263
+ }
264
+ else if (command?.markProperties || markProperties) {
265
+ return [this._terminalDecorationHoverService.createHover(element, command || markProperties, markProperties?.hoverMessage)];
266
+ }
267
+ return [this._createContextMenu(element, command), this._terminalDecorationHoverService.createHover(element, command)];
268
+ }
269
+ _updateClasses(element, exitCode, markProperties) {
270
+ if (!element) {
271
+ return;
272
+ }
273
+ for (const classes of element.classList) {
274
+ element.classList.remove(classes);
275
+ }
276
+ element.classList.add("terminal-command-decoration" , "codicon" , "xterm-decoration" );
277
+ if (markProperties) {
278
+ element.classList.add("default-color" , ...ThemeIcon.asClassNameArray(terminalDecorationMark));
279
+ if (!markProperties.hoverMessage) {
280
+ element.classList.add("default" );
281
+ }
282
+ }
283
+ else {
284
+ this._updateCommandDecorationVisibility(element);
285
+ if (exitCode === undefined) {
286
+ element.classList.add("default-color" , "default" );
287
+ element.classList.add(...ThemeIcon.asClassNameArray(terminalDecorationIncomplete));
288
+ }
289
+ else if (exitCode) {
290
+ element.classList.add("error" );
291
+ element.classList.add(...ThemeIcon.asClassNameArray(terminalDecorationError));
292
+ }
293
+ else {
294
+ element.classList.add(...ThemeIcon.asClassNameArray(terminalDecorationSuccess));
295
+ }
296
+ }
297
+ }
298
+ _createContextMenu(element, command) {
299
+ return dom.addDisposableListener(element, dom.EventType.CLICK, async () => {
300
+ this._terminalDecorationHoverService.hideHover();
301
+ const actions = await this._getCommandActions(command);
302
+ this._contextMenuService.showContextMenu({ getAnchor: () => element, getActions: () => actions });
303
+ });
304
+ }
305
+ async _getCommandActions(command) {
306
+ const actions = [];
307
+ if (command.command !== '') {
308
+ const labelRun = ( localizeWithPath(
309
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
310
+ "terminal.rerunCommand",
311
+ 'Rerun Command'
312
+ ));
313
+ actions.push({
314
+ class: undefined, tooltip: labelRun, id: 'terminal.rerunCommand', label: labelRun, enabled: true,
315
+ run: async () => {
316
+ if (command.command === '') {
317
+ return;
318
+ }
319
+ if (!command.isTrusted) {
320
+ const shouldRun = await ( new Promise(r => {
321
+ this._notificationService.prompt(Severity.Info, ( localizeWithPath(
322
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
323
+ 'rerun',
324
+ 'Do you want to run the command: {0}',
325
+ command.command
326
+ )), [{
327
+ label: ( localizeWithPath(
328
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
329
+ 'yes',
330
+ 'Yes'
331
+ )),
332
+ run: () => r(true)
333
+ }, {
334
+ label: ( localizeWithPath('vs/workbench/contrib/terminal/browser/xterm/decorationAddon', 'no', 'No')),
335
+ run: () => r(false)
336
+ }]);
337
+ }));
338
+ if (!shouldRun) {
339
+ return;
340
+ }
341
+ }
342
+ this._onDidRequestRunCommand.fire({ command });
343
+ }
344
+ });
345
+ actions.push(( new Separator()));
346
+ const labelCopy = ( localizeWithPath(
347
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
348
+ "terminal.copyCommand",
349
+ 'Copy Command'
350
+ ));
351
+ actions.push({
352
+ class: undefined, tooltip: labelCopy, id: 'terminal.copyCommand', label: labelCopy, enabled: true,
353
+ run: () => this._clipboardService.writeText(command.command)
354
+ });
355
+ }
356
+ if (command.hasOutput()) {
357
+ const labelCopyCommandAndOutput = ( localizeWithPath(
358
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
359
+ "terminal.copyCommandAndOutput",
360
+ 'Copy Command and Output'
361
+ ));
362
+ actions.push({
363
+ class: undefined, tooltip: labelCopyCommandAndOutput, id: 'terminal.copyCommandAndOutput', label: labelCopyCommandAndOutput, enabled: true,
364
+ run: () => {
365
+ const output = command.getOutput();
366
+ if (typeof output === 'string') {
367
+ this._clipboardService.writeText(`${command.command !== '' ? command.command + '\n' : ''}${output}`);
368
+ }
369
+ }
370
+ });
371
+ const labelText = ( localizeWithPath(
372
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
373
+ "terminal.copyOutput",
374
+ 'Copy Output'
375
+ ));
376
+ actions.push({
377
+ class: undefined, tooltip: labelText, id: 'terminal.copyOutput', label: labelText, enabled: true,
378
+ run: () => {
379
+ const text = command.getOutput();
380
+ if (typeof text === 'string') {
381
+ this._clipboardService.writeText(text);
382
+ }
383
+ }
384
+ });
385
+ const labelHtml = ( localizeWithPath(
386
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
387
+ "terminal.copyOutputAsHtml",
388
+ 'Copy Output as HTML'
389
+ ));
390
+ actions.push({
391
+ class: undefined, tooltip: labelHtml, id: 'terminal.copyOutputAsHtml', label: labelHtml, enabled: true,
392
+ run: () => this._onDidRequestRunCommand.fire({ command, copyAsHtml: true })
393
+ });
394
+ }
395
+ if (actions.length > 0) {
396
+ actions.push(( new Separator()));
397
+ }
398
+ const labelRunRecent = ( localizeWithPath(
399
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
400
+ 'workbench.action.terminal.runRecentCommand',
401
+ "Run Recent Command"
402
+ ));
403
+ actions.push({
404
+ class: undefined, tooltip: labelRunRecent, id: 'workbench.action.terminal.runRecentCommand', label: labelRunRecent, enabled: true,
405
+ run: () => this._commandService.executeCommand('workbench.action.terminal.runRecentCommand')
406
+ });
407
+ const labelGoToRecent = ( localizeWithPath(
408
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
409
+ 'workbench.action.terminal.goToRecentDirectory',
410
+ "Go To Recent Directory"
411
+ ));
412
+ actions.push({
413
+ class: undefined, tooltip: labelRunRecent, id: 'workbench.action.terminal.goToRecentDirectory', label: labelGoToRecent, enabled: true,
414
+ run: () => this._commandService.executeCommand('workbench.action.terminal.goToRecentDirectory')
415
+ });
416
+ actions.push(( new Separator()));
417
+ const labelConfigure = ( localizeWithPath(
418
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
419
+ "terminal.configureCommandDecorations",
420
+ 'Configure Command Decorations'
421
+ ));
422
+ actions.push({
423
+ class: undefined, tooltip: labelConfigure, id: 'terminal.configureCommandDecorations', label: labelConfigure, enabled: true,
424
+ run: () => this._showConfigureCommandDecorationsQuickPick()
425
+ });
426
+ const labelAbout = ( localizeWithPath(
427
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
428
+ "terminal.learnShellIntegration",
429
+ 'Learn About Shell Integration'
430
+ ));
431
+ actions.push({
432
+ class: undefined, tooltip: labelAbout, id: 'terminal.learnShellIntegration', label: labelAbout, enabled: true,
433
+ run: () => this._openerService.open('https://code.visualstudio.com/docs/terminal/shell-integration')
434
+ });
435
+ return actions;
436
+ }
437
+ async _showConfigureCommandDecorationsQuickPick() {
438
+ const quickPick = this._quickInputService.createQuickPick();
439
+ quickPick.items = [
440
+ { id: 'a', label: ( localizeWithPath(
441
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
442
+ 'toggleVisibility',
443
+ 'Toggle visibility'
444
+ )) },
445
+ ];
446
+ quickPick.canSelectMany = false;
447
+ quickPick.onDidAccept(async (e) => {
448
+ quickPick.hide();
449
+ const result = quickPick.activeItems[0];
450
+ switch (result.id) {
451
+ case 'a':
452
+ this._showToggleVisibilityQuickPick();
453
+ break;
454
+ }
455
+ });
456
+ quickPick.show();
457
+ }
458
+ _showToggleVisibilityQuickPick() {
459
+ const quickPick = this._quickInputService.createQuickPick();
460
+ quickPick.hideInput = true;
461
+ quickPick.hideCheckAll = true;
462
+ quickPick.canSelectMany = true;
463
+ quickPick.title = ( localizeWithPath(
464
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
465
+ 'toggleVisibility',
466
+ 'Toggle visibility'
467
+ ));
468
+ const configValue = this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled" );
469
+ const gutterIcon = {
470
+ label: ( localizeWithPath(
471
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
472
+ 'gutter',
473
+ 'Gutter command decorations'
474
+ )),
475
+ picked: configValue !== 'never' && configValue !== 'overviewRuler'
476
+ };
477
+ const overviewRulerIcon = {
478
+ label: ( localizeWithPath(
479
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationAddon',
480
+ 'overviewRuler',
481
+ 'Overview ruler command decorations'
482
+ )),
483
+ picked: configValue !== 'never' && configValue !== 'gutter'
484
+ };
485
+ quickPick.items = [gutterIcon, overviewRulerIcon];
486
+ const selectedItems = [];
487
+ if (configValue !== 'never') {
488
+ if (configValue !== 'gutter') {
489
+ selectedItems.push(gutterIcon);
490
+ }
491
+ if (configValue !== 'overviewRuler') {
492
+ selectedItems.push(overviewRulerIcon);
493
+ }
494
+ }
495
+ quickPick.selectedItems = selectedItems;
496
+ quickPick.onDidChangeSelection(async (e) => {
497
+ let newValue = 'never';
498
+ if (e.includes(gutterIcon)) {
499
+ if (e.includes(overviewRulerIcon)) {
500
+ newValue = 'both';
501
+ }
502
+ else {
503
+ newValue = 'gutter';
504
+ }
505
+ }
506
+ else if (e.includes(overviewRulerIcon)) {
507
+ newValue = 'overviewRuler';
508
+ }
509
+ await this._configurationService.updateValue("terminal.integrated.shellIntegration.decorationsEnabled" , newValue);
510
+ });
511
+ quickPick.ok = false;
512
+ quickPick.show();
513
+ }
514
+ _getDecorationCssColor(decorationOrCommand) {
515
+ let colorId;
516
+ if (decorationOrCommand?.exitCode === undefined) {
517
+ colorId = TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR;
518
+ }
519
+ else {
520
+ colorId = decorationOrCommand.exitCode ? TERMINAL_COMMAND_DECORATION_ERROR_BACKGROUND_COLOR : TERMINAL_COMMAND_DECORATION_SUCCESS_BACKGROUND_COLOR;
521
+ }
522
+ return this._themeService.getColorTheme().getColor(colorId)?.toString();
523
+ }
524
+ };
525
+ DecorationAddon = ( __decorate([
526
+ ( __param(1, IClipboardService)),
527
+ ( __param(2, IContextMenuService)),
528
+ ( __param(3, IConfigurationService)),
529
+ ( __param(4, IThemeService)),
530
+ ( __param(5, IOpenerService)),
531
+ ( __param(6, IQuickInputService)),
532
+ ( __param(7, ILifecycleService)),
533
+ ( __param(8, ICommandService)),
534
+ ( __param(9, IInstantiationService)),
535
+ ( __param(10, IAudioCueService)),
536
+ ( __param(11, INotificationService))
537
+ ], DecorationAddon));
538
+ export { DecorationAddon };
@@ -0,0 +1,104 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { Delayer } from 'monaco-editor/esm/vs/base/common/async.js';
4
+ import { fromNow } from '../../../../../base/common/date.js';
5
+ import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
6
+ import { Disposable, combinedDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
7
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
8
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
9
+ import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
10
+ import { IHoverService } from '../../../../services/hover/browser/hover.js';
11
+ let TerminalDecorationHoverManager = class TerminalDecorationHoverManager extends Disposable {
12
+ constructor(_hoverService, configurationService, contextMenuService) {
13
+ super();
14
+ this._hoverService = _hoverService;
15
+ this._contextMenuVisible = false;
16
+ this._register(contextMenuService.onDidShowContextMenu(() => this._contextMenuVisible = true));
17
+ this._register(contextMenuService.onDidHideContextMenu(() => this._contextMenuVisible = false));
18
+ this._hoverDelayer = this._register(( new Delayer(configurationService.getValue('workbench.hover.delay'))));
19
+ }
20
+ hideHover() {
21
+ this._hoverDelayer.cancel();
22
+ this._hoverService.hideHover();
23
+ }
24
+ createHover(element, command, hoverMessage) {
25
+ return combinedDisposable(dom.addDisposableListener(element, dom.EventType.MOUSE_ENTER, () => {
26
+ if (this._contextMenuVisible) {
27
+ return;
28
+ }
29
+ this._hoverDelayer.trigger(() => {
30
+ let hoverContent = `${( localizeWithPath(
31
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationStyles',
32
+ 'terminalPromptContextMenu',
33
+ "Show Command Actions"
34
+ ))}`;
35
+ hoverContent += '\n\n---\n\n';
36
+ if (!command) {
37
+ if (hoverMessage) {
38
+ hoverContent = hoverMessage;
39
+ }
40
+ else {
41
+ return;
42
+ }
43
+ }
44
+ else if (command.markProperties || hoverMessage) {
45
+ if (command.markProperties?.hoverMessage || hoverMessage) {
46
+ hoverContent = command.markProperties?.hoverMessage || hoverMessage || '';
47
+ }
48
+ else {
49
+ return;
50
+ }
51
+ }
52
+ else if (command.exitCode) {
53
+ if (command.exitCode === -1) {
54
+ hoverContent += ( localizeWithPath(
55
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationStyles',
56
+ 'terminalPromptCommandFailed',
57
+ 'Command executed {0} and failed',
58
+ fromNow(command.timestamp, true)
59
+ ));
60
+ }
61
+ else {
62
+ hoverContent += ( localizeWithPath(
63
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationStyles',
64
+ 'terminalPromptCommandFailedWithExitCode',
65
+ 'Command executed {0} and failed (Exit Code {1})',
66
+ fromNow(command.timestamp, true),
67
+ command.exitCode
68
+ ));
69
+ }
70
+ }
71
+ else {
72
+ hoverContent += ( localizeWithPath(
73
+ 'vs/workbench/contrib/terminal/browser/xterm/decorationStyles',
74
+ 'terminalPromptCommandSuccess',
75
+ 'Command executed {0}',
76
+ fromNow(command.timestamp, true)
77
+ ));
78
+ }
79
+ this._hoverService.showHover({ content: ( new MarkdownString(hoverContent)), target: element });
80
+ });
81
+ }), dom.addDisposableListener(element, dom.EventType.MOUSE_LEAVE, () => this.hideHover()), dom.addDisposableListener(element, dom.EventType.MOUSE_OUT, () => this.hideHover()));
82
+ }
83
+ };
84
+ TerminalDecorationHoverManager = ( __decorate([
85
+ ( __param(0, IHoverService)),
86
+ ( __param(1, IConfigurationService)),
87
+ ( __param(2, IContextMenuService))
88
+ ], TerminalDecorationHoverManager));
89
+ function updateLayout(configurationService, element) {
90
+ if (!element) {
91
+ return;
92
+ }
93
+ const fontSize = configurationService.inspect("terminal.integrated.fontSize" ).value;
94
+ const defaultFontSize = configurationService.inspect("terminal.integrated.fontSize" ).defaultValue;
95
+ const lineHeight = configurationService.inspect("terminal.integrated.lineHeight" ).value;
96
+ if (typeof fontSize === 'number' && typeof defaultFontSize === 'number' && typeof lineHeight === 'number') {
97
+ const scalar = (fontSize / defaultFontSize) <= 1 ? (fontSize / defaultFontSize) : 1;
98
+ element.style.width = `${scalar * 16 }px`;
99
+ element.style.height = `${scalar * 16 * lineHeight}px`;
100
+ element.style.fontSize = `${scalar * 16 }px`;
101
+ element.style.marginLeft = `${scalar * -17 }px`;
102
+ }
103
+ }
104
+ export { TerminalDecorationHoverManager, updateLayout };