@codingame/monaco-vscode-api 1.83.15 → 1.83.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +430 -0
  2. package/contributions.js +3 -0
  3. package/localExtensionHost.js +3 -2
  4. package/missing-services.js +57 -1
  5. package/monaco-editor-treemending.patch +957 -957
  6. package/package.json +6 -6
  7. package/vscode/src/vs/base/common/prefixTree.js +130 -0
  8. package/vscode/src/vs/platform/actions/browser/floatingMenu.js +26 -2
  9. package/vscode/src/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +41 -0
  10. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +566 -0
  11. package/vscode/src/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +29 -0
  12. package/vscode/src/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +48 -0
  13. package/vscode/src/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +94 -0
  14. package/vscode/src/vs/platform/terminal/common/terminalEnvironment.js +37 -0
  15. package/vscode/src/vs/platform/terminal/common/terminalStrings.js +16 -0
  16. package/vscode/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +319 -0
  17. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +91 -1
  18. package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +423 -0
  19. package/vscode/src/vs/workbench/contrib/format/browser/formatActionsNone.js +82 -0
  20. package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +67 -0
  21. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalExtensions.js +25 -0
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +64 -0
  23. package/vscode/src/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +538 -0
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +104 -0
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +799 -0
  29. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +101 -0
  30. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +30 -0
  31. package/vscode/src/vs/workbench/contrib/testing/common/storedValue.js +36 -0
  32. package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +116 -0
  33. package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +172 -1
  34. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +384 -0
  35. package/vscode/src/vs/workbench/contrib/testing/common/testResultService.js +156 -1
  36. package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +156 -0
  37. package/vscode/src/vs/workbench/contrib/testing/common/testService.js +75 -1
  38. package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +9 -1
  39. package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +179 -0
  40. package/vscode/src/vs/workbench/contrib/testing/common/testingContinuousRunService.js +102 -0
  41. package/vscode/src/vs/workbench/contrib/testing/common/testingDecorations.js +29 -0
  42. package/vscode/src/vs/workbench/contrib/testing/common/testingPeekOpener.js +3 -0
  43. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +47 -0
  44. package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
  45. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
  46. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
  47. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +428 -0
  48. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
@@ -0,0 +1,416 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
3
+ import { Disposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
5
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
6
+ import { TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR } from '../../common/terminalColorRegistry.js';
7
+ var Boundary;
8
+ ( (function(Boundary) {
9
+ Boundary[Boundary["Top"] = 0] = "Top";
10
+ Boundary[Boundary["Bottom"] = 1] = "Bottom";
11
+ })(Boundary || (Boundary = {})));
12
+ let MarkNavigationAddon = class MarkNavigationAddon extends Disposable {
13
+ activate(terminal) {
14
+ this._terminal = terminal;
15
+ this._register(this._terminal.onData(() => {
16
+ this._currentMarker = Boundary.Bottom;
17
+ }));
18
+ }
19
+ constructor(_capabilities, _themeService) {
20
+ super();
21
+ this._capabilities = _capabilities;
22
+ this._themeService = _themeService;
23
+ this._currentMarker = Boundary.Bottom;
24
+ this._selectionStart = null;
25
+ this._isDisposable = false;
26
+ }
27
+ _getMarkers(skipEmptyCommands) {
28
+ const commandCapability = this._capabilities.get(2 );
29
+ const partialCommandCapability = this._capabilities.get(3 );
30
+ const markCapability = this._capabilities.get(4 );
31
+ let markers = [];
32
+ if (commandCapability) {
33
+ markers = coalesce(( commandCapability.commands.map(e => e.marker)));
34
+ }
35
+ else if (partialCommandCapability) {
36
+ markers.push(...partialCommandCapability.commands);
37
+ }
38
+ if (markCapability && !skipEmptyCommands) {
39
+ let next = markCapability.markers().next()?.value;
40
+ const arr = [];
41
+ while (next) {
42
+ arr.push(next);
43
+ next = markCapability.markers().next()?.value;
44
+ }
45
+ markers = arr;
46
+ }
47
+ return markers;
48
+ }
49
+ clearMarker() {
50
+ this._currentMarker = Boundary.Bottom;
51
+ this._resetNavigationDecorations();
52
+ this._selectionStart = null;
53
+ }
54
+ _resetNavigationDecorations() {
55
+ if (this._navigationDecorations) {
56
+ dispose(this._navigationDecorations);
57
+ }
58
+ this._navigationDecorations = [];
59
+ }
60
+ _isEmptyCommand(marker) {
61
+ if (marker === Boundary.Bottom) {
62
+ return true;
63
+ }
64
+ if (marker === Boundary.Top) {
65
+ return !( this._getMarkers(true).map(e => e.line)).includes(0);
66
+ }
67
+ return !this._getMarkers(true).includes(marker);
68
+ }
69
+ scrollToPreviousMark(scrollPosition = 1 , retainSelection = false, skipEmptyCommands = false) {
70
+ if (!this._terminal) {
71
+ return;
72
+ }
73
+ if (!retainSelection) {
74
+ this._selectionStart = null;
75
+ }
76
+ let markerIndex;
77
+ const currentLineY = typeof this._currentMarker === 'object'
78
+ ? this._getTargetScrollLine(this._terminal, this._currentMarker, scrollPosition)
79
+ : Math.min(getLine(this._terminal, this._currentMarker), this._terminal.buffer.active.baseY);
80
+ const viewportY = this._terminal.buffer.active.viewportY;
81
+ if (typeof this._currentMarker === 'object' ? !this._isMarkerInViewport(this._terminal, this._currentMarker) : currentLineY !== viewportY) {
82
+ const markersBelowViewport = this._getMarkers(skipEmptyCommands).filter(e => e.line >= viewportY).length;
83
+ markerIndex = this._getMarkers(skipEmptyCommands).length - markersBelowViewport - 1;
84
+ }
85
+ else if (this._currentMarker === Boundary.Bottom) {
86
+ markerIndex = this._getMarkers(skipEmptyCommands).length - 1;
87
+ }
88
+ else if (this._currentMarker === Boundary.Top) {
89
+ markerIndex = -1;
90
+ }
91
+ else if (this._isDisposable) {
92
+ markerIndex = this._findPreviousMarker(this._terminal, skipEmptyCommands);
93
+ this._currentMarker.dispose();
94
+ this._isDisposable = false;
95
+ }
96
+ else {
97
+ if (skipEmptyCommands && this._isEmptyCommand(this._currentMarker)) {
98
+ markerIndex = this._findPreviousMarker(this._terminal, true);
99
+ }
100
+ else {
101
+ markerIndex = this._getMarkers(skipEmptyCommands).indexOf(this._currentMarker) - 1;
102
+ }
103
+ }
104
+ if (markerIndex < 0) {
105
+ this._currentMarker = Boundary.Top;
106
+ this._terminal.scrollToTop();
107
+ this._resetNavigationDecorations();
108
+ return;
109
+ }
110
+ this._currentMarker = this._getMarkers(skipEmptyCommands)[markerIndex];
111
+ this._scrollToMarker(this._currentMarker, scrollPosition);
112
+ }
113
+ scrollToNextMark(scrollPosition = 1 , retainSelection = false, skipEmptyCommands = true) {
114
+ if (!this._terminal) {
115
+ return;
116
+ }
117
+ if (!retainSelection) {
118
+ this._selectionStart = null;
119
+ }
120
+ let markerIndex;
121
+ const currentLineY = typeof this._currentMarker === 'object'
122
+ ? this._getTargetScrollLine(this._terminal, this._currentMarker, scrollPosition)
123
+ : Math.min(getLine(this._terminal, this._currentMarker), this._terminal.buffer.active.baseY);
124
+ const viewportY = this._terminal.buffer.active.viewportY;
125
+ if (typeof this._currentMarker === 'object' ? !this._isMarkerInViewport(this._terminal, this._currentMarker) : currentLineY !== viewportY) {
126
+ const markersAboveViewport = this._getMarkers(skipEmptyCommands).filter(e => e.line <= viewportY).length;
127
+ markerIndex = markersAboveViewport;
128
+ }
129
+ else if (this._currentMarker === Boundary.Bottom) {
130
+ markerIndex = this._getMarkers(skipEmptyCommands).length;
131
+ }
132
+ else if (this._currentMarker === Boundary.Top) {
133
+ markerIndex = 0;
134
+ }
135
+ else if (this._isDisposable) {
136
+ markerIndex = this._findNextMarker(this._terminal, skipEmptyCommands);
137
+ this._currentMarker.dispose();
138
+ this._isDisposable = false;
139
+ }
140
+ else {
141
+ if (skipEmptyCommands && this._isEmptyCommand(this._currentMarker)) {
142
+ markerIndex = this._findNextMarker(this._terminal, true);
143
+ }
144
+ else {
145
+ markerIndex = this._getMarkers(skipEmptyCommands).indexOf(this._currentMarker) + 1;
146
+ }
147
+ }
148
+ if (markerIndex >= this._getMarkers(skipEmptyCommands).length) {
149
+ this._currentMarker = Boundary.Bottom;
150
+ this._terminal.scrollToBottom();
151
+ this._resetNavigationDecorations();
152
+ return;
153
+ }
154
+ this._currentMarker = this._getMarkers(skipEmptyCommands)[markerIndex];
155
+ this._scrollToMarker(this._currentMarker, scrollPosition);
156
+ }
157
+ _scrollToMarker(marker, position, endMarker, hideDecoration) {
158
+ if (!this._terminal) {
159
+ return;
160
+ }
161
+ if (!this._isMarkerInViewport(this._terminal, marker)) {
162
+ const line = this._getTargetScrollLine(this._terminal, marker, position);
163
+ this._terminal.scrollToLine(line);
164
+ }
165
+ if (!hideDecoration) {
166
+ this._registerTemporaryDecoration(marker, endMarker);
167
+ }
168
+ }
169
+ _createMarkerForOffset(marker, offset) {
170
+ if (offset === 0) {
171
+ return marker;
172
+ }
173
+ else {
174
+ const offsetMarker = this._terminal?.registerMarker(-this._terminal.buffer.active.cursorY + marker.line - this._terminal.buffer.active.baseY + offset);
175
+ if (offsetMarker) {
176
+ return offsetMarker;
177
+ }
178
+ else {
179
+ throw new Error(`Could not register marker with offset ${marker.line}, ${offset}`);
180
+ }
181
+ }
182
+ }
183
+ _registerTemporaryDecoration(marker, endMarker) {
184
+ if (!this._terminal) {
185
+ return;
186
+ }
187
+ this._resetNavigationDecorations();
188
+ const color = this._themeService.getColorTheme().getColor(TERMINAL_OVERVIEW_RULER_CURSOR_FOREGROUND_COLOR);
189
+ const startLine = marker.line;
190
+ const decorationCount = endMarker ? endMarker.line - startLine + 1 : 1;
191
+ for (let i = 0; i < decorationCount; i++) {
192
+ const decoration = this._terminal.registerDecoration({
193
+ marker: this._createMarkerForOffset(marker, i),
194
+ width: this._terminal.cols,
195
+ overviewRulerOptions: {
196
+ color: color?.toString() || '#a0a0a0cc'
197
+ }
198
+ });
199
+ if (decoration) {
200
+ this._navigationDecorations?.push(decoration);
201
+ let renderedElement;
202
+ decoration.onRender(element => {
203
+ if (!renderedElement) {
204
+ renderedElement = element;
205
+ if (decorationCount > 1) {
206
+ element.classList.add('terminal-scroll-highlight');
207
+ }
208
+ else {
209
+ element.classList.add('terminal-scroll-highlight', 'terminal-scroll-highlight-outline');
210
+ }
211
+ if (this._terminal?.element) {
212
+ element.style.marginLeft = `-${getComputedStyle(this._terminal.element).paddingLeft}`;
213
+ }
214
+ }
215
+ });
216
+ decoration.onDispose(() => { this._navigationDecorations = this._navigationDecorations?.filter(d => d !== decoration); });
217
+ timeout(350).then(() => {
218
+ if (renderedElement) {
219
+ renderedElement.classList.remove('terminal-scroll-highlight-outline');
220
+ }
221
+ });
222
+ }
223
+ }
224
+ }
225
+ _getTargetScrollLine(terminal, marker, position) {
226
+ if (position === 1 ) {
227
+ return Math.max(marker.line - Math.floor(terminal.rows / 4), 0);
228
+ }
229
+ return marker.line;
230
+ }
231
+ _isMarkerInViewport(terminal, marker) {
232
+ const viewportY = terminal.buffer.active.viewportY;
233
+ return marker.line >= viewportY && marker.line < viewportY + terminal.rows;
234
+ }
235
+ scrollToClosestMarker(startMarkerId, endMarkerId, highlight) {
236
+ const detectionCapability = this._capabilities.get(4 );
237
+ if (!detectionCapability) {
238
+ return;
239
+ }
240
+ const startMarker = detectionCapability.getMark(startMarkerId);
241
+ if (!startMarker) {
242
+ return;
243
+ }
244
+ const endMarker = endMarkerId ? detectionCapability.getMark(endMarkerId) : startMarker;
245
+ this._scrollToMarker(startMarker, 0 , endMarker, !highlight);
246
+ }
247
+ selectToPreviousMark() {
248
+ if (!this._terminal) {
249
+ return;
250
+ }
251
+ if (this._selectionStart === null) {
252
+ this._selectionStart = this._currentMarker;
253
+ }
254
+ if (( this._capabilities.has(2 ))) {
255
+ this.scrollToPreviousMark(1 , true, true);
256
+ }
257
+ else {
258
+ this.scrollToPreviousMark(1 , true, false);
259
+ }
260
+ selectLines(this._terminal, this._currentMarker, this._selectionStart);
261
+ }
262
+ selectToNextMark() {
263
+ if (!this._terminal) {
264
+ return;
265
+ }
266
+ if (this._selectionStart === null) {
267
+ this._selectionStart = this._currentMarker;
268
+ }
269
+ if (( this._capabilities.has(2 ))) {
270
+ this.scrollToNextMark(1 , true, true);
271
+ }
272
+ else {
273
+ this.scrollToNextMark(1 , true, false);
274
+ }
275
+ selectLines(this._terminal, this._currentMarker, this._selectionStart);
276
+ }
277
+ selectToPreviousLine() {
278
+ if (!this._terminal) {
279
+ return;
280
+ }
281
+ if (this._selectionStart === null) {
282
+ this._selectionStart = this._currentMarker;
283
+ }
284
+ this.scrollToPreviousLine(this._terminal, 1 , true);
285
+ selectLines(this._terminal, this._currentMarker, this._selectionStart);
286
+ }
287
+ selectToNextLine() {
288
+ if (!this._terminal) {
289
+ return;
290
+ }
291
+ if (this._selectionStart === null) {
292
+ this._selectionStart = this._currentMarker;
293
+ }
294
+ this.scrollToNextLine(this._terminal, 1 , true);
295
+ selectLines(this._terminal, this._currentMarker, this._selectionStart);
296
+ }
297
+ scrollToPreviousLine(xterm, scrollPosition = 1 , retainSelection = false) {
298
+ if (!retainSelection) {
299
+ this._selectionStart = null;
300
+ }
301
+ if (this._currentMarker === Boundary.Top) {
302
+ xterm.scrollToTop();
303
+ return;
304
+ }
305
+ if (this._currentMarker === Boundary.Bottom) {
306
+ this._currentMarker = this._registerMarkerOrThrow(xterm, this._getOffset(xterm) - 1);
307
+ }
308
+ else {
309
+ const offset = this._getOffset(xterm);
310
+ if (this._isDisposable) {
311
+ this._currentMarker.dispose();
312
+ }
313
+ this._currentMarker = this._registerMarkerOrThrow(xterm, offset - 1);
314
+ }
315
+ this._isDisposable = true;
316
+ this._scrollToMarker(this._currentMarker, scrollPosition);
317
+ }
318
+ scrollToNextLine(xterm, scrollPosition = 1 , retainSelection = false) {
319
+ if (!retainSelection) {
320
+ this._selectionStart = null;
321
+ }
322
+ if (this._currentMarker === Boundary.Bottom) {
323
+ xterm.scrollToBottom();
324
+ return;
325
+ }
326
+ if (this._currentMarker === Boundary.Top) {
327
+ this._currentMarker = this._registerMarkerOrThrow(xterm, this._getOffset(xterm) + 1);
328
+ }
329
+ else {
330
+ const offset = this._getOffset(xterm);
331
+ if (this._isDisposable) {
332
+ this._currentMarker.dispose();
333
+ }
334
+ this._currentMarker = this._registerMarkerOrThrow(xterm, offset + 1);
335
+ }
336
+ this._isDisposable = true;
337
+ this._scrollToMarker(this._currentMarker, scrollPosition);
338
+ }
339
+ _registerMarkerOrThrow(xterm, cursorYOffset) {
340
+ const marker = xterm.registerMarker(cursorYOffset);
341
+ if (!marker) {
342
+ throw new Error(`Could not create marker for ${cursorYOffset}`);
343
+ }
344
+ return marker;
345
+ }
346
+ _getOffset(xterm) {
347
+ if (this._currentMarker === Boundary.Bottom) {
348
+ return 0;
349
+ }
350
+ else if (this._currentMarker === Boundary.Top) {
351
+ return 0 - (xterm.buffer.active.baseY + xterm.buffer.active.cursorY);
352
+ }
353
+ else {
354
+ let offset = getLine(xterm, this._currentMarker);
355
+ offset -= xterm.buffer.active.baseY + xterm.buffer.active.cursorY;
356
+ return offset;
357
+ }
358
+ }
359
+ _findPreviousMarker(xterm, skipEmptyCommands = false) {
360
+ if (this._currentMarker === Boundary.Top) {
361
+ return 0;
362
+ }
363
+ else if (this._currentMarker === Boundary.Bottom) {
364
+ return this._getMarkers(skipEmptyCommands).length - 1;
365
+ }
366
+ let i;
367
+ for (i = this._getMarkers(skipEmptyCommands).length - 1; i >= 0; i--) {
368
+ if (this._getMarkers(skipEmptyCommands)[i].line < this._currentMarker.line) {
369
+ return i;
370
+ }
371
+ }
372
+ return -1;
373
+ }
374
+ _findNextMarker(xterm, skipEmptyCommands = false) {
375
+ if (this._currentMarker === Boundary.Top) {
376
+ return 0;
377
+ }
378
+ else if (this._currentMarker === Boundary.Bottom) {
379
+ return this._getMarkers(skipEmptyCommands).length - 1;
380
+ }
381
+ let i;
382
+ for (i = 0; i < this._getMarkers(skipEmptyCommands).length; i++) {
383
+ if (this._getMarkers(skipEmptyCommands)[i].line > this._currentMarker.line) {
384
+ return i;
385
+ }
386
+ }
387
+ return this._getMarkers(skipEmptyCommands).length;
388
+ }
389
+ };
390
+ MarkNavigationAddon = ( __decorate([
391
+ ( __param(1, IThemeService))
392
+ ], MarkNavigationAddon));
393
+ function getLine(xterm, marker) {
394
+ if (marker === Boundary.Bottom) {
395
+ return xterm.buffer.active.baseY + xterm.rows - 1;
396
+ }
397
+ if (marker === Boundary.Top) {
398
+ return 0;
399
+ }
400
+ return marker.line;
401
+ }
402
+ function selectLines(xterm, start, end) {
403
+ if (end === null) {
404
+ end = Boundary.Bottom;
405
+ }
406
+ let startLine = getLine(xterm, start);
407
+ let endLine = getLine(xterm, end);
408
+ if (startLine > endLine) {
409
+ const temp = startLine;
410
+ startLine = endLine;
411
+ endLine = temp;
412
+ }
413
+ endLine -= 1;
414
+ xterm.selectLines(startLine, endLine);
415
+ }
416
+ export { MarkNavigationAddon, getLine, selectLines };