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