@codingame/monaco-vscode-xterm-addons-common 36.2.7 → 37.2.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 +27 -22
- 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,13 +22,11 @@ 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';
|
|
29
28
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
30
29
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
31
|
-
import { TerminalContext } from '../../../chat/browser/actions/chatContext.js';
|
|
32
30
|
import { parseTerminalUri, getTerminalUri } from '../terminalUri.js';
|
|
33
31
|
import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
34
32
|
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
@@ -44,7 +42,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
44
42
|
_themeService,
|
|
45
43
|
_openerService,
|
|
46
44
|
_quickInputService,
|
|
47
|
-
lifecycleService,
|
|
48
45
|
_commandService,
|
|
49
46
|
_accessibilitySignalService,
|
|
50
47
|
_notificationService,
|
|
@@ -95,7 +92,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
95
92
|
this._register(
|
|
96
93
|
this._capabilities.onDidRemoveCapability(c => this._removeCapabilityDisposables(c.id))
|
|
97
94
|
);
|
|
98
|
-
this._register(lifecycleService.onWillShutdown(() => this._disposeAllDecorations()));
|
|
99
95
|
}
|
|
100
96
|
_createCapabilityDisposables(c) {
|
|
101
97
|
const capability = this._capabilities.get(c);
|
|
@@ -306,7 +302,13 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
306
302
|
return;
|
|
307
303
|
}
|
|
308
304
|
if (!this._decorations.get(decoration.marker.id)) {
|
|
309
|
-
decoration.onDispose(() =>
|
|
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
|
+
});
|
|
310
312
|
this._decorations.set(decoration.marker.id, {
|
|
311
313
|
decoration,
|
|
312
314
|
disposables: this._createDisposables(element, command, markProperties),
|
|
@@ -410,7 +412,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
410
412
|
})];
|
|
411
413
|
}
|
|
412
414
|
_getContextMenuActions() {
|
|
413
|
-
const label = ( localize(
|
|
415
|
+
const label = ( localize(16997, "Toggle Visibility"));
|
|
414
416
|
return [{
|
|
415
417
|
class: undefined,
|
|
416
418
|
tooltip: label,
|
|
@@ -433,7 +435,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
433
435
|
actions.push(attachToChatAction, ( new Separator()));
|
|
434
436
|
}
|
|
435
437
|
if (command.command !== "") {
|
|
436
|
-
const labelRun = ( localize(
|
|
438
|
+
const labelRun = ( localize(16998, "Rerun Command"));
|
|
437
439
|
actions.push({
|
|
438
440
|
class: undefined,
|
|
439
441
|
tooltip: labelRun,
|
|
@@ -446,11 +448,11 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
446
448
|
}
|
|
447
449
|
if (!command.isTrusted) {
|
|
448
450
|
const shouldRun = await ( new Promise(r => {
|
|
449
|
-
this._notificationService.prompt(Severity.Info, ( localize(
|
|
450
|
-
label: ( localize(
|
|
451
|
+
this._notificationService.prompt(Severity.Info, ( localize(16999, "Do you want to run the command: {0}", command.command)), [{
|
|
452
|
+
label: ( localize(17000, "Yes")),
|
|
451
453
|
run: () => r(true)
|
|
452
454
|
}, {
|
|
453
|
-
label: ( localize(
|
|
455
|
+
label: ( localize(17001, "No")),
|
|
454
456
|
run: () => r(false)
|
|
455
457
|
}]);
|
|
456
458
|
}));
|
|
@@ -464,7 +466,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
464
466
|
}
|
|
465
467
|
});
|
|
466
468
|
actions.push(( new Separator()));
|
|
467
|
-
const labelCopy = ( localize(
|
|
469
|
+
const labelCopy = ( localize(17002, "Copy Command"));
|
|
468
470
|
actions.push({
|
|
469
471
|
class: undefined,
|
|
470
472
|
tooltip: labelCopy,
|
|
@@ -475,7 +477,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
475
477
|
});
|
|
476
478
|
}
|
|
477
479
|
if (command.hasOutput()) {
|
|
478
|
-
const labelCopyCommandAndOutput = ( localize(
|
|
480
|
+
const labelCopyCommandAndOutput = ( localize(17003, "Copy Command and Output"));
|
|
479
481
|
actions.push({
|
|
480
482
|
class: undefined,
|
|
481
483
|
tooltip: labelCopyCommandAndOutput,
|
|
@@ -489,7 +491,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
489
491
|
}
|
|
490
492
|
}
|
|
491
493
|
});
|
|
492
|
-
const labelText = ( localize(
|
|
494
|
+
const labelText = ( localize(17004, "Copy Output"));
|
|
493
495
|
actions.push({
|
|
494
496
|
class: undefined,
|
|
495
497
|
tooltip: labelText,
|
|
@@ -503,7 +505,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
507
|
});
|
|
506
|
-
const labelHtml = ( localize(
|
|
508
|
+
const labelHtml = ( localize(17005, "Copy Output as HTML"));
|
|
507
509
|
actions.push({
|
|
508
510
|
class: undefined,
|
|
509
511
|
tooltip: labelHtml,
|
|
@@ -518,7 +520,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
518
520
|
if (actions.length > 0) {
|
|
519
521
|
actions.push(( new Separator()));
|
|
520
522
|
}
|
|
521
|
-
const labelRunRecent = ( localize(
|
|
523
|
+
const labelRunRecent = ( localize(17006, "Run Recent Command"));
|
|
522
524
|
actions.push({
|
|
523
525
|
class: undefined,
|
|
524
526
|
tooltip: labelRunRecent,
|
|
@@ -527,7 +529,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
527
529
|
enabled: true,
|
|
528
530
|
run: () => this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")
|
|
529
531
|
});
|
|
530
|
-
const labelGoToRecent = ( localize(
|
|
532
|
+
const labelGoToRecent = ( localize(17007, "Go To Recent Directory"));
|
|
531
533
|
actions.push({
|
|
532
534
|
class: undefined,
|
|
533
535
|
tooltip: labelRunRecent,
|
|
@@ -537,7 +539,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
537
539
|
run: () => this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")
|
|
538
540
|
});
|
|
539
541
|
actions.push(( new Separator()));
|
|
540
|
-
const labelAbout = ( localize(
|
|
542
|
+
const labelAbout = ( localize(17008, "Learn About Shell Integration"));
|
|
541
543
|
actions.push({
|
|
542
544
|
class: undefined,
|
|
543
545
|
tooltip: labelAbout,
|
|
@@ -553,7 +555,7 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
553
555
|
if (!chatIsEnabled) {
|
|
554
556
|
return undefined;
|
|
555
557
|
}
|
|
556
|
-
const labelAttachToChat = ( localize(
|
|
558
|
+
const labelAttachToChat = ( localize(17009, "Attach To Chat"));
|
|
557
559
|
return {
|
|
558
560
|
class: undefined,
|
|
559
561
|
tooltip: labelAttachToChat,
|
|
@@ -571,6 +573,9 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
571
573
|
let terminalContext;
|
|
572
574
|
if (this._resource) {
|
|
573
575
|
const parsedUri = parseTerminalUri(this._resource);
|
|
576
|
+
const {
|
|
577
|
+
TerminalContext
|
|
578
|
+
} = await import('../../../chat/browser/actions/chatContext.js');
|
|
574
579
|
terminalContext = this._instantiationService.createInstance(
|
|
575
580
|
TerminalContext,
|
|
576
581
|
getTerminalUri(parsedUri.workspaceId, parsedUri.instanceId, undefined, command.id)
|
|
@@ -595,14 +600,14 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
595
600
|
quickPick.hideInput = true;
|
|
596
601
|
quickPick.hideCheckAll = true;
|
|
597
602
|
quickPick.canSelectMany = true;
|
|
598
|
-
quickPick.title = ( localize(
|
|
603
|
+
quickPick.title = ( localize(17010, "Toggle visibility"));
|
|
599
604
|
const configValue = this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationsEnabled);
|
|
600
605
|
const gutterIcon = {
|
|
601
|
-
label: ( localize(
|
|
606
|
+
label: ( localize(17011, "Gutter command decorations")),
|
|
602
607
|
picked: configValue !== "never" && configValue !== "overviewRuler"
|
|
603
608
|
};
|
|
604
609
|
const overviewRulerIcon = {
|
|
605
|
-
label: ( localize(
|
|
610
|
+
label: ( localize(17012, "Overview ruler command decorations")),
|
|
606
611
|
picked: configValue !== "never" && configValue !== "gutter"
|
|
607
612
|
};
|
|
608
613
|
quickPick.items = [gutterIcon, overviewRulerIcon];
|
|
@@ -642,6 +647,6 @@ let DecorationAddon = class DecorationAddon extends Disposable {
|
|
|
642
647
|
return this._themeService.getColorTheme().getColor(colorId)?.toString();
|
|
643
648
|
}
|
|
644
649
|
};
|
|
645
|
-
DecorationAddon = ( __decorate([( __param(2, IClipboardService)), ( __param(3, IContextMenuService)), ( __param(4, IConfigurationService)), ( __param(5, IThemeService)), ( __param(6, IOpenerService)), ( __param(7, IQuickInputService)), ( __param(8,
|
|
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));
|
|
646
651
|
|
|
647
652
|
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;
|