@codingame/monaco-vscode-xterm-addons-common 37.2.0 → 37.3.1
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 +2 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +462 -0
- package/vscode/src/vs/base/browser/htmlToMarkdown.d.ts +0 -1
- package/vscode/src/vs/base/browser/htmlToMarkdown.js +0 -144
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +0 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +0 -482
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +0 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +0 -355
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +0 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +0 -181
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +0 -622
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.d.ts +0 -71
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +0 -800
- package/vscode/src/vs/workbench/contrib/git/common/utils.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/git/common/utils.js +0 -105
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.d.ts +0 -18
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +0 -51
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.d.ts +0 -79
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +0 -652
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.d.ts +0 -64
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +0 -564
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IMarkTracker } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
3
|
-
import { ITerminalCapabilityStore, ITerminalCommand } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
4
|
-
import type { Terminal, IMarker, ITerminalAddon, IBufferRange } from "@xterm/xterm";
|
|
5
|
-
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
6
|
-
import { ICurrentPartialCommand } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand";
|
|
7
|
-
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
8
|
-
declare enum Boundary {
|
|
9
|
-
Top = 0,
|
|
10
|
-
Bottom = 1
|
|
11
|
-
}
|
|
12
|
-
export declare enum ScrollPosition {
|
|
13
|
-
Top = 0,
|
|
14
|
-
Middle = 1
|
|
15
|
-
}
|
|
16
|
-
export declare class MarkNavigationAddon extends Disposable implements IMarkTracker, ITerminalAddon {
|
|
17
|
-
private readonly _capabilities;
|
|
18
|
-
private readonly _configurationService;
|
|
19
|
-
private readonly _themeService;
|
|
20
|
-
private _currentMarker;
|
|
21
|
-
private _selectionStart;
|
|
22
|
-
private _isDisposable;
|
|
23
|
-
protected _terminal: Terminal | undefined;
|
|
24
|
-
private _navigationDecorations;
|
|
25
|
-
private _activeCommandGuide?;
|
|
26
|
-
private readonly _commandGuideDecorations;
|
|
27
|
-
activate(terminal: Terminal): void;
|
|
28
|
-
constructor(_capabilities: ITerminalCapabilityStore, _configurationService: IConfigurationService, _themeService: IThemeService);
|
|
29
|
-
private _getMarkers;
|
|
30
|
-
private _findCommand;
|
|
31
|
-
clear(): void;
|
|
32
|
-
private _resetNavigationDecorations;
|
|
33
|
-
private _isEmptyCommand;
|
|
34
|
-
scrollToPreviousMark(scrollPosition?: ScrollPosition, retainSelection?: boolean, skipEmptyCommands?: boolean): void;
|
|
35
|
-
scrollToNextMark(scrollPosition?: ScrollPosition, retainSelection?: boolean, skipEmptyCommands?: boolean): void;
|
|
36
|
-
private _scrollToCommand;
|
|
37
|
-
private _scrollToMarker;
|
|
38
|
-
private _createMarkerForOffset;
|
|
39
|
-
revealCommand(command: ITerminalCommand | ICurrentPartialCommand, position?: ScrollPosition): void;
|
|
40
|
-
revealRange(range: IBufferRange): void;
|
|
41
|
-
showCommandGuide(command: ITerminalCommand | undefined): void;
|
|
42
|
-
private _scrollState;
|
|
43
|
-
saveScrollState(): void;
|
|
44
|
-
restoreScrollState(): void;
|
|
45
|
-
private _highlightBufferRange;
|
|
46
|
-
registerTemporaryDecoration(marker: IMarker | number, endMarker: IMarker | number | undefined, showOutline: boolean): void;
|
|
47
|
-
scrollToLine(line: number, position: ScrollPosition): void;
|
|
48
|
-
getTargetScrollLine(line: number, position: ScrollPosition): number;
|
|
49
|
-
private _isMarkerInViewport;
|
|
50
|
-
scrollToClosestMarker(startMarkerId: string, endMarkerId?: string, highlight?: boolean | undefined): void;
|
|
51
|
-
selectToPreviousMark(): void;
|
|
52
|
-
selectToNextMark(): void;
|
|
53
|
-
selectToPreviousLine(): void;
|
|
54
|
-
selectToNextLine(): void;
|
|
55
|
-
scrollToPreviousLine(xterm: Terminal, scrollPosition?: ScrollPosition, retainSelection?: boolean): void;
|
|
56
|
-
scrollToNextLine(xterm: Terminal, scrollPosition?: ScrollPosition, retainSelection?: boolean): void;
|
|
57
|
-
private _registerMarkerOrThrow;
|
|
58
|
-
private _getOffset;
|
|
59
|
-
private _findPreviousMarker;
|
|
60
|
-
private _findNextMarker;
|
|
61
|
-
}
|
|
62
|
-
export declare function getLine(xterm: Terminal, marker: IMarker | Boundary): number;
|
|
63
|
-
export declare function selectLines(xterm: Terminal, start: IMarker | Boundary, end: IMarker | Boundary | null): void;
|
|
64
|
-
export {};
|
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
-
import { Disposable, MutableDisposable, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
6
|
-
import { timeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
7
|
-
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
8
|
-
import { TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
|
|
9
|
-
import { isFullTerminalCommand } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand';
|
|
10
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
11
|
-
import { TerminalContribSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/terminalContribExports';
|
|
12
|
-
|
|
13
|
-
var Boundary;
|
|
14
|
-
(function(Boundary) {
|
|
15
|
-
Boundary[Boundary["Top"] = 0] = "Top";
|
|
16
|
-
Boundary[Boundary["Bottom"] = 1] = "Bottom";
|
|
17
|
-
})(Boundary || (Boundary = {}));
|
|
18
|
-
var ScrollPosition;
|
|
19
|
-
(function(ScrollPosition) {
|
|
20
|
-
ScrollPosition[ScrollPosition["Top"] = 0] = "Top";
|
|
21
|
-
ScrollPosition[ScrollPosition["Middle"] = 1] = "Middle";
|
|
22
|
-
})(ScrollPosition || (ScrollPosition = {}));
|
|
23
|
-
let MarkNavigationAddon = class MarkNavigationAddon extends Disposable {
|
|
24
|
-
activate(terminal) {
|
|
25
|
-
this._terminal = terminal;
|
|
26
|
-
this._register(this._terminal.onData(() => {
|
|
27
|
-
this._currentMarker = Boundary.Bottom;
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
constructor(_capabilities, _configurationService, _themeService) {
|
|
31
|
-
super();
|
|
32
|
-
this._capabilities = _capabilities;
|
|
33
|
-
this._configurationService = _configurationService;
|
|
34
|
-
this._themeService = _themeService;
|
|
35
|
-
this._currentMarker = Boundary.Bottom;
|
|
36
|
-
this._selectionStart = null;
|
|
37
|
-
this._isDisposable = false;
|
|
38
|
-
this._commandGuideDecorations = this._register(( new MutableDisposable()));
|
|
39
|
-
}
|
|
40
|
-
_getMarkers(skipEmptyCommands) {
|
|
41
|
-
const commandCapability = this._capabilities.get(TerminalCapability.CommandDetection);
|
|
42
|
-
const partialCommandCapability = this._capabilities.get(TerminalCapability.PartialCommandDetection);
|
|
43
|
-
const markCapability = this._capabilities.get(TerminalCapability.BufferMarkDetection);
|
|
44
|
-
let markers = [];
|
|
45
|
-
if (commandCapability) {
|
|
46
|
-
markers = coalesce(( commandCapability.commands.filter(e => skipEmptyCommands ? e.exitCode !== undefined : true).map(e => e.promptStartMarker ?? e.marker)));
|
|
47
|
-
if (commandCapability.currentCommand?.promptStartMarker && commandCapability.currentCommand.commandExecutedMarker) {
|
|
48
|
-
markers.push(commandCapability.currentCommand?.promptStartMarker);
|
|
49
|
-
}
|
|
50
|
-
} else if (partialCommandCapability) {
|
|
51
|
-
markers.push(...partialCommandCapability.commands);
|
|
52
|
-
}
|
|
53
|
-
if (markCapability && !skipEmptyCommands) {
|
|
54
|
-
markers = [...markCapability.markers()];
|
|
55
|
-
}
|
|
56
|
-
return markers;
|
|
57
|
-
}
|
|
58
|
-
_findCommand(marker) {
|
|
59
|
-
const commandCapability = this._capabilities.get(TerminalCapability.CommandDetection);
|
|
60
|
-
if (commandCapability) {
|
|
61
|
-
const command = commandCapability.commands.find(
|
|
62
|
-
e => e.marker?.line === marker.line || e.promptStartMarker?.line === marker.line
|
|
63
|
-
);
|
|
64
|
-
if (command) {
|
|
65
|
-
return command;
|
|
66
|
-
}
|
|
67
|
-
if (commandCapability.currentCommand) {
|
|
68
|
-
return commandCapability.currentCommand;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
clear() {
|
|
74
|
-
this._currentMarker = Boundary.Bottom;
|
|
75
|
-
this._resetNavigationDecorations();
|
|
76
|
-
this._selectionStart = null;
|
|
77
|
-
}
|
|
78
|
-
_resetNavigationDecorations() {
|
|
79
|
-
if (this._navigationDecorations) {
|
|
80
|
-
dispose(this._navigationDecorations);
|
|
81
|
-
}
|
|
82
|
-
this._navigationDecorations = [];
|
|
83
|
-
}
|
|
84
|
-
_isEmptyCommand(marker) {
|
|
85
|
-
if (marker === Boundary.Bottom) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
if (marker === Boundary.Top) {
|
|
89
|
-
return !( this._getMarkers(true).map(e => e.line)).includes(0);
|
|
90
|
-
}
|
|
91
|
-
return !this._getMarkers(true).includes(marker);
|
|
92
|
-
}
|
|
93
|
-
scrollToPreviousMark(
|
|
94
|
-
scrollPosition = ScrollPosition.Middle,
|
|
95
|
-
retainSelection = false,
|
|
96
|
-
skipEmptyCommands = true
|
|
97
|
-
) {
|
|
98
|
-
if (!this._terminal) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (!retainSelection) {
|
|
102
|
-
this._selectionStart = null;
|
|
103
|
-
}
|
|
104
|
-
let markerIndex;
|
|
105
|
-
const currentLineY = typeof this._currentMarker === "object" ? this.getTargetScrollLine(this._currentMarker.line, scrollPosition) : Math.min(
|
|
106
|
-
getLine(this._terminal, this._currentMarker),
|
|
107
|
-
this._terminal.buffer.active.baseY
|
|
108
|
-
);
|
|
109
|
-
const viewportY = this._terminal.buffer.active.viewportY;
|
|
110
|
-
if (typeof this._currentMarker === "object" ? !this._isMarkerInViewport(this._terminal, this._currentMarker) : currentLineY !== viewportY) {
|
|
111
|
-
const markersBelowViewport = this._getMarkers(skipEmptyCommands).filter(e => e.line >= viewportY).length;
|
|
112
|
-
markerIndex = this._getMarkers(skipEmptyCommands).length - markersBelowViewport - 1;
|
|
113
|
-
} else if (this._currentMarker === Boundary.Bottom) {
|
|
114
|
-
markerIndex = this._getMarkers(skipEmptyCommands).length - 1;
|
|
115
|
-
} else if (this._currentMarker === Boundary.Top) {
|
|
116
|
-
markerIndex = -1;
|
|
117
|
-
} else if (this._isDisposable) {
|
|
118
|
-
markerIndex = this._findPreviousMarker(skipEmptyCommands);
|
|
119
|
-
this._currentMarker.dispose();
|
|
120
|
-
this._isDisposable = false;
|
|
121
|
-
} else {
|
|
122
|
-
if (skipEmptyCommands && this._isEmptyCommand(this._currentMarker)) {
|
|
123
|
-
markerIndex = this._findPreviousMarker(true);
|
|
124
|
-
} else {
|
|
125
|
-
markerIndex = this._getMarkers(skipEmptyCommands).indexOf(this._currentMarker) - 1;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (markerIndex < 0) {
|
|
129
|
-
this._currentMarker = Boundary.Top;
|
|
130
|
-
this._terminal.scrollToTop();
|
|
131
|
-
this._resetNavigationDecorations();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
this._currentMarker = this._getMarkers(skipEmptyCommands)[markerIndex];
|
|
135
|
-
this._scrollToCommand(this._currentMarker, scrollPosition);
|
|
136
|
-
}
|
|
137
|
-
scrollToNextMark(
|
|
138
|
-
scrollPosition = ScrollPosition.Middle,
|
|
139
|
-
retainSelection = false,
|
|
140
|
-
skipEmptyCommands = true
|
|
141
|
-
) {
|
|
142
|
-
if (!this._terminal) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (!retainSelection) {
|
|
146
|
-
this._selectionStart = null;
|
|
147
|
-
}
|
|
148
|
-
let markerIndex;
|
|
149
|
-
const currentLineY = typeof this._currentMarker === "object" ? this.getTargetScrollLine(this._currentMarker.line, scrollPosition) : Math.min(
|
|
150
|
-
getLine(this._terminal, this._currentMarker),
|
|
151
|
-
this._terminal.buffer.active.baseY
|
|
152
|
-
);
|
|
153
|
-
const viewportY = this._terminal.buffer.active.viewportY;
|
|
154
|
-
if (typeof this._currentMarker === "object" ? !this._isMarkerInViewport(this._terminal, this._currentMarker) : currentLineY !== viewportY) {
|
|
155
|
-
const markersAboveViewport = this._getMarkers(skipEmptyCommands).filter(e => e.line <= viewportY).length;
|
|
156
|
-
markerIndex = markersAboveViewport;
|
|
157
|
-
} else if (this._currentMarker === Boundary.Bottom) {
|
|
158
|
-
markerIndex = this._getMarkers(skipEmptyCommands).length;
|
|
159
|
-
} else if (this._currentMarker === Boundary.Top) {
|
|
160
|
-
markerIndex = 0;
|
|
161
|
-
} else if (this._isDisposable) {
|
|
162
|
-
markerIndex = this._findNextMarker(skipEmptyCommands);
|
|
163
|
-
this._currentMarker.dispose();
|
|
164
|
-
this._isDisposable = false;
|
|
165
|
-
} else {
|
|
166
|
-
if (skipEmptyCommands && this._isEmptyCommand(this._currentMarker)) {
|
|
167
|
-
markerIndex = this._findNextMarker(true);
|
|
168
|
-
} else {
|
|
169
|
-
markerIndex = this._getMarkers(skipEmptyCommands).indexOf(this._currentMarker) + 1;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (markerIndex >= this._getMarkers(skipEmptyCommands).length) {
|
|
173
|
-
this._currentMarker = Boundary.Bottom;
|
|
174
|
-
this._terminal.scrollToBottom();
|
|
175
|
-
this._resetNavigationDecorations();
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
this._currentMarker = this._getMarkers(skipEmptyCommands)[markerIndex];
|
|
179
|
-
this._scrollToCommand(this._currentMarker, scrollPosition);
|
|
180
|
-
}
|
|
181
|
-
_scrollToCommand(marker, position) {
|
|
182
|
-
const command = this._findCommand(marker);
|
|
183
|
-
if (command) {
|
|
184
|
-
this.revealCommand(command, position);
|
|
185
|
-
} else {
|
|
186
|
-
this._scrollToMarker(marker, position);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
_scrollToMarker(start, position, end, options) {
|
|
190
|
-
if (!this._terminal) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
if (!this._isMarkerInViewport(this._terminal, start) || options?.forceScroll) {
|
|
194
|
-
const line = this.getTargetScrollLine(toLineIndex(start), position);
|
|
195
|
-
this._terminal.scrollToLine(line);
|
|
196
|
-
}
|
|
197
|
-
if (!options?.hideDecoration) {
|
|
198
|
-
if (options?.bufferRange) {
|
|
199
|
-
this._highlightBufferRange(options.bufferRange);
|
|
200
|
-
} else {
|
|
201
|
-
this.registerTemporaryDecoration(start, end, true);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
_createMarkerForOffset(marker, offset) {
|
|
206
|
-
if (offset === 0 && isMarker(marker)) {
|
|
207
|
-
return marker;
|
|
208
|
-
} else {
|
|
209
|
-
const offsetMarker = this._terminal?.registerMarker(
|
|
210
|
-
-this._terminal.buffer.active.cursorY + toLineIndex(marker) - this._terminal.buffer.active.baseY + offset
|
|
211
|
-
);
|
|
212
|
-
if (offsetMarker) {
|
|
213
|
-
return offsetMarker;
|
|
214
|
-
} else {
|
|
215
|
-
throw ( new Error(`Could not register marker with offset ${toLineIndex(marker)}, ${offset}`));
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
revealCommand(command, position = ScrollPosition.Middle) {
|
|
220
|
-
const marker = isFullTerminalCommand(command) ? command.marker : command.commandStartMarker;
|
|
221
|
-
if (!this._terminal || !marker) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const line = toLineIndex(marker);
|
|
225
|
-
const promptRowCount = command.getPromptRowCount();
|
|
226
|
-
const commandRowCount = command.getCommandRowCount();
|
|
227
|
-
this._scrollToMarker(line - (promptRowCount - 1), position, line + (commandRowCount - 1));
|
|
228
|
-
}
|
|
229
|
-
revealRange(range) {
|
|
230
|
-
this._scrollToMarker(range.start.y - 1, ScrollPosition.Middle, range.end.y - 1, {
|
|
231
|
-
bufferRange: range,
|
|
232
|
-
forceScroll: !!this._configurationService.getValue(TerminalContribSettingId.StickyScrollEnabled)
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
showCommandGuide(command) {
|
|
236
|
-
if (!this._terminal) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (!command) {
|
|
240
|
-
this._commandGuideDecorations.clear();
|
|
241
|
-
this._activeCommandGuide = undefined;
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
if (this._activeCommandGuide === command) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (command.marker) {
|
|
248
|
-
this._activeCommandGuide = command;
|
|
249
|
-
const store = this._commandGuideDecorations.value = ( new DisposableStore());
|
|
250
|
-
if (!command.executedMarker || !command.endMarker) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const startLine = command.marker.line - (command.getPromptRowCount() - 1);
|
|
254
|
-
const decorationCount = toLineIndex(command.endMarker) - startLine;
|
|
255
|
-
if (decorationCount > 200) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
for (let i = 0; i < decorationCount; i++) {
|
|
259
|
-
const decoration = this._terminal.registerDecoration({
|
|
260
|
-
marker: this._createMarkerForOffset(startLine, i)
|
|
261
|
-
});
|
|
262
|
-
if (decoration) {
|
|
263
|
-
store.add(decoration);
|
|
264
|
-
let renderedElement;
|
|
265
|
-
store.add(decoration.onRender(element => {
|
|
266
|
-
if (!renderedElement) {
|
|
267
|
-
renderedElement = element;
|
|
268
|
-
element.classList.add("terminal-command-guide");
|
|
269
|
-
if (i === 0) {
|
|
270
|
-
element.classList.add("top");
|
|
271
|
-
}
|
|
272
|
-
if (i === decorationCount - 1) {
|
|
273
|
-
element.classList.add("bottom");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}));
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
saveScrollState() {
|
|
282
|
-
this._scrollState = {
|
|
283
|
-
viewportY: this._terminal?.buffer.active.viewportY ?? 0
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
restoreScrollState() {
|
|
287
|
-
if (this._scrollState && this._terminal) {
|
|
288
|
-
this._terminal.scrollToLine(this._scrollState.viewportY);
|
|
289
|
-
this._scrollState = undefined;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
_highlightBufferRange(range) {
|
|
293
|
-
if (!this._terminal) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
this._resetNavigationDecorations();
|
|
297
|
-
const startLine = range.start.y;
|
|
298
|
-
const decorationCount = range.end.y - range.start.y + 1;
|
|
299
|
-
for (let i = 0; i < decorationCount; i++) {
|
|
300
|
-
const decoration = this._terminal.registerDecoration({
|
|
301
|
-
marker: this._createMarkerForOffset(startLine - 1, i),
|
|
302
|
-
x: range.start.x - 1,
|
|
303
|
-
width: (range.end.x - 1) - (range.start.x - 1) + 1,
|
|
304
|
-
overviewRulerOptions: undefined
|
|
305
|
-
});
|
|
306
|
-
if (decoration) {
|
|
307
|
-
this._navigationDecorations?.push(decoration);
|
|
308
|
-
let renderedElement;
|
|
309
|
-
decoration.onRender(element => {
|
|
310
|
-
if (!renderedElement) {
|
|
311
|
-
renderedElement = element;
|
|
312
|
-
element.classList.add("terminal-range-highlight");
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
decoration.onDispose(() => {
|
|
316
|
-
this._navigationDecorations = this._navigationDecorations?.filter(d => d !== decoration);
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
registerTemporaryDecoration(marker, endMarker, showOutline) {
|
|
322
|
-
if (!this._terminal) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
this._resetNavigationDecorations();
|
|
326
|
-
const color = this._themeService.getColorTheme().getColor(TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR);
|
|
327
|
-
const startLine = toLineIndex(marker);
|
|
328
|
-
const decorationCount = endMarker ? toLineIndex(endMarker) - startLine + 1 : 1;
|
|
329
|
-
for (let i = 0; i < decorationCount; i++) {
|
|
330
|
-
const decoration = this._terminal.registerDecoration({
|
|
331
|
-
marker: this._createMarkerForOffset(marker, i),
|
|
332
|
-
width: this._terminal.cols,
|
|
333
|
-
overviewRulerOptions: i === 0 ? {
|
|
334
|
-
color: color?.toString() || "#a0a0a0cc"
|
|
335
|
-
} : undefined
|
|
336
|
-
});
|
|
337
|
-
if (decoration) {
|
|
338
|
-
this._navigationDecorations?.push(decoration);
|
|
339
|
-
let renderedElement;
|
|
340
|
-
decoration.onRender(element => {
|
|
341
|
-
if (!renderedElement) {
|
|
342
|
-
renderedElement = element;
|
|
343
|
-
element.classList.add("terminal-scroll-highlight");
|
|
344
|
-
if (showOutline) {
|
|
345
|
-
element.classList.add("terminal-scroll-highlight-outline");
|
|
346
|
-
}
|
|
347
|
-
if (i === 0) {
|
|
348
|
-
element.classList.add("top");
|
|
349
|
-
}
|
|
350
|
-
if (i === decorationCount - 1) {
|
|
351
|
-
element.classList.add("bottom");
|
|
352
|
-
}
|
|
353
|
-
} else {
|
|
354
|
-
element.classList.add("terminal-scroll-highlight");
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
decoration.onDispose(() => {
|
|
358
|
-
this._navigationDecorations = this._navigationDecorations?.filter(d => d !== decoration);
|
|
359
|
-
});
|
|
360
|
-
if (showOutline) {
|
|
361
|
-
timeout(350).then(() => {
|
|
362
|
-
if (renderedElement) {
|
|
363
|
-
renderedElement.classList.remove("terminal-scroll-highlight-outline");
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
scrollToLine(line, position) {
|
|
371
|
-
this._terminal?.scrollToLine(this.getTargetScrollLine(line, position));
|
|
372
|
-
}
|
|
373
|
-
getTargetScrollLine(line, position) {
|
|
374
|
-
if (this._terminal && position === ScrollPosition.Middle) {
|
|
375
|
-
return Math.max(line - Math.floor(this._terminal.rows / 4), 0);
|
|
376
|
-
}
|
|
377
|
-
return line;
|
|
378
|
-
}
|
|
379
|
-
_isMarkerInViewport(terminal, marker) {
|
|
380
|
-
const viewportY = terminal.buffer.active.viewportY;
|
|
381
|
-
const line = toLineIndex(marker);
|
|
382
|
-
return line >= viewportY && line < viewportY + terminal.rows;
|
|
383
|
-
}
|
|
384
|
-
scrollToClosestMarker(startMarkerId, endMarkerId, highlight) {
|
|
385
|
-
const detectionCapability = this._capabilities.get(TerminalCapability.BufferMarkDetection);
|
|
386
|
-
if (!detectionCapability) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
const startMarker = detectionCapability.getMark(startMarkerId);
|
|
390
|
-
if (!startMarker) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
const endMarker = endMarkerId ? detectionCapability.getMark(endMarkerId) : startMarker;
|
|
394
|
-
this._scrollToMarker(startMarker, ScrollPosition.Top, endMarker, {
|
|
395
|
-
hideDecoration: !highlight
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
selectToPreviousMark() {
|
|
399
|
-
if (!this._terminal) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (this._selectionStart === null) {
|
|
403
|
-
this._selectionStart = this._currentMarker;
|
|
404
|
-
}
|
|
405
|
-
if (( this._capabilities.has(TerminalCapability.CommandDetection))) {
|
|
406
|
-
this.scrollToPreviousMark(ScrollPosition.Middle, true, true);
|
|
407
|
-
} else {
|
|
408
|
-
this.scrollToPreviousMark(ScrollPosition.Middle, true, false);
|
|
409
|
-
}
|
|
410
|
-
selectLines(this._terminal, this._currentMarker, this._selectionStart);
|
|
411
|
-
}
|
|
412
|
-
selectToNextMark() {
|
|
413
|
-
if (!this._terminal) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
if (this._selectionStart === null) {
|
|
417
|
-
this._selectionStart = this._currentMarker;
|
|
418
|
-
}
|
|
419
|
-
if (( this._capabilities.has(TerminalCapability.CommandDetection))) {
|
|
420
|
-
this.scrollToNextMark(ScrollPosition.Middle, true, true);
|
|
421
|
-
} else {
|
|
422
|
-
this.scrollToNextMark(ScrollPosition.Middle, true, false);
|
|
423
|
-
}
|
|
424
|
-
selectLines(this._terminal, this._currentMarker, this._selectionStart);
|
|
425
|
-
}
|
|
426
|
-
selectToPreviousLine() {
|
|
427
|
-
if (!this._terminal) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
if (this._selectionStart === null) {
|
|
431
|
-
this._selectionStart = this._currentMarker;
|
|
432
|
-
}
|
|
433
|
-
this.scrollToPreviousLine(this._terminal, ScrollPosition.Middle, true);
|
|
434
|
-
selectLines(this._terminal, this._currentMarker, this._selectionStart);
|
|
435
|
-
}
|
|
436
|
-
selectToNextLine() {
|
|
437
|
-
if (!this._terminal) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
if (this._selectionStart === null) {
|
|
441
|
-
this._selectionStart = this._currentMarker;
|
|
442
|
-
}
|
|
443
|
-
this.scrollToNextLine(this._terminal, ScrollPosition.Middle, true);
|
|
444
|
-
selectLines(this._terminal, this._currentMarker, this._selectionStart);
|
|
445
|
-
}
|
|
446
|
-
scrollToPreviousLine(xterm, scrollPosition = ScrollPosition.Middle, retainSelection = false) {
|
|
447
|
-
if (!retainSelection) {
|
|
448
|
-
this._selectionStart = null;
|
|
449
|
-
}
|
|
450
|
-
if (this._currentMarker === Boundary.Top) {
|
|
451
|
-
xterm.scrollToTop();
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
if (this._currentMarker === Boundary.Bottom) {
|
|
455
|
-
this._currentMarker = this._registerMarkerOrThrow(xterm, this._getOffset(xterm) - 1);
|
|
456
|
-
} else {
|
|
457
|
-
const offset = this._getOffset(xterm);
|
|
458
|
-
if (this._isDisposable) {
|
|
459
|
-
this._currentMarker.dispose();
|
|
460
|
-
}
|
|
461
|
-
this._currentMarker = this._registerMarkerOrThrow(xterm, offset - 1);
|
|
462
|
-
}
|
|
463
|
-
this._isDisposable = true;
|
|
464
|
-
this._scrollToMarker(this._currentMarker, scrollPosition);
|
|
465
|
-
}
|
|
466
|
-
scrollToNextLine(xterm, scrollPosition = ScrollPosition.Middle, retainSelection = false) {
|
|
467
|
-
if (!retainSelection) {
|
|
468
|
-
this._selectionStart = null;
|
|
469
|
-
}
|
|
470
|
-
if (this._currentMarker === Boundary.Bottom) {
|
|
471
|
-
xterm.scrollToBottom();
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
if (this._currentMarker === Boundary.Top) {
|
|
475
|
-
this._currentMarker = this._registerMarkerOrThrow(xterm, this._getOffset(xterm) + 1);
|
|
476
|
-
} else {
|
|
477
|
-
const offset = this._getOffset(xterm);
|
|
478
|
-
if (this._isDisposable) {
|
|
479
|
-
this._currentMarker.dispose();
|
|
480
|
-
}
|
|
481
|
-
this._currentMarker = this._registerMarkerOrThrow(xterm, offset + 1);
|
|
482
|
-
}
|
|
483
|
-
this._isDisposable = true;
|
|
484
|
-
this._scrollToMarker(this._currentMarker, scrollPosition);
|
|
485
|
-
}
|
|
486
|
-
_registerMarkerOrThrow(xterm, cursorYOffset) {
|
|
487
|
-
const marker = xterm.registerMarker(cursorYOffset);
|
|
488
|
-
if (!marker) {
|
|
489
|
-
throw ( new Error(`Could not create marker for ${cursorYOffset}`));
|
|
490
|
-
}
|
|
491
|
-
return marker;
|
|
492
|
-
}
|
|
493
|
-
_getOffset(xterm) {
|
|
494
|
-
if (this._currentMarker === Boundary.Bottom) {
|
|
495
|
-
return 0;
|
|
496
|
-
} else if (this._currentMarker === Boundary.Top) {
|
|
497
|
-
return 0 - (xterm.buffer.active.baseY + xterm.buffer.active.cursorY);
|
|
498
|
-
} else {
|
|
499
|
-
let offset = getLine(xterm, this._currentMarker);
|
|
500
|
-
offset -= xterm.buffer.active.baseY + xterm.buffer.active.cursorY;
|
|
501
|
-
return offset;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
_findPreviousMarker(skipEmptyCommands = false) {
|
|
505
|
-
if (this._currentMarker === Boundary.Top) {
|
|
506
|
-
return 0;
|
|
507
|
-
} else if (this._currentMarker === Boundary.Bottom) {
|
|
508
|
-
return this._getMarkers(skipEmptyCommands).length - 1;
|
|
509
|
-
}
|
|
510
|
-
let i;
|
|
511
|
-
for (i = this._getMarkers(skipEmptyCommands).length - 1; i >= 0; i--) {
|
|
512
|
-
if (this._getMarkers(skipEmptyCommands)[i].line < this._currentMarker.line) {
|
|
513
|
-
return i;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
return -1;
|
|
517
|
-
}
|
|
518
|
-
_findNextMarker(skipEmptyCommands = false) {
|
|
519
|
-
if (this._currentMarker === Boundary.Top) {
|
|
520
|
-
return 0;
|
|
521
|
-
} else if (this._currentMarker === Boundary.Bottom) {
|
|
522
|
-
return this._getMarkers(skipEmptyCommands).length - 1;
|
|
523
|
-
}
|
|
524
|
-
let i;
|
|
525
|
-
for (i = 0; i < this._getMarkers(skipEmptyCommands).length; i++) {
|
|
526
|
-
if (this._getMarkers(skipEmptyCommands)[i].line > this._currentMarker.line) {
|
|
527
|
-
return i;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
return this._getMarkers(skipEmptyCommands).length;
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
MarkNavigationAddon = ( __decorate([( __param(1, IConfigurationService)), ( __param(2, IThemeService))], MarkNavigationAddon));
|
|
534
|
-
function getLine(xterm, marker) {
|
|
535
|
-
if (marker === Boundary.Bottom) {
|
|
536
|
-
return xterm.buffer.active.baseY + xterm.rows - 1;
|
|
537
|
-
}
|
|
538
|
-
if (marker === Boundary.Top) {
|
|
539
|
-
return 0;
|
|
540
|
-
}
|
|
541
|
-
return marker.line;
|
|
542
|
-
}
|
|
543
|
-
function selectLines(xterm, start, end) {
|
|
544
|
-
if (end === null) {
|
|
545
|
-
end = Boundary.Bottom;
|
|
546
|
-
}
|
|
547
|
-
let startLine = getLine(xterm, start);
|
|
548
|
-
let endLine = getLine(xterm, end);
|
|
549
|
-
if (startLine > endLine) {
|
|
550
|
-
const temp = startLine;
|
|
551
|
-
startLine = endLine;
|
|
552
|
-
endLine = temp;
|
|
553
|
-
}
|
|
554
|
-
endLine -= 1;
|
|
555
|
-
xterm.selectLines(startLine, endLine);
|
|
556
|
-
}
|
|
557
|
-
function isMarker(value) {
|
|
558
|
-
return typeof value !== "number";
|
|
559
|
-
}
|
|
560
|
-
function toLineIndex(line) {
|
|
561
|
-
return isMarker(line) ? line.line : line;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
export { MarkNavigationAddon, ScrollPosition, getLine, selectLines };
|