@codingame/monaco-vscode-api 1.83.15-next.0 → 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 (53) 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 +3375 -3375
  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/scm/browser/dirtydiffDecorator.js +564 -11
  21. package/vscode/src/vs/workbench/contrib/scm/common/scm.js +9 -1
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalExtensions.js +25 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcons.js +64 -0
  25. package/vscode/src/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
  26. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +538 -0
  27. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +104 -0
  28. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
  29. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
  30. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +799 -0
  31. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +101 -0
  32. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +30 -0
  33. package/vscode/src/vs/workbench/contrib/testing/common/storedValue.js +36 -0
  34. package/vscode/src/vs/workbench/contrib/testing/common/testExplorerFilterState.js +116 -0
  35. package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +172 -1
  36. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +384 -0
  37. package/vscode/src/vs/workbench/contrib/testing/common/testResultService.js +156 -1
  38. package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +156 -0
  39. package/vscode/src/vs/workbench/contrib/testing/common/testService.js +75 -1
  40. package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +9 -1
  41. package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +179 -0
  42. package/vscode/src/vs/workbench/contrib/testing/common/testingContinuousRunService.js +102 -0
  43. package/vscode/src/vs/workbench/contrib/testing/common/testingDecorations.js +29 -0
  44. package/vscode/src/vs/workbench/contrib/testing/common/testingPeekOpener.js +3 -0
  45. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +47 -0
  46. package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +594 -2
  47. package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +307 -1
  48. package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
  49. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
  50. package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
  51. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +428 -0
  52. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
  53. package/vscode/src/vs/workbench/services/textfile/common/textfiles.js +6 -2
@@ -0,0 +1,390 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { SimpleCompletionItem } from '../../../../services/suggest/browser/simpleCompletionItem.js';
4
+ import { LineContext, SimpleCompletionModel } from '../../../../services/suggest/browser/simpleCompletionModel.js';
5
+ import { SimpleSuggestWidget } from '../../../../services/suggest/browser/simpleSuggestWidget.js';
6
+ import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
7
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
8
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
9
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
10
+ import { editorSuggestWidgetSelectedBackground } from 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestWidget.js';
11
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
12
+ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
13
+ import { activeContrastBorder } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
14
+ import { getListStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
15
+ const pwshTypeToIconMap = {
16
+ 0: Codicon.symbolText,
17
+ 1: Codicon.history,
18
+ 2: Codicon.symbolMethod,
19
+ 3: Codicon.symbolFile,
20
+ 4: Codicon.folder,
21
+ 5: Codicon.symbolProperty,
22
+ 6: Codicon.symbolMethod,
23
+ 7: Codicon.symbolVariable,
24
+ 8: Codicon.symbolValue,
25
+ 9: Codicon.symbolVariable,
26
+ 10: Codicon.symbolNamespace,
27
+ 11: Codicon.symbolInterface,
28
+ 12: Codicon.symbolKeyword,
29
+ 13: Codicon.symbolKeyword
30
+ };
31
+ let SuggestAddon = class SuggestAddon extends Disposable {
32
+ constructor(_terminalSuggestWidgetVisibleContextKey, _instantiationService) {
33
+ super();
34
+ this._terminalSuggestWidgetVisibleContextKey = _terminalSuggestWidgetVisibleContextKey;
35
+ this._instantiationService = _instantiationService;
36
+ this._enableWidget = true;
37
+ this._cursorIndexStart = 0;
38
+ this._cursorIndexDelta = 0;
39
+ this._onBell = this._register(( new Emitter()));
40
+ this.onBell = this._onBell.event;
41
+ this._onAcceptedCompletion = this._register(( new Emitter()));
42
+ this.onAcceptedCompletion = this._onAcceptedCompletion.event;
43
+ this._cachedBashAliases = ( new Set());
44
+ this._cachedBashBuiltins = ( new Set());
45
+ this._cachedBashCommands = ( new Set());
46
+ this._cachedBashKeywords = ( new Set());
47
+ }
48
+ activate(xterm) {
49
+ this._terminal = xterm;
50
+ this._register(xterm.parser.registerOscHandler(633 , data => {
51
+ return this._handleVSCodeSequence(data);
52
+ }));
53
+ this._register(xterm.onData(e => {
54
+ this._handleTerminalInput(e);
55
+ }));
56
+ }
57
+ setContainer(container) {
58
+ this._container = container;
59
+ }
60
+ _handleVSCodeSequence(data) {
61
+ if (!this._terminal) {
62
+ return false;
63
+ }
64
+ const [command, ...args] = data.split(';');
65
+ switch (command) {
66
+ case "Completions" :
67
+ this._handleCompletionsSequence(this._terminal, data, command, args);
68
+ return true;
69
+ case "CompletionsBash" :
70
+ this._handleCompletionsBashSequence(this._terminal, data, command, args);
71
+ return true;
72
+ case "CompletionsBashFirstWord" :
73
+ return this._handleCompletionsBashFirstWordSequence(this._terminal, data, command, args);
74
+ }
75
+ return false;
76
+ }
77
+ _handleCompletionsSequence(terminal, data, command, args) {
78
+ if (!terminal.element || !this._enableWidget) {
79
+ return;
80
+ }
81
+ const replacementIndex = parseInt(args[0]);
82
+ const replacementLength = parseInt(args[1]);
83
+ this._cursorIndexStart = parseInt(args[2]);
84
+ if (!args[3]) {
85
+ this._onBell.fire();
86
+ return;
87
+ }
88
+ let completionList = JSON.parse(data.slice(command.length + args[0].length + args[1].length + args[2].length + 4 ));
89
+ if (!Array.isArray(completionList)) {
90
+ completionList = [completionList];
91
+ }
92
+ const completions = ( completionList.map((e) => {
93
+ return ( new SimpleCompletionItem({
94
+ label: e.CompletionText,
95
+ icon: pwshTypeToIconMap[e.ResultType],
96
+ detail: e.ToolTip
97
+ }));
98
+ }));
99
+ this._leadingLineContent = completions[0].completion.label.slice(0, replacementLength);
100
+ this._cursorIndexDelta = 0;
101
+ const model = ( new SimpleCompletionModel(completions, ( new LineContext(this._leadingLineContent, replacementIndex)), replacementIndex, replacementLength));
102
+ if (completions.length === 1) {
103
+ const insertText = completions[0].completion.label.substring(replacementLength);
104
+ if (insertText.length === 0) {
105
+ this._onBell.fire();
106
+ return;
107
+ }
108
+ }
109
+ this._handleCompletionModel(model);
110
+ }
111
+ _handleCompletionsBashFirstWordSequence(terminal, data, command, args) {
112
+ const type = args[0];
113
+ const completionList = data.slice(command.length + type.length + 2 ).split(';');
114
+ let set;
115
+ switch (type) {
116
+ case 'alias':
117
+ set = this._cachedBashAliases;
118
+ break;
119
+ case 'builtin':
120
+ set = this._cachedBashBuiltins;
121
+ break;
122
+ case 'command':
123
+ set = this._cachedBashCommands;
124
+ break;
125
+ case 'keyword':
126
+ set = this._cachedBashKeywords;
127
+ break;
128
+ default: return false;
129
+ }
130
+ set.clear();
131
+ const distinctLabels = ( new Set());
132
+ for (const label of completionList) {
133
+ distinctLabels.add(label);
134
+ }
135
+ for (const label of distinctLabels) {
136
+ set.add(( new SimpleCompletionItem({
137
+ label,
138
+ icon: Codicon.symbolString,
139
+ detail: type
140
+ })));
141
+ }
142
+ this._cachedFirstWord = undefined;
143
+ return true;
144
+ }
145
+ _handleCompletionsBashSequence(terminal, data, command, args) {
146
+ if (!terminal.element) {
147
+ return;
148
+ }
149
+ let replacementIndex = parseInt(args[0]);
150
+ const replacementLength = parseInt(args[1]);
151
+ if (!args[2]) {
152
+ this._onBell.fire();
153
+ return;
154
+ }
155
+ const completionList = data.slice(command.length + args[0].length + args[1].length + args[2].length + 4 ).split(';');
156
+ let completions;
157
+ if (replacementIndex !== 100 && completionList.length > 0) {
158
+ completions = ( completionList.map(label => {
159
+ return ( new SimpleCompletionItem({
160
+ label: label,
161
+ icon: Codicon.symbolProperty
162
+ }));
163
+ }));
164
+ }
165
+ else {
166
+ replacementIndex = 0;
167
+ if (!this._cachedFirstWord) {
168
+ this._cachedFirstWord = [
169
+ ...this._cachedBashAliases,
170
+ ...this._cachedBashBuiltins,
171
+ ...this._cachedBashCommands,
172
+ ...this._cachedBashKeywords
173
+ ];
174
+ this._cachedFirstWord.sort((a, b) => {
175
+ const aCode = a.completion.label.charCodeAt(0);
176
+ const bCode = b.completion.label.charCodeAt(0);
177
+ const isANonAlpha = aCode < 65 || aCode > 90 && aCode < 97 || aCode > 122 ? 1 : 0;
178
+ const isBNonAlpha = bCode < 65 || bCode > 90 && bCode < 97 || bCode > 122 ? 1 : 0;
179
+ if (isANonAlpha !== isBNonAlpha) {
180
+ return isANonAlpha - isBNonAlpha;
181
+ }
182
+ return a.completion.label.localeCompare(b.completion.label);
183
+ });
184
+ }
185
+ completions = this._cachedFirstWord;
186
+ }
187
+ if (completions.length === 0) {
188
+ return;
189
+ }
190
+ this._leadingLineContent = completions[0].completion.label.slice(0, replacementLength);
191
+ const model = ( new SimpleCompletionModel(completions, ( new LineContext(this._leadingLineContent, replacementIndex)), replacementIndex, replacementLength));
192
+ if (completions.length === 1) {
193
+ const insertText = completions[0].completion.label.substring(replacementLength);
194
+ if (insertText.length === 0) {
195
+ this._onBell.fire();
196
+ return;
197
+ }
198
+ }
199
+ this._handleCompletionModel(model);
200
+ }
201
+ _handleCompletionModel(model) {
202
+ if (model.items.length === 0 || !this._terminal?.element) {
203
+ return;
204
+ }
205
+ if (model.items.length === 1) {
206
+ this.acceptSelectedSuggestion({
207
+ item: model.items[0],
208
+ model: model
209
+ });
210
+ return;
211
+ }
212
+ const suggestWidget = this._ensureSuggestWidget(this._terminal);
213
+ this._additionalInput = undefined;
214
+ const dimensions = {
215
+ width: this._terminal._core._renderService.dimensions.device.cell.width,
216
+ height: this._terminal._core._renderService.dimensions.device.cell.height,
217
+ };
218
+ if (!dimensions.width || !dimensions.height) {
219
+ return;
220
+ }
221
+ const xtermBox = this._terminal.element.getBoundingClientRect();
222
+ const panelElement = dom.findParentWithClass(this._container, 'panel').offsetParent;
223
+ const panelBox = panelElement.getBoundingClientRect();
224
+ suggestWidget.showSuggestions(model, 0, false, false, {
225
+ left: (xtermBox.left - panelBox.left) + this._terminal.buffer.active.cursorX * dimensions.width,
226
+ top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
227
+ height: dimensions.height
228
+ });
229
+ if (this._inputQueue) {
230
+ const inputQueue = this._inputQueue;
231
+ this._inputQueue = undefined;
232
+ for (const data of inputQueue) {
233
+ this._handleTerminalInput(data);
234
+ }
235
+ }
236
+ }
237
+ _ensureSuggestWidget(terminal) {
238
+ this._terminalSuggestWidgetVisibleContextKey.set(true);
239
+ if (!this._suggestWidget) {
240
+ this._suggestWidget = this._register(this._instantiationService.createInstance(SimpleSuggestWidget, dom.findParentWithClass(this._container, 'panel'), this._instantiationService.createInstance(PersistedWidgetSize), {}));
241
+ this._suggestWidget.list.style(getListStyles({
242
+ listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
243
+ listInactiveFocusOutline: activeContrastBorder
244
+ }));
245
+ this._suggestWidget.onDidSelect(async (e) => this.acceptSelectedSuggestion(e));
246
+ this._suggestWidget.onDidHide(() => this._terminalSuggestWidgetVisibleContextKey.set(false));
247
+ this._suggestWidget.onDidShow(() => this._terminalSuggestWidgetVisibleContextKey.set(true));
248
+ }
249
+ return this._suggestWidget;
250
+ }
251
+ selectPreviousSuggestion() {
252
+ this._suggestWidget?.selectPrevious();
253
+ }
254
+ selectPreviousPageSuggestion() {
255
+ this._suggestWidget?.selectPreviousPage();
256
+ }
257
+ selectNextSuggestion() {
258
+ this._suggestWidget?.selectNext();
259
+ }
260
+ selectNextPageSuggestion() {
261
+ this._suggestWidget?.selectNextPage();
262
+ }
263
+ acceptSelectedSuggestion(suggestion) {
264
+ if (!suggestion) {
265
+ suggestion = this._suggestWidget?.getFocusedItem();
266
+ }
267
+ if (suggestion && this._leadingLineContent) {
268
+ this._suggestWidget?.hide();
269
+ this._onAcceptedCompletion.fire([
270
+ '\x1b[D'.repeat(Math.max(suggestion.model.replacementLength - this._cursorIndexStart + this._cursorIndexDelta, 0)),
271
+ '\x1b[3~'.repeat(this._additionalInput?.length ?? 0),
272
+ '\x7F'.repeat(suggestion.model.replacementLength),
273
+ suggestion.item.completion.label,
274
+ ].join(''));
275
+ this._enableWidget = false;
276
+ timeout(100).then(e => this._enableWidget = true);
277
+ }
278
+ }
279
+ hideSuggestWidget() {
280
+ this._suggestWidget?.hide();
281
+ }
282
+ handleNonXtermData(data) {
283
+ this._handleTerminalInput(data);
284
+ }
285
+ _handleTerminalInput(data) {
286
+ if (!this._terminal || !this._enableWidget || !this._terminalSuggestWidgetVisibleContextKey.get()) {
287
+ if (data === '-') {
288
+ this._inputQueue = [];
289
+ }
290
+ else {
291
+ this._inputQueue?.push(data);
292
+ }
293
+ return;
294
+ }
295
+ let handled = false;
296
+ if (data === '\x7f') {
297
+ if (this._additionalInput && this._additionalInput.length > 0 && this._cursorIndexDelta > 0) {
298
+ handled = true;
299
+ this._additionalInput = this._additionalInput.substring(0, this._cursorIndexDelta-- - 1) + this._additionalInput.substring(this._cursorIndexDelta);
300
+ }
301
+ }
302
+ if (data === '\x1b[3~') {
303
+ if (this._additionalInput && this._additionalInput.length > 0 && this._cursorIndexDelta < this._additionalInput.length - 1) {
304
+ handled = true;
305
+ this._additionalInput = this._additionalInput.substring(0, this._cursorIndexDelta) + this._additionalInput.substring(this._cursorIndexDelta + 1);
306
+ }
307
+ }
308
+ if (data === '\x1b[D') {
309
+ if (this._cursorIndexDelta > 0) {
310
+ handled = true;
311
+ this._cursorIndexDelta--;
312
+ }
313
+ }
314
+ if (data === '\x1b[C') {
315
+ handled = true;
316
+ this._cursorIndexDelta += 1;
317
+ }
318
+ if (data.match(/^[a-z0-9]$/i)) {
319
+ handled = true;
320
+ if (this._additionalInput === undefined) {
321
+ this._additionalInput = '';
322
+ }
323
+ this._additionalInput += data;
324
+ this._cursorIndexDelta++;
325
+ }
326
+ if (handled) {
327
+ if (this._terminalSuggestWidgetVisibleContextKey.get()) {
328
+ this._suggestWidget?.setLineContext(( new LineContext(
329
+ this._leadingLineContent + (this._additionalInput ?? ''),
330
+ this._additionalInput?.length ?? 0
331
+ )));
332
+ }
333
+ if (this._suggestWidget._completionModel?.items.length === 0) {
334
+ this._additionalInput = undefined;
335
+ this.hideSuggestWidget();
336
+ return;
337
+ }
338
+ const dimensions = {
339
+ width: this._terminal._core._renderService.dimensions.device.cell.width,
340
+ height: this._terminal._core._renderService.dimensions.device.cell.height,
341
+ };
342
+ if (!dimensions.width || !dimensions.height) {
343
+ return;
344
+ }
345
+ const xtermBox = this._terminal.element.getBoundingClientRect();
346
+ const panelElement = dom.findParentWithClass(this._container, 'panel').offsetParent;
347
+ const panelBox = panelElement.getBoundingClientRect();
348
+ this._suggestWidget?.showSuggestions(this._suggestWidget._completionModel, 0, false, false, {
349
+ left: (xtermBox.left - panelBox.left) + this._terminal.buffer.active.cursorX * dimensions.width,
350
+ top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
351
+ height: dimensions.height
352
+ });
353
+ }
354
+ else {
355
+ this._additionalInput = undefined;
356
+ this.hideSuggestWidget();
357
+ }
358
+ }
359
+ };
360
+ SuggestAddon = ( __decorate([
361
+ ( __param(1, IInstantiationService))
362
+ ], SuggestAddon));
363
+ let PersistedWidgetSize = class PersistedWidgetSize {
364
+ constructor(_storageService) {
365
+ this._storageService = _storageService;
366
+ this._key = "terminal.integrated.suggestSize" ;
367
+ }
368
+ restore() {
369
+ const raw = this._storageService.get(this._key, 0 ) ?? '';
370
+ try {
371
+ const obj = JSON.parse(raw);
372
+ if (dom.Dimension.is(obj)) {
373
+ return dom.Dimension.lift(obj);
374
+ }
375
+ }
376
+ catch {
377
+ }
378
+ return undefined;
379
+ }
380
+ store(size) {
381
+ this._storageService.store(this._key, JSON.stringify(size), 0 , 1 );
382
+ }
383
+ reset() {
384
+ this._storageService.remove(this._key, 0 );
385
+ }
386
+ };
387
+ PersistedWidgetSize = ( __decorate([
388
+ ( __param(0, IStorageService))
389
+ ], PersistedWidgetSize));
390
+ export { SuggestAddon };