@codingame/monaco-vscode-xterm-addons-common 37.2.0 → 37.3.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 (29) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +1 -1
  3. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +3 -3
  4. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +58 -0
  5. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +462 -0
  6. package/vscode/src/vs/base/browser/htmlToMarkdown.d.ts +0 -1
  7. package/vscode/src/vs/base/browser/htmlToMarkdown.js +0 -144
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -59
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -482
  10. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -25
  11. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -95
  12. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -24
  13. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -355
  14. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
  15. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -81
  16. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -15
  17. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -181
  18. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -75
  19. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -622
  20. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +0 -71
  21. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +0 -800
  22. package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +0 -8
  23. package/vscode/src/vs/workbench/contrib/git/common/utils.js +0 -105
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.d.ts +0 -18
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +0 -51
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +0 -79
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +0 -652
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.d.ts +0 -64
  29. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +0 -564
@@ -1,652 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { addDisposableListener, EventType } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
- import { Separator } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
5
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
6
- import { Disposable, DisposableMap, toDisposable, DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
- import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
8
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
9
- import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
10
- import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
11
- import { IClipboardService } from '@codingame/monaco-vscode-api/vscode/vs/platform/clipboard/common/clipboardService.service';
12
- import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
13
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
14
- import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
15
- import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
16
- import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
17
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
18
- import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
19
- import { TerminalCapability, CommandInvalidationReason } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
20
- import { TerminalSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
21
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
22
- import { terminalDecorationMark } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminalIcons';
23
- import { DecorationSelector, updateLayout, getTerminalDecorationHoverContent, getTerminalCommandDecorationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles';
24
- import { TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR, TERMINAL_COMMAND_DECORATION_ERROR_BACKGROUND_COLOR, TERMINAL_COMMAND_DECORATION_SUCCESS_BACKGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
25
- import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
26
- import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
27
- import { IChatContextPickService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service';
28
- import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
29
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
30
- import { parseTerminalUri, getTerminalUri } from '../terminalUri.js';
31
- import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
32
- import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
33
- import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
34
-
35
- let DecorationAddon = class DecorationAddon extends Disposable {
36
- constructor(
37
- _resource,
38
- _capabilities,
39
- _clipboardService,
40
- _contextMenuService,
41
- _configurationService,
42
- _themeService,
43
- _openerService,
44
- _quickInputService,
45
- _commandService,
46
- _accessibilitySignalService,
47
- _notificationService,
48
- _hoverService,
49
- _contextPickService,
50
- _chatWidgetService,
51
- _instantiationService
52
- ) {
53
- super();
54
- this._resource = _resource;
55
- this._capabilities = _capabilities;
56
- this._clipboardService = _clipboardService;
57
- this._contextMenuService = _contextMenuService;
58
- this._configurationService = _configurationService;
59
- this._themeService = _themeService;
60
- this._openerService = _openerService;
61
- this._quickInputService = _quickInputService;
62
- this._commandService = _commandService;
63
- this._accessibilitySignalService = _accessibilitySignalService;
64
- this._notificationService = _notificationService;
65
- this._hoverService = _hoverService;
66
- this._contextPickService = _contextPickService;
67
- this._chatWidgetService = _chatWidgetService;
68
- this._instantiationService = _instantiationService;
69
- this._capabilityDisposables = this._register(( new DisposableMap()));
70
- this._decorations = ( new Map());
71
- this._registeredMenuItems = ( new Map());
72
- this._onDidRequestRunCommand = this._register(( new Emitter()));
73
- this.onDidRequestRunCommand = this._onDidRequestRunCommand.event;
74
- this._onDidRequestCopyAsHtml = this._register(( new Emitter()));
75
- this.onDidRequestCopyAsHtml = this._onDidRequestCopyAsHtml.event;
76
- this._register(toDisposable(() => this._dispose()));
77
- this._register(this._configurationService.onDidChangeConfiguration(e => {
78
- if (e.affectsConfiguration(TerminalSettingId.FontSize) || e.affectsConfiguration(TerminalSettingId.LineHeight)) {
79
- this.refreshLayouts();
80
- } else if (e.affectsConfiguration("workbench.colorCustomizations")) {
81
- this._refreshStyles(true);
82
- } else if (e.affectsConfiguration(TerminalSettingId.ShellIntegrationDecorationsEnabled)) {
83
- this._removeCapabilityDisposables(TerminalCapability.CommandDetection);
84
- this._updateDecorationVisibility();
85
- }
86
- }));
87
- this._register(this._themeService.onDidColorThemeChange(() => this._refreshStyles(true)));
88
- this._updateDecorationVisibility();
89
- this._register(
90
- this._capabilities.onDidAddCapability(c => this._createCapabilityDisposables(c.id))
91
- );
92
- this._register(
93
- this._capabilities.onDidRemoveCapability(c => this._removeCapabilityDisposables(c.id))
94
- );
95
- }
96
- _createCapabilityDisposables(c) {
97
- const capability = this._capabilities.get(c);
98
- if (!capability || ( this._capabilityDisposables.has(c))) {
99
- return;
100
- }
101
- const store = ( new DisposableStore());
102
- switch (capability.type) {
103
- case TerminalCapability.BufferMarkDetection:
104
- store.add(capability.onMarkAdded(mark => this.registerMarkDecoration(mark)));
105
- break;
106
- case TerminalCapability.CommandDetection:
107
- {
108
- const disposables = this._getCommandDetectionListeners(capability);
109
- for (const d of disposables) {
110
- store.add(d);
111
- }
112
- break;
113
- }
114
- }
115
- this._capabilityDisposables.set(c, store);
116
- }
117
- _removeCapabilityDisposables(c) {
118
- this._capabilityDisposables.deleteAndDispose(c);
119
- }
120
- registerMarkDecoration(mark) {
121
- if (!this._terminal || (!this._showGutterDecorations && !this._showOverviewRulerDecorations)) {
122
- return undefined;
123
- }
124
- if (mark.hidden) {
125
- return undefined;
126
- }
127
- return this.registerCommandDecoration(undefined, undefined, mark);
128
- }
129
- _updateDecorationVisibility() {
130
- const showDecorations = this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationsEnabled);
131
- this._showGutterDecorations = (showDecorations === "both" || showDecorations === "gutter");
132
- this._showOverviewRulerDecorations = (showDecorations === "both" || showDecorations === "overviewRuler");
133
- this._disposeAllDecorations();
134
- if (this._showGutterDecorations || this._showOverviewRulerDecorations) {
135
- this._attachToCommandCapability();
136
- this._updateGutterDecorationVisibility();
137
- }
138
- const currentCommand = this._capabilities.get(TerminalCapability.CommandDetection)?.executingCommandObject;
139
- if (currentCommand) {
140
- this.registerCommandDecoration(currentCommand, true);
141
- }
142
- }
143
- _disposeAllDecorations() {
144
- this._placeholderDecoration?.dispose();
145
- for (const value of ( this._decorations.values())) {
146
- value.decoration.dispose();
147
- dispose(value.disposables);
148
- }
149
- }
150
- _updateGutterDecorationVisibility() {
151
- const commandDecorationElements = this._terminal?.element?.querySelectorAll(DecorationSelector.CommandDecoration);
152
- if (commandDecorationElements) {
153
- for (const commandDecorationElement of commandDecorationElements) {
154
- this._updateCommandDecorationVisibility(commandDecorationElement);
155
- }
156
- }
157
- }
158
- _updateCommandDecorationVisibility(commandDecorationElement) {
159
- if (this._showGutterDecorations) {
160
- commandDecorationElement.classList.remove(DecorationSelector.Hide);
161
- } else {
162
- commandDecorationElement.classList.add(DecorationSelector.Hide);
163
- }
164
- }
165
- refreshLayouts() {
166
- updateLayout(this._configurationService, this._placeholderDecoration?.element);
167
- for (const decoration of this._decorations) {
168
- updateLayout(this._configurationService, decoration[1].decoration.element);
169
- }
170
- }
171
- _refreshStyles(refreshOverviewRulerColors) {
172
- if (refreshOverviewRulerColors) {
173
- for (const decoration of ( this._decorations.values())) {
174
- const color = this._getDecorationCssColor(decoration.command)?.toString() ?? "";
175
- if (decoration.decoration.options?.overviewRulerOptions) {
176
- decoration.decoration.options.overviewRulerOptions.color = color;
177
- } else if (decoration.decoration.options) {
178
- decoration.decoration.options.overviewRulerOptions = {
179
- color
180
- };
181
- }
182
- }
183
- }
184
- this._updateClasses(this._placeholderDecoration?.element);
185
- for (const decoration of ( this._decorations.values())) {
186
- this._updateClasses(
187
- decoration.decoration.element,
188
- decoration.command,
189
- decoration.markProperties
190
- );
191
- }
192
- }
193
- _dispose() {
194
- for (const disposable of ( this._capabilityDisposables.values())) {
195
- dispose(disposable);
196
- }
197
- this.clearDecorations();
198
- }
199
- _clearPlaceholder() {
200
- this._placeholderDecoration?.dispose();
201
- this._placeholderDecoration = undefined;
202
- }
203
- clearDecorations() {
204
- this._placeholderDecoration?.marker.dispose();
205
- this._clearPlaceholder();
206
- this._disposeAllDecorations();
207
- this._decorations.clear();
208
- }
209
- _attachToCommandCapability() {
210
- if (( this._capabilities.has(TerminalCapability.CommandDetection))) {
211
- const capability = this._capabilities.get(TerminalCapability.CommandDetection);
212
- const disposables = this._getCommandDetectionListeners(capability);
213
- const store = ( new DisposableStore());
214
- for (const d of disposables) {
215
- store.add(d);
216
- }
217
- this._capabilityDisposables.set(TerminalCapability.CommandDetection, store);
218
- }
219
- }
220
- _getCommandDetectionListeners(capability) {
221
- this._removeCapabilityDisposables(TerminalCapability.CommandDetection);
222
- const commandDetectionListeners = [];
223
- if (capability.executingCommandObject?.marker) {
224
- this.registerCommandDecoration(capability.executingCommandObject, true);
225
- }
226
- commandDetectionListeners.push(
227
- capability.onCommandStarted(command => this.registerCommandDecoration(command, true))
228
- );
229
- for (const command of capability.commands) {
230
- this.registerCommandDecoration(command);
231
- }
232
- commandDetectionListeners.push(capability.onCommandFinished(command => {
233
- const buffer = this._terminal?.buffer?.active;
234
- const marker = command.promptStartMarker;
235
- const shouldRegisterDecoration = (
236
- command.exitCode === undefined || (buffer && marker && buffer.baseY + buffer.cursorY >= marker.line));
237
- if (shouldRegisterDecoration) {
238
- this.registerCommandDecoration(command);
239
- }
240
- if (command.exitCode) {
241
- this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalCommandFailed);
242
- } else {
243
- this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalCommandSucceeded);
244
- }
245
- }));
246
- commandDetectionListeners.push(capability.onCommandInvalidated(commands => {
247
- for (const command of commands) {
248
- const id = command.marker?.id;
249
- if (id) {
250
- const match = this._decorations.get(id);
251
- if (match) {
252
- match.decoration.dispose();
253
- dispose(match.disposables);
254
- }
255
- }
256
- }
257
- }));
258
- commandDetectionListeners.push(capability.onCurrentCommandInvalidated(request => {
259
- if (request.reason === CommandInvalidationReason.NoProblemsReported) {
260
- const lastDecoration = Array.from(this._decorations.entries())[this._decorations.size - 1];
261
- lastDecoration?.[1].decoration.dispose();
262
- } else if (request.reason === CommandInvalidationReason.Windows) {
263
- this._clearPlaceholder();
264
- }
265
- }));
266
- return commandDetectionListeners;
267
- }
268
- activate(terminal) {
269
- this._terminal = terminal;
270
- this._attachToCommandCapability();
271
- }
272
- registerCommandDecoration(command, beforeCommandExecution, markProperties) {
273
- if (!this._terminal || (beforeCommandExecution && !command) || (!this._showGutterDecorations && !this._showOverviewRulerDecorations)) {
274
- return undefined;
275
- }
276
- const marker = command?.marker || markProperties?.marker;
277
- if (!marker) {
278
- throw ( new Error(
279
- `cannot add a decoration for a command ${JSON.stringify(command)} with no marker`
280
- ));
281
- }
282
- this._clearPlaceholder();
283
- const color = this._getDecorationCssColor(command)?.toString() ?? "";
284
- const decoration = this._terminal.registerDecoration({
285
- marker,
286
- overviewRulerOptions: this._showOverviewRulerDecorations ? (beforeCommandExecution ? {
287
- color,
288
- position: "left"
289
- } : {
290
- color,
291
- position: command?.exitCode ? "right" : "left"
292
- }) : undefined
293
- });
294
- if (!decoration) {
295
- return undefined;
296
- }
297
- if (beforeCommandExecution) {
298
- this._placeholderDecoration = decoration;
299
- }
300
- decoration.onRender(element => {
301
- if (element.classList.contains(DecorationSelector.OverviewRuler)) {
302
- return;
303
- }
304
- if (!this._decorations.get(decoration.marker.id)) {
305
- decoration.onDispose(() => {
306
- const disposableDecoration = this._decorations.get(decoration.marker.id);
307
- if (disposableDecoration) {
308
- dispose(disposableDecoration.disposables);
309
- this._decorations.delete(decoration.marker.id);
310
- }
311
- });
312
- this._decorations.set(decoration.marker.id, {
313
- decoration,
314
- disposables: this._createDisposables(element, command, markProperties),
315
- command,
316
- markProperties: command?.markProperties || markProperties
317
- });
318
- }
319
- if (!element.classList.contains(DecorationSelector.Codicon) || command?.marker?.line === 0) {
320
- updateLayout(this._configurationService, element);
321
- this._updateClasses(element, command, command?.markProperties || markProperties);
322
- }
323
- });
324
- return decoration;
325
- }
326
- registerMenuItems(command, items) {
327
- const existingItems = this._registeredMenuItems.get(command);
328
- if (existingItems) {
329
- existingItems.push(...items);
330
- } else {
331
- this._registeredMenuItems.set(command, [...items]);
332
- }
333
- return toDisposable(() => {
334
- const commandItems = this._registeredMenuItems.get(command);
335
- if (commandItems) {
336
- for (const item of ( items.values())) {
337
- const index = commandItems.indexOf(item);
338
- if (index !== -1) {
339
- commandItems.splice(index, 1);
340
- }
341
- }
342
- }
343
- });
344
- }
345
- _createDisposables(element, command, markProperties) {
346
- if (command?.exitCode === undefined && !command?.markProperties) {
347
- return [];
348
- } else if (command?.markProperties || markProperties) {
349
- return [
350
- this._createHover(element, command || markProperties, markProperties?.hoverMessage)
351
- ];
352
- }
353
- return [
354
- ...this._createContextMenu(element, command),
355
- this._createHover(element, command)
356
- ];
357
- }
358
- _createHover(element, command, hoverMessage) {
359
- return this._hoverService.setupDelayedHover(element, () => ({
360
- content: ( new MarkdownString(getTerminalDecorationHoverContent(command, hoverMessage, true)))
361
- }));
362
- }
363
- _updateClasses(element, command, markProperties) {
364
- if (!element) {
365
- return;
366
- }
367
- for (const classes of element.classList) {
368
- element.classList.remove(classes);
369
- }
370
- element.classList.add(
371
- DecorationSelector.CommandDecoration,
372
- DecorationSelector.Codicon,
373
- DecorationSelector.XtermDecoration
374
- );
375
- if (markProperties) {
376
- element.classList.add(
377
- DecorationSelector.DefaultColor,
378
- ...ThemeIcon.asClassNameArray(terminalDecorationMark)
379
- );
380
- if (!markProperties.hoverMessage) {
381
- element.classList.add(DecorationSelector.Default);
382
- }
383
- } else {
384
- const state = getTerminalCommandDecorationState(command);
385
- this._updateCommandDecorationVisibility(element);
386
- for (const className of state.classNames) {
387
- element.classList.add(className);
388
- }
389
- element.classList.add(...ThemeIcon.asClassNameArray(state.icon));
390
- }
391
- element.removeAttribute("title");
392
- element.removeAttribute("aria-label");
393
- }
394
- _createContextMenu(element, command) {
395
- return [addDisposableListener(element, EventType.MOUSE_DOWN, async e => {
396
- e.stopImmediatePropagation();
397
- }), addDisposableListener(element, EventType.CLICK, async e => {
398
- e.stopImmediatePropagation();
399
- const actions = await this._getCommandActions(command);
400
- this._contextMenuService.showContextMenu({
401
- getAnchor: () => element,
402
- getActions: () => actions
403
- });
404
- }), addDisposableListener(element, EventType.CONTEXT_MENU, async e => {
405
- e.stopImmediatePropagation();
406
- const chatActions = await this._getCommandActions(command);
407
- const actions = this._getContextMenuActions();
408
- this._contextMenuService.showContextMenu({
409
- getAnchor: () => element,
410
- getActions: () => [...actions, ...chatActions]
411
- });
412
- })];
413
- }
414
- _getContextMenuActions() {
415
- const label = ( localize(16997, "Toggle Visibility"));
416
- return [{
417
- class: undefined,
418
- tooltip: label,
419
- id: "terminal.toggleVisibility",
420
- label,
421
- enabled: true,
422
- run: async () => {
423
- this._showToggleVisibilityQuickPick();
424
- }
425
- }];
426
- }
427
- async _getCommandActions(command) {
428
- const actions = [];
429
- const registeredMenuItems = this._registeredMenuItems.get(command);
430
- if (registeredMenuItems?.length) {
431
- actions.push(...registeredMenuItems, ( new Separator()));
432
- }
433
- const attachToChatAction = this._createAttachToChatAction(command);
434
- if (attachToChatAction) {
435
- actions.push(attachToChatAction, ( new Separator()));
436
- }
437
- if (command.command !== "") {
438
- const labelRun = ( localize(16998, "Rerun Command"));
439
- actions.push({
440
- class: undefined,
441
- tooltip: labelRun,
442
- id: "terminal.rerunCommand",
443
- label: labelRun,
444
- enabled: true,
445
- run: async () => {
446
- if (command.command === "") {
447
- return;
448
- }
449
- if (!command.isTrusted) {
450
- const shouldRun = await ( new Promise(r => {
451
- this._notificationService.prompt(Severity.Info, ( localize(16999, "Do you want to run the command: {0}", command.command)), [{
452
- label: ( localize(17000, "Yes")),
453
- run: () => r(true)
454
- }, {
455
- label: ( localize(17001, "No")),
456
- run: () => r(false)
457
- }]);
458
- }));
459
- if (!shouldRun) {
460
- return;
461
- }
462
- }
463
- this._onDidRequestRunCommand.fire({
464
- command
465
- });
466
- }
467
- });
468
- actions.push(( new Separator()));
469
- const labelCopy = ( localize(17002, "Copy Command"));
470
- actions.push({
471
- class: undefined,
472
- tooltip: labelCopy,
473
- id: "terminal.copyCommand",
474
- label: labelCopy,
475
- enabled: true,
476
- run: () => this._clipboardService.writeText(command.command)
477
- });
478
- }
479
- if (command.hasOutput()) {
480
- const labelCopyCommandAndOutput = ( localize(17003, "Copy Command and Output"));
481
- actions.push({
482
- class: undefined,
483
- tooltip: labelCopyCommandAndOutput,
484
- id: "terminal.copyCommandAndOutput",
485
- label: labelCopyCommandAndOutput,
486
- enabled: true,
487
- run: () => {
488
- const output = command.getOutput();
489
- if (isString(output)) {
490
- this._clipboardService.writeText(`${command.command !== "" ? command.command + "\n" : ""}${output}`);
491
- }
492
- }
493
- });
494
- const labelText = ( localize(17004, "Copy Output"));
495
- actions.push({
496
- class: undefined,
497
- tooltip: labelText,
498
- id: "terminal.copyOutput",
499
- label: labelText,
500
- enabled: true,
501
- run: () => {
502
- const text = command.getOutput();
503
- if (isString(text)) {
504
- this._clipboardService.writeText(text);
505
- }
506
- }
507
- });
508
- const labelHtml = ( localize(17005, "Copy Output as HTML"));
509
- actions.push({
510
- class: undefined,
511
- tooltip: labelHtml,
512
- id: "terminal.copyOutputAsHtml",
513
- label: labelHtml,
514
- enabled: true,
515
- run: () => this._onDidRequestCopyAsHtml.fire({
516
- command
517
- })
518
- });
519
- }
520
- if (actions.length > 0) {
521
- actions.push(( new Separator()));
522
- }
523
- const labelRunRecent = ( localize(17006, "Run Recent Command"));
524
- actions.push({
525
- class: undefined,
526
- tooltip: labelRunRecent,
527
- id: "workbench.action.terminal.runRecentCommand",
528
- label: labelRunRecent,
529
- enabled: true,
530
- run: () => this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")
531
- });
532
- const labelGoToRecent = ( localize(17007, "Go To Recent Directory"));
533
- actions.push({
534
- class: undefined,
535
- tooltip: labelRunRecent,
536
- id: "workbench.action.terminal.goToRecentDirectory",
537
- label: labelGoToRecent,
538
- enabled: true,
539
- run: () => this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")
540
- });
541
- actions.push(( new Separator()));
542
- const labelAbout = ( localize(17008, "Learn About Shell Integration"));
543
- actions.push({
544
- class: undefined,
545
- tooltip: labelAbout,
546
- id: "terminal.learnShellIntegration",
547
- label: labelAbout,
548
- enabled: true,
549
- run: () => this._openerService.open("https://code.visualstudio.com/docs/terminal/shell-integration")
550
- });
551
- return actions;
552
- }
553
- _createAttachToChatAction(command) {
554
- const chatIsEnabled = ( this._chatWidgetService.getWidgetsByLocations(ChatAgentLocation.Chat).some(w => w.attachmentCapabilities.supportsTerminalAttachments));
555
- if (!chatIsEnabled) {
556
- return undefined;
557
- }
558
- const labelAttachToChat = ( localize(17009, "Attach To Chat"));
559
- return {
560
- class: undefined,
561
- tooltip: labelAttachToChat,
562
- id: "terminal.attachToChat",
563
- label: labelAttachToChat,
564
- enabled: true,
565
- run: async () => {
566
- let widget = this._chatWidgetService.lastFocusedWidget ?? this._chatWidgetService.getWidgetsByLocations(ChatAgentLocation.Chat)?.find(w => w.attachmentCapabilities.supportsTerminalAttachments);
567
- if (!widget) {
568
- widget = await this._chatWidgetService.revealWidget();
569
- }
570
- if (!widget) {
571
- return;
572
- }
573
- let terminalContext;
574
- if (this._resource) {
575
- const parsedUri = parseTerminalUri(this._resource);
576
- const {
577
- TerminalContext
578
- } = await import('../../../chat/browser/actions/chatContext.js');
579
- terminalContext = this._instantiationService.createInstance(
580
- TerminalContext,
581
- getTerminalUri(parsedUri.workspaceId, parsedUri.instanceId, undefined, command.id)
582
- );
583
- }
584
- if (terminalContext && widget.attachmentCapabilities.supportsTerminalAttachments) {
585
- try {
586
- const attachment = await terminalContext.asAttachment(widget);
587
- if (attachment) {
588
- widget.attachmentModel.addContext(attachment);
589
- widget.focusInput();
590
- return;
591
- }
592
- } catch (err) {}
593
- this._store.add(this._contextPickService.registerChatContextItem(terminalContext));
594
- }
595
- }
596
- };
597
- }
598
- _showToggleVisibilityQuickPick() {
599
- const quickPick = this._register(this._quickInputService.createQuickPick());
600
- quickPick.hideInput = true;
601
- quickPick.hideCheckAll = true;
602
- quickPick.canSelectMany = true;
603
- quickPick.title = ( localize(17010, "Toggle visibility"));
604
- const configValue = this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationsEnabled);
605
- const gutterIcon = {
606
- label: ( localize(17011, "Gutter command decorations")),
607
- picked: configValue !== "never" && configValue !== "overviewRuler"
608
- };
609
- const overviewRulerIcon = {
610
- label: ( localize(17012, "Overview ruler command decorations")),
611
- picked: configValue !== "never" && configValue !== "gutter"
612
- };
613
- quickPick.items = [gutterIcon, overviewRulerIcon];
614
- const selectedItems = [];
615
- if (configValue !== "never") {
616
- if (configValue !== "gutter") {
617
- selectedItems.push(gutterIcon);
618
- }
619
- if (configValue !== "overviewRuler") {
620
- selectedItems.push(overviewRulerIcon);
621
- }
622
- }
623
- quickPick.selectedItems = selectedItems;
624
- this._register(quickPick.onDidChangeSelection(async e => {
625
- let newValue = "never";
626
- if (e.includes(gutterIcon)) {
627
- if (e.includes(overviewRulerIcon)) {
628
- newValue = "both";
629
- } else {
630
- newValue = "gutter";
631
- }
632
- } else if (e.includes(overviewRulerIcon)) {
633
- newValue = "overviewRuler";
634
- }
635
- await this._configurationService.updateValue(TerminalSettingId.ShellIntegrationDecorationsEnabled, newValue);
636
- }));
637
- quickPick.ok = false;
638
- quickPick.show();
639
- }
640
- _getDecorationCssColor(command) {
641
- let colorId;
642
- if (command?.exitCode === undefined) {
643
- colorId = TERMINAL_COMMAND_DECORATION_DEFAULT_BACKGROUND_COLOR;
644
- } else {
645
- colorId = command.exitCode ? TERMINAL_COMMAND_DECORATION_ERROR_BACKGROUND_COLOR : TERMINAL_COMMAND_DECORATION_SUCCESS_BACKGROUND_COLOR;
646
- }
647
- return this._themeService.getColorTheme().getColor(colorId)?.toString();
648
- }
649
- };
650
- DecorationAddon = ( __decorate([( __param(2, IClipboardService)), ( __param(3, IContextMenuService)), ( __param(4, IConfigurationService)), ( __param(5, IThemeService)), ( __param(6, IOpenerService)), ( __param(7, IQuickInputService)), ( __param(8, ICommandService)), ( __param(9, IAccessibilitySignalService)), ( __param(10, INotificationService)), ( __param(11, IHoverService)), ( __param(12, IChatContextPickService)), ( __param(13, IChatWidgetService)), ( __param(14, IInstantiationService))], DecorationAddon));
651
-
652
- export { DecorationAddon };