@codingame/monaco-vscode-xterm-addons-common 25.1.2 → 26.0.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.
Files changed (18) hide show
  1. package/package.json +10 -10
  2. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +58 -114
  3. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +42 -0
  4. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +209 -0
  5. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +18 -16
  6. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +1 -0
  7. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +151 -70
  8. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +27 -25
  9. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +67 -53
  10. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +4 -1
  11. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +188 -116
  12. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +106 -71
  13. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +6 -3
  14. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +204 -140
  15. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +77 -82
  16. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermAddonImporter.js +24 -24
  17. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +4 -1
  18. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +262 -162
@@ -20,36 +20,42 @@ import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/wor
20
20
  import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
21
21
  import { IChatVariablesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariables.service';
22
22
  import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
23
- import { ChatDynamicVariableModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables';
23
+ import { ChatDynamicVariableModel } from '../../../attachments/chatDynamicVariables.js';
24
24
  import { cleanupOldImages, createFileForMedia, resizeImage, imageToHash } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatImageUtils';
25
25
 
26
26
  var CopyAttachmentsProvider_1;
27
- const COPY_MIME_TYPES = 'application/vnd.code.additional-editor-data';
27
+ const COPY_MIME_TYPES = "application/vnd.code.additional-editor-data";
28
28
  let PasteImageProvider = class PasteImageProvider {
29
- constructor(chatWidgetService, extensionService, fileService, environmentService, logService) {
29
+ constructor(
30
+ chatWidgetService,
31
+ extensionService,
32
+ fileService,
33
+ environmentService,
34
+ logService
35
+ ) {
30
36
  this.chatWidgetService = chatWidgetService;
31
37
  this.extensionService = extensionService;
32
38
  this.fileService = fileService;
33
39
  this.environmentService = environmentService;
34
40
  this.logService = logService;
35
- this.kind = ( new HierarchicalKind('chat.attach.image'));
41
+ this.kind = ( new HierarchicalKind("chat.attach.image"));
36
42
  this.providedPasteEditKinds = [this.kind];
37
43
  this.copyMimeTypes = [];
38
- this.pasteMimeTypes = ['image/*'];
39
- this.imagesFolder = joinPath(this.environmentService.workspaceStorageHome, 'vscode-chat-images');
44
+ this.pasteMimeTypes = ["image/*"];
45
+ this.imagesFolder = joinPath(this.environmentService.workspaceStorageHome, "vscode-chat-images");
40
46
  cleanupOldImages(this.fileService, this.logService, this.imagesFolder);
41
47
  }
42
48
  async provideDocumentPasteEdits(model, ranges, dataTransfer, context, token) {
43
- if (!( this.extensionService.extensions.some(ext => isProposedApiEnabled(ext, 'chatReferenceBinaryData')))) {
49
+ if (!( this.extensionService.extensions.some(ext => isProposedApiEnabled(ext, "chatReferenceBinaryData")))) {
44
50
  return;
45
51
  }
46
52
  const supportedMimeTypes = [
47
- 'image/png',
48
- 'image/jpeg',
49
- 'image/jpg',
50
- 'image/bmp',
51
- 'image/gif',
52
- 'image/tiff'
53
+ "image/png",
54
+ "image/jpeg",
55
+ "image/jpg",
56
+ "image/bmp",
57
+ "image/gif",
58
+ "image/tiff"
53
59
  ];
54
60
  let mimeType;
55
61
  let imageItem;
@@ -72,9 +78,10 @@ let PasteImageProvider = class PasteImageProvider {
72
78
  return;
73
79
  }
74
80
  const attachedVariables = widget.attachmentModel.attachments;
75
- const displayName = ( localize(5845, 'Pasted Image'));
81
+ const displayName = ( localize(6099, "Pasted Image"));
76
82
  let tempDisplayName = displayName;
77
- for (let appendValue = 2; ( attachedVariables.some(attachment => attachment.name === tempDisplayName)); appendValue++) {
83
+ for (let appendValue = 2; ( attachedVariables.some(attachment => attachment.name === tempDisplayName)); appendValue++)
84
+ {
78
85
  tempDisplayName = `${displayName} ${appendValue}`;
79
86
  }
80
87
  const fileReference = await createFileForMedia(this.fileService, this.imagesFolder, currClipboard, mimeType);
@@ -93,29 +100,28 @@ let PasteImageProvider = class PasteImageProvider {
93
100
  if (( currentContextIds.has(scaledImageContext.id))) {
94
101
  return;
95
102
  }
96
- const edit = createCustomPasteEdit(model, [scaledImageContext], mimeType, this.kind, ( localize(5846, 'Pasted Image Attachment')), this.chatWidgetService);
103
+ const edit = createCustomPasteEdit(model, [scaledImageContext], mimeType, this.kind, ( localize(6100, "Pasted Image Attachment")), this.chatWidgetService);
97
104
  return createEditSession(edit);
98
105
  }
99
106
  };
100
- PasteImageProvider = ( __decorate([
101
- ( __param(2, IFileService)),
102
- ( __param(3, IEnvironmentService)),
103
- ( __param(4, ILogService))
104
- ], PasteImageProvider));
107
+ PasteImageProvider = ( __decorate([( __param(2, IFileService)), ( __param(3, IEnvironmentService)), ( __param(4, ILogService))], PasteImageProvider));
105
108
  async function getImageAttachContext(data, mimeType, token, displayName, resource) {
106
109
  const imageHash = await imageToHash(data);
107
110
  if (token.isCancellationRequested) {
108
111
  return undefined;
109
112
  }
110
113
  return {
111
- kind: 'image',
114
+ kind: "image",
112
115
  value: data,
113
116
  id: imageHash,
114
117
  name: displayName,
115
118
  icon: Codicon.fileMedia,
116
119
  mimeType,
117
120
  isPasted: true,
118
- references: [{ reference: resource, kind: 'reference' }]
121
+ references: [{
122
+ reference: resource,
123
+ kind: "reference"
124
+ }]
119
125
  };
120
126
  }
121
127
  function isImage(array) {
@@ -129,7 +135,7 @@ function isImage(array) {
129
135
  gif: [0x47, 0x49, 0x46, 0x38],
130
136
  tiff: [0x49, 0x49, 0x2A, 0x00]
131
137
  };
132
- return ( ( Object.values(identifier)).some((signature) => signature.every((byte, index) => array[index] === byte)));
138
+ return ( ( Object.values(identifier)).some(signature => signature.every((byte, index) => array[index] === byte)));
133
139
  }
134
140
  class CopyTextProvider {
135
141
  constructor() {
@@ -142,18 +148,25 @@ class CopyTextProvider {
142
148
  return;
143
149
  }
144
150
  const customDataTransfer = ( new VSDataTransfer());
145
- const data = { range: ranges[0], uri: model.uri.toJSON() };
151
+ const data = {
152
+ range: ranges[0],
153
+ uri: model.uri.toJSON()
154
+ };
146
155
  customDataTransfer.append(COPY_MIME_TYPES, createStringDataTransferItem(JSON.stringify(data)));
147
156
  return customDataTransfer;
148
157
  }
149
158
  }
150
159
  let CopyAttachmentsProvider = class CopyAttachmentsProvider {
151
- static { CopyAttachmentsProvider_1 = this; }
152
- static { this.ATTACHMENT_MIME_TYPE = 'application/vnd.chat.attachment+json'; }
160
+ static {
161
+ CopyAttachmentsProvider_1 = this;
162
+ }
163
+ static {
164
+ this.ATTACHMENT_MIME_TYPE = "application/vnd.chat.attachment+json";
165
+ }
153
166
  constructor(chatWidgetService, chatVariableService) {
154
167
  this.chatWidgetService = chatWidgetService;
155
168
  this.chatVariableService = chatVariableService;
156
- this.kind = ( new HierarchicalKind('chat.attach.attachments'));
169
+ this.kind = ( new HierarchicalKind("chat.attach.attachments"));
157
170
  this.providedPasteEditKinds = [this.kind];
158
171
  this.copyMimeTypes = [CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE];
159
172
  this.pasteMimeTypes = [CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE];
@@ -169,7 +182,13 @@ let CopyAttachmentsProvider = class CopyAttachmentsProvider {
169
182
  return undefined;
170
183
  }
171
184
  const result = ( new VSDataTransfer());
172
- result.append(CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE, createStringDataTransferItem(JSON.stringify({ attachments, dynamicVariables })));
185
+ result.append(
186
+ CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE,
187
+ createStringDataTransferItem(JSON.stringify({
188
+ attachments,
189
+ dynamicVariables
190
+ }))
191
+ );
173
192
  return result;
174
193
  }
175
194
  async provideDocumentPasteEdits(model, _ranges, dataTransfer, _context, token) {
@@ -194,15 +213,13 @@ let CopyAttachmentsProvider = class CopyAttachmentsProvider {
194
213
  let pastedData;
195
214
  try {
196
215
  pastedData = revive(JSON.parse(rawData));
197
- }
198
- catch {
199
- }
216
+ } catch {}
200
217
  if (!Array.isArray(pastedData?.attachments) && !Array.isArray(pastedData?.dynamicVariables)) {
201
218
  return;
202
219
  }
203
220
  const edit = {
204
221
  insertText: textdata,
205
- title: ( localize(5847, 'Insert Prompt & Attachments')),
222
+ title: ( localize(6101, "Insert Prompt & Attachments")),
206
223
  kind: this.kind,
207
224
  handledMimeType: CopyAttachmentsProvider_1.ATTACHMENT_MIME_TYPE,
208
225
  additionalEdit: {
@@ -226,15 +243,12 @@ let CopyAttachmentsProvider = class CopyAttachmentsProvider {
226
243
  return createEditSession(edit);
227
244
  }
228
245
  };
229
- CopyAttachmentsProvider = CopyAttachmentsProvider_1 = ( __decorate([
230
- ( __param(0, IChatWidgetService)),
231
- ( __param(1, IChatVariablesService))
232
- ], CopyAttachmentsProvider));
246
+ CopyAttachmentsProvider = CopyAttachmentsProvider_1 = ( __decorate([( __param(0, IChatWidgetService)), ( __param(1, IChatVariablesService))], CopyAttachmentsProvider));
233
247
  class PasteTextProvider {
234
248
  constructor(chatWidgetService, modelService) {
235
249
  this.chatWidgetService = chatWidgetService;
236
250
  this.modelService = modelService;
237
- this.kind = ( new HierarchicalKind('chat.attach.text'));
251
+ this.kind = ( new HierarchicalKind("chat.attach.text"));
238
252
  this.providedPasteEditKinds = [this.kind];
239
253
  this.copyMimeTypes = [];
240
254
  this.pasteMimeTypes = [COPY_MIME_TYPES];
@@ -244,7 +258,7 @@ class PasteTextProvider {
244
258
  return;
245
259
  }
246
260
  const text = dataTransfer.get(Mimes.text);
247
- const editorData = dataTransfer.get('vscode-editor-data');
261
+ const editorData = dataTransfer.get("vscode-editor-data");
248
262
  const additionalEditorData = dataTransfer.get(COPY_MIME_TYPES);
249
263
  if (!editorData || !text || !additionalEditorData) {
250
264
  return;
@@ -268,7 +282,12 @@ class PasteTextProvider {
268
282
  return;
269
283
  }
270
284
  }
271
- const copiedContext = getCopiedContext(textdata, URI.revive(additionalData.uri), metadata.mode, additionalData.range);
285
+ const copiedContext = getCopiedContext(
286
+ textdata,
287
+ URI.revive(additionalData.uri),
288
+ metadata.mode,
289
+ additionalData.range
290
+ );
272
291
  if (token.isCancellationRequested || !copiedContext) {
273
292
  return;
274
293
  }
@@ -276,8 +295,10 @@ class PasteTextProvider {
276
295
  if (( currentContextIds.has(copiedContext.id))) {
277
296
  return;
278
297
  }
279
- const edit = createCustomPasteEdit(model, [copiedContext], Mimes.text, this.kind, ( localize(5848, 'Pasted Code Attachment')), this.chatWidgetService);
280
- edit.yieldTo = [{ kind: HierarchicalKind.Empty.append('text', 'plain') }];
298
+ const edit = createCustomPasteEdit(model, [copiedContext], Mimes.text, this.kind, ( localize(6102, "Pasted Code Attachment")), this.chatWidgetService);
299
+ edit.yieldTo = [{
300
+ kind: HierarchicalKind.Empty.append("text", "plain")
301
+ }];
281
302
  return createEditSession(edit);
282
303
  }
283
304
  }
@@ -286,9 +307,9 @@ function getCopiedContext(code, file, language, range) {
286
307
  const start = range.startLineNumber;
287
308
  const end = range.endLineNumber;
288
309
  const resultText = `Copied Selection of Code: \n\n\n From the file: ${fileName} From lines ${start} to ${end} \n \`\`\`${code}\`\`\``;
289
- const pastedLines = start === end ? ( localize(5849, '1 line')) : ( localize(5850, '{0} lines', end + 1 - start));
310
+ const pastedLines = start === end ? ( localize(6103, "1 line")) : ( localize(6104, "{0} lines", end + 1 - start));
290
311
  return {
291
- kind: 'paste',
312
+ kind: "paste",
292
313
  value: resultText,
293
314
  id: `${fileName}${start}${end}${range.startColumn}${range.endColumn}`,
294
315
  name: `${fileName} ${pastedLines}`,
@@ -302,29 +323,27 @@ function getCopiedContext(code, file, language, range) {
302
323
  },
303
324
  code,
304
325
  references: [{
305
- reference: file,
306
- kind: 'reference'
307
- }]
326
+ reference: file,
327
+ kind: "reference"
328
+ }]
308
329
  };
309
330
  }
310
331
  function createCustomPasteEdit(model, context, handledMimeType, kind, title, chatWidgetService) {
311
- const label = context.length === 1
312
- ? context[0].name
313
- : ( localize(5851, '{0} and {1} more', context[0].name, context.length - 1));
332
+ const label = context.length === 1 ? context[0].name : ( localize(6105, "{0} and {1} more", context[0].name, context.length - 1));
314
333
  const customEdit = {
315
334
  resource: model.uri,
316
335
  variable: context,
317
336
  undo: () => {
318
337
  const widget = chatWidgetService.getWidgetByInputUri(model.uri);
319
338
  if (!widget) {
320
- throw ( new Error('No widget found for undo'));
339
+ throw ( new Error("No widget found for undo"));
321
340
  }
322
341
  widget.attachmentModel.delete(...( context.map(c => c.id)));
323
342
  },
324
343
  redo: () => {
325
344
  const widget = chatWidgetService.getWidgetByInputUri(model.uri);
326
345
  if (!widget) {
327
- throw ( new Error('No widget found for redo'));
346
+ throw ( new Error("No widget found for redo"));
328
347
  }
329
348
  widget.attachmentModel.addContext(...context);
330
349
  },
@@ -334,46 +353,62 @@ function createCustomPasteEdit(model, context, handledMimeType, kind, title, cha
334
353
  }
335
354
  };
336
355
  return {
337
- insertText: '',
356
+ insertText: "",
338
357
  title,
339
358
  kind,
340
359
  handledMimeType,
341
360
  additionalEdit: {
342
- edits: [customEdit],
361
+ edits: [customEdit]
343
362
  }
344
363
  };
345
364
  }
346
365
  function createEditSession(edit) {
347
366
  return {
348
367
  edits: [edit],
349
- dispose: () => { },
368
+ dispose: () => {}
350
369
  };
351
370
  }
352
371
  let ChatPasteProvidersFeature = class ChatPasteProvidersFeature extends Disposable {
353
- constructor(instaService, languageFeaturesService, chatWidgetService, extensionService, fileService, modelService, environmentService, logService) {
372
+ constructor(
373
+ instaService,
374
+ languageFeaturesService,
375
+ chatWidgetService,
376
+ extensionService,
377
+ fileService,
378
+ modelService,
379
+ environmentService,
380
+ logService
381
+ ) {
354
382
  super();
355
- this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: Schemas.vscodeChatInput, pattern: '*', hasAccessToAllModels: true }, instaService.createInstance(CopyAttachmentsProvider)));
356
- this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: Schemas.vscodeChatInput, pattern: '*', hasAccessToAllModels: true }, ( new PasteImageProvider(
383
+ this._register(languageFeaturesService.documentPasteEditProvider.register({
384
+ scheme: Schemas.vscodeChatInput,
385
+ pattern: "*",
386
+ hasAccessToAllModels: true
387
+ }, instaService.createInstance(CopyAttachmentsProvider)));
388
+ this._register(languageFeaturesService.documentPasteEditProvider.register({
389
+ scheme: Schemas.vscodeChatInput,
390
+ pattern: "*",
391
+ hasAccessToAllModels: true
392
+ }, ( new PasteImageProvider(
357
393
  chatWidgetService,
358
394
  extensionService,
359
395
  fileService,
360
396
  environmentService,
361
397
  logService
362
398
  ))));
363
- this._register(languageFeaturesService.documentPasteEditProvider.register({ scheme: Schemas.vscodeChatInput, pattern: '*', hasAccessToAllModels: true }, ( new PasteTextProvider(chatWidgetService, modelService))));
364
- this._register(languageFeaturesService.documentPasteEditProvider.register('*', ( new CopyTextProvider())));
365
- this._register(languageFeaturesService.documentPasteEditProvider.register('*', ( new CopyTextProvider())));
399
+ this._register(languageFeaturesService.documentPasteEditProvider.register({
400
+ scheme: Schemas.vscodeChatInput,
401
+ pattern: "*",
402
+ hasAccessToAllModels: true
403
+ }, ( new PasteTextProvider(chatWidgetService, modelService))));
404
+ this._register(
405
+ languageFeaturesService.documentPasteEditProvider.register("*", ( new CopyTextProvider()))
406
+ );
407
+ this._register(
408
+ languageFeaturesService.documentPasteEditProvider.register("*", ( new CopyTextProvider()))
409
+ );
366
410
  }
367
411
  };
368
- ChatPasteProvidersFeature = ( __decorate([
369
- ( __param(0, IInstantiationService)),
370
- ( __param(1, ILanguageFeaturesService)),
371
- ( __param(2, IChatWidgetService)),
372
- ( __param(3, IExtensionService)),
373
- ( __param(4, IFileService)),
374
- ( __param(5, IModelService)),
375
- ( __param(6, IEnvironmentService)),
376
- ( __param(7, ILogService))
377
- ], ChatPasteProvidersFeature));
412
+ ChatPasteProvidersFeature = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, ILanguageFeaturesService)), ( __param(2, IChatWidgetService)), ( __param(3, IExtensionService)), ( __param(4, IFileService)), ( __param(5, IModelService)), ( __param(6, IEnvironmentService)), ( __param(7, ILogService))], ChatPasteProvidersFeature));
378
413
 
379
414
  export { ChatPasteProvidersFeature, CopyTextProvider, PasteImageProvider, PasteTextProvider, isImage };
@@ -4,16 +4,19 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
4
4
  import { TerminalDataTransfers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal';
5
5
 
6
6
  function parseTerminalUri(resource) {
7
- const [, workspaceId, instanceId] = resource.path.split('/');
7
+ const [, workspaceId, instanceId] = resource.path.split("/");
8
8
  if (!workspaceId || !Number.parseInt(instanceId)) {
9
9
  throw ( new Error(`Could not parse terminal uri for resource ${resource}`));
10
10
  }
11
- return { workspaceId, instanceId: Number.parseInt(instanceId) };
11
+ return {
12
+ workspaceId,
13
+ instanceId: Number.parseInt(instanceId)
14
+ };
12
15
  }
13
16
  function getTerminalUri(workspaceId, instanceId, title, commandId) {
14
17
  const params = ( new URLSearchParams());
15
18
  if (commandId) {
16
- params.set('command', commandId);
19
+ params.set("command", commandId);
17
20
  }
18
21
  return ( URI.from({
19
22
  scheme: Schemas.vscodeTerminal,