@codingame/monaco-vscode-xterm-addons-common 36.2.6 → 37.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/vscode/src/vs/base/browser/htmlToMarkdown.js +24 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +158 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +8 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +30 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +42 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +22 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +254 -132
- package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/git/common/utils.js +105 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +24 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +1 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +16 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +75 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.d.ts +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.js +0 -114
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
import { equalsIgnoreCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
3
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_GITHUB_HOSTS = ["github.com", "www.github.com"];
|
|
6
|
+
function getGitHubRemoteInfo(repositoryState, supportedHosts = DEFAULT_GITHUB_HOSTS) {
|
|
7
|
+
for (const remote of getOrderedRemotes(repositoryState)) {
|
|
8
|
+
if (remote.fetchUrl) {
|
|
9
|
+
const repository = getGitHubRepositoryFromRemoteUrl(remote.fetchUrl, supportedHosts);
|
|
10
|
+
if (repository) {
|
|
11
|
+
return repository;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
function getGitHubRepositoryFromRemoteUrl(remoteUrl, supportedHosts = DEFAULT_GITHUB_HOSTS) {
|
|
18
|
+
const remote = parseRemoteUrl(remoteUrl);
|
|
19
|
+
if (!remote) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const host = equalsIgnoreCase(remote.scheme, "ssh") ? remote.host : remote.rawHost;
|
|
23
|
+
if (!( ( supportedHosts.map(normalizeHost)).some(supportedHost => equalsIgnoreCase(host, supportedHost)))) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const segments = remote.path.replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/i, "").split("/");
|
|
27
|
+
return segments.length === 2 && segments[0] && segments[1] ? {
|
|
28
|
+
owner: segments[0],
|
|
29
|
+
repo: segments[1]
|
|
30
|
+
} : undefined;
|
|
31
|
+
}
|
|
32
|
+
function normalizeHost(host) {
|
|
33
|
+
return host.trim().replace(/:\d+$/, "");
|
|
34
|
+
}
|
|
35
|
+
function getOrderedRemotes(repositoryState) {
|
|
36
|
+
if (repositoryState.remotes.length < 2) {
|
|
37
|
+
return repositoryState.remotes;
|
|
38
|
+
}
|
|
39
|
+
const remotes = ( new Map());
|
|
40
|
+
const remoteIndex = repositoryState.remotes.findIndex(r => r.name === repositoryState.HEAD?.upstream?.remote);
|
|
41
|
+
if (remoteIndex !== -1) {
|
|
42
|
+
const fetchUrl = repositoryState.remotes[remoteIndex].fetchUrl;
|
|
43
|
+
if (fetchUrl) {
|
|
44
|
+
remotes.set(
|
|
45
|
+
repositoryState.remotes[remoteIndex].name,
|
|
46
|
+
repositoryState.remotes[remoteIndex]
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const originIndex = repositoryState.remotes.findIndex(r => r.name === "origin");
|
|
51
|
+
if (originIndex !== -1) {
|
|
52
|
+
const fetchUrl = repositoryState.remotes[originIndex].fetchUrl;
|
|
53
|
+
if (fetchUrl) {
|
|
54
|
+
remotes.set(
|
|
55
|
+
repositoryState.remotes[originIndex].name,
|
|
56
|
+
repositoryState.remotes[originIndex]
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const remote of repositoryState.remotes) {
|
|
61
|
+
if (!( remotes.has(remote.name))) {
|
|
62
|
+
remotes.set(remote.name, remote);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Array.from(( remotes.values()));
|
|
66
|
+
}
|
|
67
|
+
function parseRemoteUrl(fetchUrl) {
|
|
68
|
+
fetchUrl = fetchUrl.trim();
|
|
69
|
+
try {
|
|
70
|
+
if (/^[\w\d\-]+@/i.test(fetchUrl)) {
|
|
71
|
+
const parts = fetchUrl.split(":");
|
|
72
|
+
if (parts.length !== 2) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
fetchUrl = "ssh://" + parts[0] + "/" + parts[1];
|
|
76
|
+
}
|
|
77
|
+
const repoUrl = ( URI.parse(fetchUrl));
|
|
78
|
+
const authority = repoUrl.authority;
|
|
79
|
+
const path = repoUrl.path;
|
|
80
|
+
if (!(equalsIgnoreCase(repoUrl.scheme, "ssh") || equalsIgnoreCase(repoUrl.scheme, "https") || equalsIgnoreCase(repoUrl.scheme, "http"))) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const splitAuthority = authority.split("@");
|
|
84
|
+
if (splitAuthority.length > 2) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const extractedHost = splitAuthority.at(-1);
|
|
88
|
+
if (!extractedHost) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const rawHost = extractedHost.toLowerCase().replace(/:\d+$/, "");
|
|
92
|
+
const normalizedHost =
|
|
93
|
+
rawHost.replace(/^[\w\-]+-/, "").replace(/-[\w\-]+$/, "");
|
|
94
|
+
return {
|
|
95
|
+
scheme: repoUrl.scheme,
|
|
96
|
+
host: normalizedHost,
|
|
97
|
+
rawHost,
|
|
98
|
+
path: path
|
|
99
|
+
};
|
|
100
|
+
} catch (err) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { getGitHubRemoteInfo, getGitHubRepositoryFromRemoteUrl };
|
|
@@ -12,7 +12,6 @@ import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
12
12
|
import { IMarkProperties, ITerminalCapabilityStore, ITerminalCommand } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
13
13
|
import { type IDecorationAddon } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal";
|
|
14
14
|
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
15
|
-
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
16
15
|
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
17
16
|
import { IChatContextPickService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service";
|
|
18
17
|
import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service";
|
|
@@ -50,7 +49,7 @@ export declare class DecorationAddon extends Disposable implements ITerminalAddo
|
|
|
50
49
|
readonly onDidRequestCopyAsHtml: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<{
|
|
51
50
|
command: ITerminalCommand;
|
|
52
51
|
}>;
|
|
53
|
-
constructor(_resource: URI | undefined, _capabilities: ITerminalCapabilityStore, _clipboardService: IClipboardService, _contextMenuService: IContextMenuService, _configurationService: IConfigurationService, _themeService: IThemeService, _openerService: IOpenerService, _quickInputService: IQuickInputService,
|
|
52
|
+
constructor(_resource: URI | undefined, _capabilities: ITerminalCapabilityStore, _clipboardService: IClipboardService, _contextMenuService: IContextMenuService, _configurationService: IConfigurationService, _themeService: IThemeService, _openerService: IOpenerService, _quickInputService: IQuickInputService, _commandService: ICommandService, _accessibilitySignalService: IAccessibilitySignalService, _notificationService: INotificationService, _hoverService: IHoverService, _contextPickService: IChatContextPickService, _chatWidgetService: IChatWidgetService, _instantiationService: IInstantiationService);
|
|
54
53
|
private _createCapabilityDisposables;
|
|
55
54
|
private _removeCapabilityDisposables;
|
|
56
55
|
registerMarkDecoration(mark: IMarkProperties): IDecoration | undefined;
|
|
@@ -22,7 +22,6 @@ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/t
|
|
|
22
22
|
import { terminalDecorationMark } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminalIcons';
|
|
23
23
|
import { DecorationSelector, updateLayout, getTerminalDecorationHoverContent, getTerminalCommandDecorationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles';
|
|
24
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 { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
26
25
|
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
27
26
|
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
28
27
|
import { IChatContextPickService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatContextPickService.service';
|
|
@@ -44,7 +43,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
44
43
|
_themeService,
|
|
45
44
|
_openerService,
|
|
46
45
|
_quickInputService,
|
|
47
|
-
lifecycleService,
|
|
48
46
|
_commandService,
|
|
49
47
|
_accessibilitySignalService,
|
|
50
48
|
_notificationService,
|
|
@@ -95,7 +93,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
95
93
|
this._register(
|
|
96
94
|
this._capabilities.onDidRemoveCapability(c => this._removeCapabilityDisposables(c.id))
|
|
97
95
|
);
|
|
98
|
-
this._register(lifecycleService.onWillShutdown(() => this._disposeAllDecorations()));
|
|
99
96
|
}
|
|
100
97
|
_createCapabilityDisposables(c) {
|
|
101
98
|
const capability = this._capabilities.get(c);
|
|
@@ -306,7 +303,13 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
306
303
|
return;
|
|
307
304
|
}
|
|
308
305
|
if (!this._decorations.get(decoration.marker.id)) {
|
|
309
|
-
decoration.onDispose(() =>
|
|
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
|
+
});
|
|
310
313
|
this._decorations.set(decoration.marker.id, {
|
|
311
314
|
decoration,
|
|
312
315
|
disposables: this._createDisposables(element, command, markProperties),
|
|
@@ -410,7 +413,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
410
413
|
})];
|
|
411
414
|
}
|
|
412
415
|
_getContextMenuActions() {
|
|
413
|
-
const label = ( localize(
|
|
416
|
+
const label = ( localize(16997, "Toggle Visibility"));
|
|
414
417
|
return [{
|
|
415
418
|
class: undefined,
|
|
416
419
|
tooltip: label,
|
|
@@ -433,7 +436,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
433
436
|
actions.push(attachToChatAction, ( new Separator()));
|
|
434
437
|
}
|
|
435
438
|
if (command.command !== "") {
|
|
436
|
-
const labelRun = ( localize(
|
|
439
|
+
const labelRun = ( localize(16998, "Rerun Command"));
|
|
437
440
|
actions.push({
|
|
438
441
|
class: undefined,
|
|
439
442
|
tooltip: labelRun,
|
|
@@ -446,11 +449,11 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
446
449
|
}
|
|
447
450
|
if (!command.isTrusted) {
|
|
448
451
|
const shouldRun = await ( new Promise(r => {
|
|
449
|
-
this._notificationService.prompt(Severity.Info, ( localize(
|
|
450
|
-
label: ( localize(
|
|
452
|
+
this._notificationService.prompt(Severity.Info, ( localize(16999, "Do you want to run the command: {0}", command.command)), [{
|
|
453
|
+
label: ( localize(17000, "Yes")),
|
|
451
454
|
run: () => r(true)
|
|
452
455
|
}, {
|
|
453
|
-
label: ( localize(
|
|
456
|
+
label: ( localize(17001, "No")),
|
|
454
457
|
run: () => r(false)
|
|
455
458
|
}]);
|
|
456
459
|
}));
|
|
@@ -464,7 +467,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
464
467
|
}
|
|
465
468
|
});
|
|
466
469
|
actions.push(( new Separator()));
|
|
467
|
-
const labelCopy = ( localize(
|
|
470
|
+
const labelCopy = ( localize(17002, "Copy Command"));
|
|
468
471
|
actions.push({
|
|
469
472
|
class: undefined,
|
|
470
473
|
tooltip: labelCopy,
|
|
@@ -475,7 +478,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
475
478
|
});
|
|
476
479
|
}
|
|
477
480
|
if (command.hasOutput()) {
|
|
478
|
-
const labelCopyCommandAndOutput = ( localize(
|
|
481
|
+
const labelCopyCommandAndOutput = ( localize(17003, "Copy Command and Output"));
|
|
479
482
|
actions.push({
|
|
480
483
|
class: undefined,
|
|
481
484
|
tooltip: labelCopyCommandAndOutput,
|
|
@@ -489,7 +492,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
489
492
|
}
|
|
490
493
|
}
|
|
491
494
|
});
|
|
492
|
-
const labelText = ( localize(
|
|
495
|
+
const labelText = ( localize(17004, "Copy Output"));
|
|
493
496
|
actions.push({
|
|
494
497
|
class: undefined,
|
|
495
498
|
tooltip: labelText,
|
|
@@ -503,7 +506,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
503
506
|
}
|
|
504
507
|
}
|
|
505
508
|
});
|
|
506
|
-
const labelHtml = ( localize(
|
|
509
|
+
const labelHtml = ( localize(17005, "Copy Output as HTML"));
|
|
507
510
|
actions.push({
|
|
508
511
|
class: undefined,
|
|
509
512
|
tooltip: labelHtml,
|
|
@@ -518,7 +521,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
518
521
|
if (actions.length > 0) {
|
|
519
522
|
actions.push(( new Separator()));
|
|
520
523
|
}
|
|
521
|
-
const labelRunRecent = ( localize(
|
|
524
|
+
const labelRunRecent = ( localize(17006, "Run Recent Command"));
|
|
522
525
|
actions.push({
|
|
523
526
|
class: undefined,
|
|
524
527
|
tooltip: labelRunRecent,
|
|
@@ -527,7 +530,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
527
530
|
enabled: true,
|
|
528
531
|
run: () => this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")
|
|
529
532
|
});
|
|
530
|
-
const labelGoToRecent = ( localize(
|
|
533
|
+
const labelGoToRecent = ( localize(17007, "Go To Recent Directory"));
|
|
531
534
|
actions.push({
|
|
532
535
|
class: undefined,
|
|
533
536
|
tooltip: labelRunRecent,
|
|
@@ -537,7 +540,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
537
540
|
run: () => this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")
|
|
538
541
|
});
|
|
539
542
|
actions.push(( new Separator()));
|
|
540
|
-
const labelAbout = ( localize(
|
|
543
|
+
const labelAbout = ( localize(17008, "Learn About Shell Integration"));
|
|
541
544
|
actions.push({
|
|
542
545
|
class: undefined,
|
|
543
546
|
tooltip: labelAbout,
|
|
@@ -553,7 +556,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
553
556
|
if (!chatIsEnabled) {
|
|
554
557
|
return undefined;
|
|
555
558
|
}
|
|
556
|
-
const labelAttachToChat = ( localize(
|
|
559
|
+
const labelAttachToChat = ( localize(17009, "Attach To Chat"));
|
|
557
560
|
return {
|
|
558
561
|
class: undefined,
|
|
559
562
|
tooltip: labelAttachToChat,
|
|
@@ -595,14 +598,14 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
595
598
|
quickPick.hideInput = true;
|
|
596
599
|
quickPick.hideCheckAll = true;
|
|
597
600
|
quickPick.canSelectMany = true;
|
|
598
|
-
quickPick.title = ( localize(
|
|
601
|
+
quickPick.title = ( localize(17010, "Toggle visibility"));
|
|
599
602
|
const configValue = this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationsEnabled);
|
|
600
603
|
const gutterIcon = {
|
|
601
|
-
label: ( localize(
|
|
604
|
+
label: ( localize(17011, "Gutter command decorations")),
|
|
602
605
|
picked: configValue !== "never" && configValue !== "overviewRuler"
|
|
603
606
|
};
|
|
604
607
|
const overviewRulerIcon = {
|
|
605
|
-
label: ( localize(
|
|
608
|
+
label: ( localize(17012, "Overview ruler command decorations")),
|
|
606
609
|
picked: configValue !== "never" && configValue !== "gutter"
|
|
607
610
|
};
|
|
608
611
|
quickPick.items = [gutterIcon, overviewRulerIcon];
|
|
@@ -642,6 +645,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
642
645
|
return this._themeService.getColorTheme().getColor(colorId)?.toString();
|
|
643
646
|
}
|
|
644
647
|
};
|
|
645
|
-
DecorationAddon = ( __decorate([( __param(2, IClipboardService)), ( __param(3, IContextMenuService)), ( __param(4, IConfigurationService)), ( __param(5, IThemeService)), ( __param(6, IOpenerService)), ( __param(7, IQuickInputService)), ( __param(8,
|
|
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));
|
|
646
649
|
|
|
647
650
|
export { DecorationAddon };
|
|
@@ -6,7 +6,6 @@ import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
6
6
|
import { timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
7
7
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
8
8
|
import { TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
|
|
9
|
-
import { getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
10
9
|
import { isFullTerminalCommand } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand';
|
|
11
10
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
12
11
|
import { TerminalContribSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/terminalContribExports';
|
|
@@ -52,13 +51,7 @@ let MarkNavigationAddon = class MarkNavigationAddon extends Disposable {
|
|
|
52
51
|
markers.push(...partialCommandCapability.commands);
|
|
53
52
|
}
|
|
54
53
|
if (markCapability && !skipEmptyCommands) {
|
|
55
|
-
|
|
56
|
-
const arr = [];
|
|
57
|
-
while (next) {
|
|
58
|
-
arr.push(next);
|
|
59
|
-
next = markCapability.markers().next()?.value;
|
|
60
|
-
}
|
|
61
|
-
markers = arr;
|
|
54
|
+
markers = [...markCapability.markers()];
|
|
62
55
|
}
|
|
63
56
|
return markers;
|
|
64
57
|
}
|
|
@@ -360,9 +353,6 @@ let MarkNavigationAddon = class MarkNavigationAddon extends Disposable {
|
|
|
360
353
|
} else {
|
|
361
354
|
element.classList.add("terminal-scroll-highlight");
|
|
362
355
|
}
|
|
363
|
-
if (this._terminal?.element) {
|
|
364
|
-
element.style.marginLeft = `-${getWindow(this._terminal.element).getComputedStyle(this._terminal.element).paddingLeft}`;
|
|
365
|
-
}
|
|
366
356
|
});
|
|
367
357
|
decoration.onDispose(() => {
|
|
368
358
|
this._navigationDecorations = this._navigationDecorations?.filter(d => d !== decoration);
|
|
@@ -22,6 +22,7 @@ import { IAccessibilitySignalService } from "@codingame/monaco-vscode-api/vscode
|
|
|
22
22
|
import { XtermAddonImporter } from "./xtermAddonImporter.js";
|
|
23
23
|
import type { IProgressState } from "@xterm/addon-progress";
|
|
24
24
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
25
|
+
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
25
26
|
export interface IXtermTerminalOptions {
|
|
26
27
|
/** The columns to initialize the terminal with. */
|
|
27
28
|
cols: number;
|
|
@@ -69,6 +70,7 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
69
70
|
private readonly _xtermAddonLoader;
|
|
70
71
|
private readonly _xtermColorProvider;
|
|
71
72
|
private readonly _capabilities;
|
|
73
|
+
private readonly _disableOverviewRuler;
|
|
72
74
|
private static _suggestedRendererType;
|
|
73
75
|
private _attached?;
|
|
74
76
|
private _isPhysicalMouseWheel;
|
|
@@ -85,7 +87,10 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
85
87
|
private _searchAddon?;
|
|
86
88
|
private _unicode11Addon?;
|
|
87
89
|
private _webglAddon?;
|
|
90
|
+
private readonly _webglContextLossListener;
|
|
88
91
|
private _webglAddonCustomGlyphs?;
|
|
92
|
+
private _webglAddonLoading;
|
|
93
|
+
private _webglAddonLoadId;
|
|
89
94
|
private _serializeAddon?;
|
|
90
95
|
private _imageAddon?;
|
|
91
96
|
private readonly _ligaturesAddon;
|
|
@@ -138,7 +143,7 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
138
143
|
* @param xtermCtor The xterm.js constructor, this is passed in so it can be fetched lazily
|
|
139
144
|
* outside of this class such that {@link raw} is not nullable.
|
|
140
145
|
*/
|
|
141
|
-
constructor(resource: URI | undefined, xtermCtor: typeof RawXtermTerminal, options: IXtermTerminalOptions, _onDidExecuteText: Event<void> | undefined, _configurationService: IConfigurationService, _instantiationService: IInstantiationService, _logService: ITerminalLogService, _notificationService: INotificationService, _themeService: IThemeService, _telemetryService: ITelemetryService, _terminalConfigurationService: ITerminalConfigurationService, _clipboardService: IClipboardService, contextKeyService: IContextKeyService, _accessibilitySignalService: IAccessibilitySignalService, layoutService: ILayoutService);
|
|
146
|
+
constructor(resource: URI | undefined, xtermCtor: typeof RawXtermTerminal, options: IXtermTerminalOptions, _onDidExecuteText: Event<void> | undefined, _configurationService: IConfigurationService, _instantiationService: IInstantiationService, _logService: ITerminalLogService, _notificationService: INotificationService, _themeService: IThemeService, _telemetryService: ITelemetryService, _terminalConfigurationService: ITerminalConfigurationService, _clipboardService: IClipboardService, contextKeyService: IContextKeyService, _accessibilitySignalService: IAccessibilitySignalService, lifecycleService: ILifecycleService, layoutService: ILayoutService);
|
|
142
147
|
getBufferReverseIterator(): IterableIterator<string>;
|
|
143
148
|
getContentsAsText(startMarker?: IXtermMarker, endMarker?: IXtermMarker): string;
|
|
144
149
|
getContentsAsHtml(): Promise<string>;
|
|
@@ -152,6 +157,16 @@ export declare class XtermTerminal extends Disposable implements IXtermTerminal,
|
|
|
152
157
|
write(data: string | Uint8Array, callback?: () => void): void;
|
|
153
158
|
resize(columns: number, rows: number): void;
|
|
154
159
|
updateLogLevel(): void;
|
|
160
|
+
/**
|
|
161
|
+
* The width, in pixels, of the vertical scrollbar. Narrower under the Modern
|
|
162
|
+
* UI Update experiment so it matches the modernized workbench scrollbars.
|
|
163
|
+
*/
|
|
164
|
+
get scrollbarWidth(): number;
|
|
165
|
+
/**
|
|
166
|
+
* Builds the xterm.js `scrollbar` option using {@link scrollbarWidth}. Returns
|
|
167
|
+
* `undefined` when the overview ruler is disabled (e.g. detached terminals).
|
|
168
|
+
*/
|
|
169
|
+
private _getScrollbarOptions;
|
|
155
170
|
updateConfig(): void;
|
|
156
171
|
private _updateSmoothScrolling;
|
|
157
172
|
private _shouldLoadWebgl;
|
|
@@ -44,12 +44,19 @@ import { XtermAddonImporter } from './xtermAddonImporter.js';
|
|
|
44
44
|
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
45
45
|
import { isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
46
46
|
import { clamp } from '@codingame/monaco-vscode-api/vscode/vs/base/common/numbers';
|
|
47
|
+
import { LayoutSettings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
48
|
+
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
47
49
|
|
|
48
50
|
var XtermTerminal_1;
|
|
49
51
|
var RenderConstants;
|
|
50
52
|
(function(RenderConstants) {
|
|
51
53
|
RenderConstants[RenderConstants["SmoothScrollDuration"] = 125] = "SmoothScrollDuration";
|
|
52
54
|
})(RenderConstants || (RenderConstants = {}));
|
|
55
|
+
var TerminalScrollbarWidth;
|
|
56
|
+
(function(TerminalScrollbarWidth) {
|
|
57
|
+
TerminalScrollbarWidth[TerminalScrollbarWidth["Default"] = 14] = "Default";
|
|
58
|
+
TerminalScrollbarWidth[TerminalScrollbarWidth["ModernUI"] = 10] = "ModernUI";
|
|
59
|
+
})(TerminalScrollbarWidth || (TerminalScrollbarWidth = {}));
|
|
53
60
|
var TextBlinkConstants;
|
|
54
61
|
(function(TextBlinkConstants) {
|
|
55
62
|
TextBlinkConstants[TextBlinkConstants["IntervalDuration"] = 600] = "IntervalDuration";
|
|
@@ -143,6 +150,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
143
150
|
_clipboardService,
|
|
144
151
|
contextKeyService,
|
|
145
152
|
_accessibilitySignalService,
|
|
153
|
+
lifecycleService,
|
|
146
154
|
layoutService
|
|
147
155
|
) {
|
|
148
156
|
super();
|
|
@@ -161,7 +169,9 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
161
169
|
state: 0,
|
|
162
170
|
value: 0
|
|
163
171
|
};
|
|
164
|
-
this.
|
|
172
|
+
this._webglContextLossListener = this._register(( new MutableDisposable()));
|
|
173
|
+
this._webglAddonLoading = false;
|
|
174
|
+
this._webglAddonLoadId = 0;
|
|
165
175
|
this._ligaturesAddon = this._register(( new MutableDisposable()));
|
|
166
176
|
this._attachedDisposables = this._register(( new DisposableStore()));
|
|
167
177
|
this._onDidRequestRunCommand = this._register(( new Emitter()));
|
|
@@ -187,6 +197,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
187
197
|
this._xtermAddonLoader = options.xtermAddonImporter ?? ( new XtermAddonImporter());
|
|
188
198
|
this._xtermColorProvider = options.xtermColorProvider;
|
|
189
199
|
this._capabilities = options.capabilities;
|
|
200
|
+
this._disableOverviewRuler = options.disableOverviewRuler ?? false;
|
|
190
201
|
const font = this._terminalConfigurationService.getFont(getActiveWindow(), undefined, true);
|
|
191
202
|
const config = this._terminalConfigurationService.config;
|
|
192
203
|
const editorOptions = this._configurationService.getValue("editor");
|
|
@@ -221,12 +232,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
221
232
|
scrollSensitivity: config.mouseWheelScrollSensitivity,
|
|
222
233
|
scrollOnEraseInDisplay: true,
|
|
223
234
|
wordSeparator: config.wordSeparators,
|
|
224
|
-
scrollbar:
|
|
225
|
-
width: 14,
|
|
226
|
-
overviewRuler: {
|
|
227
|
-
showTopBorder: true
|
|
228
|
-
}
|
|
229
|
-
},
|
|
235
|
+
scrollbar: this._getScrollbarOptions(),
|
|
230
236
|
ignoreBracketedPasteMode: config.ignoreBracketedPasteMode,
|
|
231
237
|
rescaleOverlappingGlyphs: config.rescaleOverlappingGlyphs,
|
|
232
238
|
vtExtensions: {
|
|
@@ -247,7 +253,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
247
253
|
if (e.affectsConfiguration(TerminalSettingId.GpuAcceleration)) {
|
|
248
254
|
XtermTerminal_1._suggestedRendererType = undefined;
|
|
249
255
|
}
|
|
250
|
-
if (e.affectsConfiguration("terminal.integrated") || e.affectsConfiguration("editor.fastScrollSensitivity") || e.affectsConfiguration("editor.mouseWheelScrollSensitivity") || e.affectsConfiguration("editor.multiCursorModifier")) {
|
|
256
|
+
if (e.affectsConfiguration("terminal.integrated") || e.affectsConfiguration("editor.fastScrollSensitivity") || e.affectsConfiguration("editor.mouseWheelScrollSensitivity") || e.affectsConfiguration("editor.multiCursorModifier") || e.affectsConfiguration(LayoutSettings.MODERN_UI)) {
|
|
251
257
|
this.updateConfig();
|
|
252
258
|
}
|
|
253
259
|
if (e.affectsConfiguration(TerminalSettingId.UnicodeVersion)) {
|
|
@@ -282,6 +288,11 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
282
288
|
this._decorationAddon.onDidRequestCopyAsHtml(e => this._onDidRequestCopyAsHtml.fire(e))
|
|
283
289
|
);
|
|
284
290
|
this.raw.loadAddon(this._decorationAddon);
|
|
291
|
+
if (!options.detached) {
|
|
292
|
+
this._register(
|
|
293
|
+
lifecycleService.onWillShutdown(() => this._decorationAddon.clearDecorations())
|
|
294
|
+
);
|
|
295
|
+
}
|
|
285
296
|
this._shellIntegrationAddon = ( new ShellIntegrationAddon(
|
|
286
297
|
options.shellIntegrationNonce ?? "",
|
|
287
298
|
options.disableShellIntegrationReporting,
|
|
@@ -523,6 +534,20 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
523
534
|
updateLogLevel() {
|
|
524
535
|
this.raw.options.logLevel = vscodeToXtermLogLevel(this._logService.getLevel());
|
|
525
536
|
}
|
|
537
|
+
get scrollbarWidth() {
|
|
538
|
+
return this._configurationService.getValue(LayoutSettings.MODERN_UI) === true ? TerminalScrollbarWidth.ModernUI : TerminalScrollbarWidth.Default;
|
|
539
|
+
}
|
|
540
|
+
_getScrollbarOptions() {
|
|
541
|
+
if (this._disableOverviewRuler) {
|
|
542
|
+
return undefined;
|
|
543
|
+
}
|
|
544
|
+
return {
|
|
545
|
+
width: this.scrollbarWidth,
|
|
546
|
+
overviewRuler: {
|
|
547
|
+
showTopBorder: true
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
526
551
|
updateConfig() {
|
|
527
552
|
const config = this._terminalConfigurationService.config;
|
|
528
553
|
this.raw.options.altClickMovesCursor = config.altClickMovesCursor;
|
|
@@ -543,6 +568,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
543
568
|
this.raw.options.macOptionClickForcesSelection = config.macOptionClickForcesSelection;
|
|
544
569
|
this.raw.options.rightClickSelectsWord = config.rightClickBehavior === "selectWord";
|
|
545
570
|
this.raw.options.wordSeparator = config.wordSeparators;
|
|
571
|
+
this.raw.options.scrollbar = this._getScrollbarOptions();
|
|
546
572
|
this.raw.options.ignoreBracketedPasteMode = config.ignoreBracketedPasteMode;
|
|
547
573
|
this.raw.options.rescaleOverlappingGlyphs = config.rescaleOverlappingGlyphs;
|
|
548
574
|
this.raw.options.allowTransparency = config.enableImages;
|
|
@@ -752,7 +778,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
752
778
|
await this._clipboardService.writeText(this.raw.getSelection());
|
|
753
779
|
}
|
|
754
780
|
} else {
|
|
755
|
-
this._notificationService.warn(( localize(
|
|
781
|
+
this._notificationService.warn(( localize(17023, "The terminal has no selection to copy")));
|
|
756
782
|
}
|
|
757
783
|
}
|
|
758
784
|
_setCursorBlink(blink) {
|
|
@@ -786,23 +812,52 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
786
812
|
}
|
|
787
813
|
}
|
|
788
814
|
async _enableWebglRenderer() {
|
|
789
|
-
if (!this.raw.element
|
|
815
|
+
if (!this.raw.element) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
const customGlyphs = this._terminalConfigurationService.config.customGlyphs;
|
|
819
|
+
if ((this._webglAddon || this._webglAddonLoading) && this._webglAddonCustomGlyphs === customGlyphs) {
|
|
790
820
|
return;
|
|
791
821
|
}
|
|
792
822
|
this._disposeOfWebglRenderer();
|
|
793
|
-
|
|
794
|
-
|
|
823
|
+
const loadId = this._webglAddonLoadId;
|
|
824
|
+
this._webglAddonLoading = true;
|
|
825
|
+
this._webglAddonCustomGlyphs = customGlyphs;
|
|
826
|
+
let Addon;
|
|
827
|
+
try {
|
|
828
|
+
Addon = await this._xtermAddonLoader.importAddon("webgl");
|
|
829
|
+
} catch (error) {
|
|
830
|
+
if (loadId === this._webglAddonLoadId) {
|
|
831
|
+
this._webglAddonLoading = false;
|
|
832
|
+
this._webglAddonCustomGlyphs = undefined;
|
|
833
|
+
}
|
|
834
|
+
throw error;
|
|
835
|
+
}
|
|
836
|
+
if (loadId !== this._webglAddonLoadId) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
this._webglAddonLoading = false;
|
|
840
|
+
if (!this.raw.element) {
|
|
841
|
+
this._webglAddonCustomGlyphs = undefined;
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
const currentCustomGlyphs = this._terminalConfigurationService.config.customGlyphs;
|
|
845
|
+
if (customGlyphs !== currentCustomGlyphs) {
|
|
846
|
+
this._webglAddonCustomGlyphs = undefined;
|
|
847
|
+
await this._enableWebglRenderer();
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
795
850
|
this._webglAddon = ( new Addon({
|
|
796
|
-
customGlyphs
|
|
851
|
+
customGlyphs,
|
|
797
852
|
preserveDrawingBuffer: this._terminalConfigurationService.config.preserveDrawingBuffer
|
|
798
853
|
}));
|
|
799
854
|
try {
|
|
800
855
|
this.raw.loadAddon(this._webglAddon);
|
|
801
856
|
this._logService.trace("Webgl was loaded");
|
|
802
|
-
this.
|
|
857
|
+
this._webglContextLossListener.value = this._webglAddon.onContextLoss(() => {
|
|
803
858
|
this._logService.info(`Webgl lost context, disposing of webgl renderer`);
|
|
804
859
|
this._disposeOfWebglRenderer();
|
|
805
|
-
})
|
|
860
|
+
});
|
|
806
861
|
this._refreshImageAddon();
|
|
807
862
|
this._onDidRequestRefreshDimensions.fire();
|
|
808
863
|
} catch (e) {
|
|
@@ -868,6 +923,10 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
868
923
|
}
|
|
869
924
|
}
|
|
870
925
|
_disposeOfWebglRenderer() {
|
|
926
|
+
this._webglAddonLoadId++;
|
|
927
|
+
this._webglAddonLoading = false;
|
|
928
|
+
this._webglAddonCustomGlyphs = undefined;
|
|
929
|
+
this._webglContextLossListener.clear();
|
|
871
930
|
if (!this._webglAddon) {
|
|
872
931
|
return;
|
|
873
932
|
}
|
|
@@ -875,7 +934,6 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
875
934
|
this._webglAddon?.dispose();
|
|
876
935
|
} catch {}
|
|
877
936
|
this._webglAddon = undefined;
|
|
878
|
-
this._webglAddonCustomGlyphs = undefined;
|
|
879
937
|
this._refreshImageAddon();
|
|
880
938
|
this._onDidRequestRefreshDimensions.fire();
|
|
881
939
|
}
|
|
@@ -983,7 +1041,7 @@ let XtermTerminal = class XtermTerminal extends Disposable {
|
|
|
983
1041
|
};
|
|
984
1042
|
XtermTerminal.__decorator = ( __decorate([debounce(100)], XtermTerminal.prototype, "_refreshLigaturesAddon", null));
|
|
985
1043
|
XtermTerminal.__decorator = ( __decorate([debounce(100)], XtermTerminal.prototype, "_refreshImageAddon", null));
|
|
986
|
-
XtermTerminal = XtermTerminal_1 = ( __decorate([( __param(4, IConfigurationService)), ( __param(5, IInstantiationService)), ( __param(6, ITerminalLogService)), ( __param(7, INotificationService)), ( __param(8, IThemeService)), ( __param(9, ITelemetryService)), ( __param(10, ITerminalConfigurationService)), ( __param(11, IClipboardService)), ( __param(12, IContextKeyService)), ( __param(13, IAccessibilitySignalService)), ( __param(14, ILayoutService))], XtermTerminal));
|
|
1044
|
+
XtermTerminal = XtermTerminal_1 = ( __decorate([( __param(4, IConfigurationService)), ( __param(5, IInstantiationService)), ( __param(6, ITerminalLogService)), ( __param(7, INotificationService)), ( __param(8, IThemeService)), ( __param(9, ITelemetryService)), ( __param(10, ITerminalConfigurationService)), ( __param(11, IClipboardService)), ( __param(12, IContextKeyService)), ( __param(13, IAccessibilitySignalService)), ( __param(14, ILifecycleService)), ( __param(15, ILayoutService))], XtermTerminal));
|
|
987
1045
|
function getXtermScaledDimensions(w, font, width, height) {
|
|
988
1046
|
if (!font.charWidth || !font.charHeight) {
|
|
989
1047
|
return null;
|