@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.
- package/package.json +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +58 -114
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.js +209 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/attachInstructionsAction.js +18 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.js +151 -70
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptName.js +27 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.js +67 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js +188 -116
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatPasteProviders.js +106 -71
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalUri.js +6 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +204 -140
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +77 -82
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermAddonImporter.js +24 -24
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +262 -162
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.js
CHANGED
|
@@ -13,8 +13,8 @@ import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/
|
|
|
13
13
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
14
14
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
15
15
|
import { getCleanPromptName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
16
|
-
import { PromptsType, AGENT_DOCUMENTATION_URL, INSTRUCTIONS_DOCUMENTATION_URL, PROMPT_DOCUMENTATION_URL } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
17
|
-
import { NEW_PROMPT_COMMAND_ID, NEW_INSTRUCTIONS_COMMAND_ID, NEW_AGENT_COMMAND_ID } from '../newPromptFileActions.js';
|
|
16
|
+
import { PromptsType, SKILL_DOCUMENTATION_URL, AGENT_DOCUMENTATION_URL, INSTRUCTIONS_DOCUMENTATION_URL, PROMPT_DOCUMENTATION_URL } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
17
|
+
import { NEW_PROMPT_COMMAND_ID, NEW_INSTRUCTIONS_COMMAND_ID, NEW_AGENT_COMMAND_ID, NEW_SKILL_COMMAND_ID } from '../newPromptFileActions.js';
|
|
18
18
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
19
19
|
import { askForPromptFileName } from './askForPromptName.js';
|
|
20
20
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -23,96 +23,126 @@ import { askForPromptSourceFolder } from './askForPromptSourceFolder.js';
|
|
|
23
23
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
24
24
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
25
25
|
import { PromptsConfig } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/config';
|
|
26
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
26
27
|
import { PromptFileRewriter } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/promptSyntax/promptFileRewriter';
|
|
28
|
+
import { isOrganizationPromptFile } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/utils/promptsServiceUtils';
|
|
27
29
|
|
|
28
30
|
function newHelpButton(type) {
|
|
29
31
|
const iconClass = ThemeIcon.asClassName(Codicon.question);
|
|
30
32
|
switch (type) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
case PromptsType.prompt:
|
|
34
|
+
return {
|
|
35
|
+
tooltip: ( localize(5708, "Show help on prompt files")),
|
|
36
|
+
helpURI: ( URI.parse(PROMPT_DOCUMENTATION_URL)),
|
|
37
|
+
iconClass
|
|
38
|
+
};
|
|
39
|
+
case PromptsType.instructions:
|
|
40
|
+
return {
|
|
41
|
+
tooltip: ( localize(5709, "Show help on instruction files")),
|
|
42
|
+
helpURI: ( URI.parse(INSTRUCTIONS_DOCUMENTATION_URL)),
|
|
43
|
+
iconClass
|
|
44
|
+
};
|
|
45
|
+
case PromptsType.agent:
|
|
46
|
+
return {
|
|
47
|
+
tooltip: ( localize(5710, "Show help on custom agent files")),
|
|
48
|
+
helpURI: ( URI.parse(AGENT_DOCUMENTATION_URL)),
|
|
49
|
+
iconClass
|
|
50
|
+
};
|
|
51
|
+
case PromptsType.skill:
|
|
52
|
+
return {
|
|
53
|
+
tooltip: ( localize(5711, "Show help on skill files")),
|
|
54
|
+
helpURI: ( URI.parse(SKILL_DOCUMENTATION_URL)),
|
|
55
|
+
iconClass
|
|
56
|
+
};
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
function isHelpButton(button) {
|
|
52
60
|
return button.helpURI !== undefined;
|
|
53
61
|
}
|
|
54
62
|
function isPromptFileItem(item) {
|
|
55
|
-
return item.type ===
|
|
63
|
+
return item.type === "item" && !!item.promptFileUri;
|
|
64
|
+
}
|
|
65
|
+
function isExtensionPromptPath(prompt) {
|
|
66
|
+
return prompt.storage === PromptsStorage.extension && !!prompt.extension;
|
|
56
67
|
}
|
|
57
68
|
const NEW_PROMPT_FILE_OPTION = {
|
|
58
|
-
type:
|
|
59
|
-
label: `$(plus) ${( localize(
|
|
69
|
+
type: "item",
|
|
70
|
+
label: `$(plus) ${( localize(5712, "New prompt file..."))}`,
|
|
60
71
|
pickable: false,
|
|
61
72
|
alwaysShow: true,
|
|
62
73
|
buttons: [newHelpButton(PromptsType.prompt)],
|
|
63
|
-
commandId: NEW_PROMPT_COMMAND_ID
|
|
74
|
+
commandId: NEW_PROMPT_COMMAND_ID
|
|
64
75
|
};
|
|
65
76
|
const NEW_INSTRUCTIONS_FILE_OPTION = {
|
|
66
|
-
type:
|
|
67
|
-
label: `$(plus) ${( localize(
|
|
77
|
+
type: "item",
|
|
78
|
+
label: `$(plus) ${( localize(5713, "New instruction file..."))}`,
|
|
68
79
|
pickable: false,
|
|
69
80
|
alwaysShow: true,
|
|
70
81
|
buttons: [newHelpButton(PromptsType.instructions)],
|
|
71
|
-
commandId: NEW_INSTRUCTIONS_COMMAND_ID
|
|
82
|
+
commandId: NEW_INSTRUCTIONS_COMMAND_ID
|
|
72
83
|
};
|
|
73
84
|
const UPDATE_INSTRUCTIONS_OPTION = {
|
|
74
|
-
type:
|
|
75
|
-
label: `$(refresh) ${( localize(
|
|
85
|
+
type: "item",
|
|
86
|
+
label: `$(refresh) ${( localize(5714, "Generate agent instructions..."))}`,
|
|
76
87
|
pickable: false,
|
|
77
88
|
alwaysShow: true,
|
|
78
89
|
buttons: [newHelpButton(PromptsType.instructions)],
|
|
79
|
-
commandId:
|
|
90
|
+
commandId: "workbench.action.chat.generateInstructions"
|
|
80
91
|
};
|
|
81
92
|
const NEW_AGENT_FILE_OPTION = {
|
|
82
|
-
type:
|
|
83
|
-
label: `$(plus) ${( localize(
|
|
93
|
+
type: "item",
|
|
94
|
+
label: `$(plus) ${( localize(5715, "Create new custom agent..."))}`,
|
|
84
95
|
pickable: false,
|
|
85
96
|
alwaysShow: true,
|
|
86
97
|
buttons: [newHelpButton(PromptsType.agent)],
|
|
87
|
-
commandId: NEW_AGENT_COMMAND_ID
|
|
98
|
+
commandId: NEW_AGENT_COMMAND_ID
|
|
99
|
+
};
|
|
100
|
+
const NEW_SKILL_FILE_OPTION = {
|
|
101
|
+
type: "item",
|
|
102
|
+
label: `$(plus) ${( localize(5716, "New skill..."))}`,
|
|
103
|
+
pickable: false,
|
|
104
|
+
alwaysShow: true,
|
|
105
|
+
buttons: [newHelpButton(PromptsType.skill)],
|
|
106
|
+
commandId: NEW_SKILL_COMMAND_ID
|
|
88
107
|
};
|
|
89
108
|
const EDIT_BUTTON = {
|
|
90
|
-
tooltip: ( localize(
|
|
91
|
-
iconClass: ThemeIcon.asClassName(Codicon.fileCode)
|
|
109
|
+
tooltip: ( localize(5717, "Open in Editor")),
|
|
110
|
+
iconClass: ThemeIcon.asClassName(Codicon.fileCode)
|
|
92
111
|
};
|
|
93
112
|
const DELETE_BUTTON = {
|
|
94
|
-
tooltip: ( localize(
|
|
95
|
-
iconClass: ThemeIcon.asClassName(Codicon.trash)
|
|
113
|
+
tooltip: ( localize(5718, "Delete")),
|
|
114
|
+
iconClass: ThemeIcon.asClassName(Codicon.trash)
|
|
96
115
|
};
|
|
97
116
|
const RENAME_BUTTON = {
|
|
98
|
-
tooltip: ( localize(
|
|
99
|
-
iconClass: ThemeIcon.asClassName(Codicon.replace)
|
|
117
|
+
tooltip: ( localize(5719, "Move and/or Rename")),
|
|
118
|
+
iconClass: ThemeIcon.asClassName(Codicon.replace)
|
|
100
119
|
};
|
|
101
120
|
const COPY_BUTTON = {
|
|
102
|
-
tooltip: ( localize(
|
|
103
|
-
iconClass: ThemeIcon.asClassName(Codicon.copy)
|
|
121
|
+
tooltip: ( localize(5720, "Make a Copy")),
|
|
122
|
+
iconClass: ThemeIcon.asClassName(Codicon.copy)
|
|
104
123
|
};
|
|
105
124
|
const MAKE_VISIBLE_BUTTON = {
|
|
106
|
-
tooltip: ( localize(
|
|
125
|
+
tooltip: ( localize(5721, "Hidden from chat view agent picker. Click to show.")),
|
|
107
126
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
108
|
-
alwaysVisible: true
|
|
127
|
+
alwaysVisible: true
|
|
109
128
|
};
|
|
110
129
|
const MAKE_INVISIBLE_BUTTON = {
|
|
111
|
-
tooltip: ( localize(
|
|
112
|
-
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed)
|
|
130
|
+
tooltip: ( localize(5722, "Hide from agent picker")),
|
|
131
|
+
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed)
|
|
113
132
|
};
|
|
114
133
|
let PromptFilePickers = class PromptFilePickers {
|
|
115
|
-
constructor(
|
|
134
|
+
constructor(
|
|
135
|
+
_quickInputService,
|
|
136
|
+
_openerService,
|
|
137
|
+
_fileService,
|
|
138
|
+
_dialogService,
|
|
139
|
+
_commandService,
|
|
140
|
+
_instaService,
|
|
141
|
+
_promptsService,
|
|
142
|
+
_labelService,
|
|
143
|
+
_configurationService,
|
|
144
|
+
_productService
|
|
145
|
+
) {
|
|
116
146
|
this._quickInputService = _quickInputService;
|
|
117
147
|
this._openerService = _openerService;
|
|
118
148
|
this._fileService = _fileService;
|
|
@@ -122,23 +152,27 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
122
152
|
this._promptsService = _promptsService;
|
|
123
153
|
this._labelService = _labelService;
|
|
124
154
|
this._configurationService = _configurationService;
|
|
155
|
+
this._productService = _productService;
|
|
125
156
|
}
|
|
126
157
|
async selectPromptFile(options) {
|
|
127
158
|
const cts = ( new CancellationTokenSource());
|
|
128
|
-
const quickPick = this._quickInputService.createQuickPick({
|
|
159
|
+
const quickPick = this._quickInputService.createQuickPick({
|
|
160
|
+
useSeparators: true
|
|
161
|
+
});
|
|
129
162
|
quickPick.busy = true;
|
|
130
|
-
quickPick.placeholder = ( localize(
|
|
163
|
+
quickPick.placeholder = ( localize(5723, "Searching file system..."));
|
|
131
164
|
try {
|
|
132
165
|
const fileOptions = await this._createPromptPickItems(options, cts.token);
|
|
133
|
-
const activeItem = options.resource && fileOptions.find(
|
|
166
|
+
const activeItem = options.resource && fileOptions.find(
|
|
167
|
+
f => f.type === "item" && extUri.isEqual(f.promptFileUri, options.resource)
|
|
168
|
+
);
|
|
134
169
|
if (activeItem) {
|
|
135
170
|
quickPick.activeItems = [activeItem];
|
|
136
171
|
}
|
|
137
172
|
quickPick.placeholder = options.placeholder;
|
|
138
173
|
quickPick.matchOnDescription = true;
|
|
139
174
|
quickPick.items = fileOptions;
|
|
140
|
-
}
|
|
141
|
-
finally {
|
|
175
|
+
} finally {
|
|
142
176
|
quickPick.busy = false;
|
|
143
177
|
}
|
|
144
178
|
return ( new Promise(resolve => {
|
|
@@ -154,14 +188,22 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
154
188
|
quickPick.activeItems = active;
|
|
155
189
|
};
|
|
156
190
|
disposables.add(quickPick.onDidAccept(async () => {
|
|
157
|
-
const {
|
|
158
|
-
|
|
191
|
+
const {
|
|
192
|
+
selectedItems
|
|
193
|
+
} = quickPick;
|
|
194
|
+
const {
|
|
195
|
+
keyMods
|
|
196
|
+
} = quickPick;
|
|
159
197
|
const selectedItem = selectedItems[0];
|
|
160
198
|
if (isPromptFileItem(selectedItem)) {
|
|
161
|
-
resolve({
|
|
199
|
+
resolve({
|
|
200
|
+
promptFile: selectedItem.promptFileUri,
|
|
201
|
+
keyMods: {
|
|
202
|
+
...keyMods
|
|
203
|
+
}
|
|
204
|
+
});
|
|
162
205
|
isResolved = true;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
206
|
+
} else {
|
|
165
207
|
if (selectedItem.commandId) {
|
|
166
208
|
await this._commandService.executeCommand(selectedItem.commandId);
|
|
167
209
|
return;
|
|
@@ -169,7 +211,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
169
211
|
}
|
|
170
212
|
quickPick.hide();
|
|
171
213
|
}));
|
|
172
|
-
disposables.add(quickPick.onDidTriggerItemButton(async
|
|
214
|
+
disposables.add(quickPick.onDidTriggerItemButton(async e => {
|
|
173
215
|
const shouldRefresh = await this._handleButtonClick(quickPick, e, options);
|
|
174
216
|
if (!isClosed && shouldRefresh) {
|
|
175
217
|
await refreshItems();
|
|
@@ -211,10 +253,14 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
211
253
|
const disabled = this._promptsService.getDisabledPromptFiles(options.type);
|
|
212
254
|
getVisibility = p => !( disabled.has(p.uri));
|
|
213
255
|
}
|
|
256
|
+
const sortByLabel = items => items.sort((a, b) => a.label.localeCompare(b.label));
|
|
214
257
|
const locals = await this._promptsService.listPromptFilesForStorage(options.type, PromptsStorage.local, token);
|
|
215
258
|
if (locals.length) {
|
|
216
|
-
result.push({
|
|
217
|
-
|
|
259
|
+
result.push({
|
|
260
|
+
type: "separator",
|
|
261
|
+
label: ( localize(5724, "Workspace"))
|
|
262
|
+
});
|
|
263
|
+
result.push(...sortByLabel(await Promise.all(( locals.map(l => this._createPromptPickItem(l, buttons, getVisibility(l), token))))));
|
|
218
264
|
}
|
|
219
265
|
let agentInstructionFiles = [];
|
|
220
266
|
if (options.type === PromptsType.instructions) {
|
|
@@ -224,8 +270,10 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
224
270
|
...(await this._promptsService.listAgentMDs(token, !!useNestedAgentMD))
|
|
225
271
|
];
|
|
226
272
|
agentInstructionFiles = ( agentInstructionUris.map(uri => {
|
|
227
|
-
const folderName = this._labelService.getUriLabel(dirname(uri), {
|
|
228
|
-
|
|
273
|
+
const folderName = this._labelService.getUriLabel(dirname(uri), {
|
|
274
|
+
relative: true
|
|
275
|
+
});
|
|
276
|
+
const shouldShowFolderPath = folderName?.toLowerCase() !== ".github";
|
|
229
277
|
return {
|
|
230
278
|
uri,
|
|
231
279
|
description: shouldShowFolderPath ? folderName : undefined,
|
|
@@ -236,12 +284,14 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
236
284
|
}
|
|
237
285
|
if (agentInstructionFiles.length) {
|
|
238
286
|
const agentButtons = buttons.filter(b => b !== RENAME_BUTTON);
|
|
239
|
-
result.push({
|
|
240
|
-
|
|
287
|
+
result.push({
|
|
288
|
+
type: "separator",
|
|
289
|
+
label: ( localize(5725, "Agent Instructions"))
|
|
290
|
+
});
|
|
291
|
+
result.push(...sortByLabel(await Promise.all(( agentInstructionFiles.map(l => this._createPromptPickItem(l, agentButtons, getVisibility(l), token))))));
|
|
241
292
|
}
|
|
242
|
-
const exts = await this._promptsService.listPromptFilesForStorage(options.type, PromptsStorage.extension, token);
|
|
293
|
+
const exts = (await this._promptsService.listPromptFilesForStorage(options.type, PromptsStorage.extension, token)).filter(isExtensionPromptPath);
|
|
243
294
|
if (exts.length) {
|
|
244
|
-
result.push({ type: 'separator', label: ( localize(5512, "Extensions")) });
|
|
245
295
|
const extButtons = [];
|
|
246
296
|
if (options.optionEdit !== false) {
|
|
247
297
|
extButtons.push(EDIT_BUTTON);
|
|
@@ -249,25 +299,51 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
249
299
|
if (options.optionCopy !== false) {
|
|
250
300
|
extButtons.push(COPY_BUTTON);
|
|
251
301
|
}
|
|
252
|
-
|
|
302
|
+
const groupedExts = ( new Map());
|
|
303
|
+
for (const ext of exts) {
|
|
304
|
+
const groupLabel = this._getExtensionGroupLabel(ext);
|
|
305
|
+
if (!( groupedExts.has(groupLabel))) {
|
|
306
|
+
groupedExts.set(groupLabel, []);
|
|
307
|
+
}
|
|
308
|
+
groupedExts.get(groupLabel).push(ext);
|
|
309
|
+
}
|
|
310
|
+
const sortedGroupedExts = Array.from(groupedExts.entries()).sort((a, b) => a[0].localeCompare(b[0]));
|
|
311
|
+
for (const [groupLabel, groupExts] of sortedGroupedExts) {
|
|
312
|
+
result.push({
|
|
313
|
+
type: "separator",
|
|
314
|
+
label: groupLabel
|
|
315
|
+
});
|
|
316
|
+
result.push(...sortByLabel(await Promise.all(( groupExts.map(e => this._createPromptPickItem(e, extButtons, getVisibility(e), token))))));
|
|
317
|
+
}
|
|
253
318
|
}
|
|
254
319
|
const users = await this._promptsService.listPromptFilesForStorage(options.type, PromptsStorage.user, token);
|
|
255
320
|
if (users.length) {
|
|
256
|
-
result.push({
|
|
257
|
-
|
|
321
|
+
result.push({
|
|
322
|
+
type: "separator",
|
|
323
|
+
label: ( localize(5726, "User Data"))
|
|
324
|
+
});
|
|
325
|
+
result.push(...sortByLabel(await Promise.all(( users.map(u => this._createPromptPickItem(u, buttons, getVisibility(u), token))))));
|
|
258
326
|
}
|
|
259
327
|
return result;
|
|
260
328
|
}
|
|
329
|
+
_getExtensionGroupLabel(extPath) {
|
|
330
|
+
if (isOrganizationPromptFile(extPath.uri, extPath.extension.identifier, this._productService)) {
|
|
331
|
+
return localize(5727, "Organization");
|
|
332
|
+
}
|
|
333
|
+
return localize(5728, "Extensions");
|
|
334
|
+
}
|
|
261
335
|
_getNewItems(type) {
|
|
262
336
|
switch (type) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
337
|
+
case PromptsType.prompt:
|
|
338
|
+
return [NEW_PROMPT_FILE_OPTION];
|
|
339
|
+
case PromptsType.instructions:
|
|
340
|
+
return [NEW_INSTRUCTIONS_FILE_OPTION, UPDATE_INSTRUCTIONS_OPTION];
|
|
341
|
+
case PromptsType.agent:
|
|
342
|
+
return [NEW_AGENT_FILE_OPTION];
|
|
343
|
+
case PromptsType.skill:
|
|
344
|
+
return [NEW_SKILL_FILE_OPTION];
|
|
345
|
+
default:
|
|
346
|
+
throw ( new Error(`Unknown prompt type '${type}'.`));
|
|
271
347
|
}
|
|
272
348
|
}
|
|
273
349
|
async _createPromptPickItem(promptFile, buttons, visibility, token) {
|
|
@@ -276,34 +352,35 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
276
352
|
const promptDescription = parsedPromptFile?.header?.description ?? promptFile.description;
|
|
277
353
|
let tooltip;
|
|
278
354
|
switch (promptFile.storage) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
355
|
+
case PromptsStorage.extension:
|
|
356
|
+
tooltip = promptFile.extension.displayName ?? promptFile.extension.id;
|
|
357
|
+
break;
|
|
358
|
+
case PromptsStorage.local:
|
|
359
|
+
tooltip = this._labelService.getUriLabel(dirname(promptFile.uri), {
|
|
360
|
+
relative: true
|
|
361
|
+
});
|
|
362
|
+
break;
|
|
363
|
+
case PromptsStorage.user:
|
|
364
|
+
tooltip = undefined;
|
|
365
|
+
break;
|
|
288
366
|
}
|
|
289
367
|
let iconClass;
|
|
290
368
|
if (visibility === false) {
|
|
291
369
|
buttons = (buttons ?? []).concat(MAKE_VISIBLE_BUTTON);
|
|
292
|
-
promptName = ( localize(
|
|
293
|
-
tooltip = ( localize(
|
|
294
|
-
}
|
|
295
|
-
else if (visibility === true) {
|
|
370
|
+
promptName = ( localize(5729, "{0} (hidden)", promptName));
|
|
371
|
+
tooltip = ( localize(5730, "Hidden from chat view agent picker"));
|
|
372
|
+
} else if (visibility === true) {
|
|
296
373
|
buttons = (buttons ?? []).concat(MAKE_INVISIBLE_BUTTON);
|
|
297
374
|
}
|
|
298
375
|
return {
|
|
299
376
|
id: ( promptFile.uri.toString()),
|
|
300
|
-
type:
|
|
377
|
+
type: "item",
|
|
301
378
|
label: promptName,
|
|
302
379
|
description: promptDescription,
|
|
303
380
|
iconClass,
|
|
304
381
|
tooltip,
|
|
305
382
|
promptFileUri: promptFile.uri,
|
|
306
|
-
buttons
|
|
383
|
+
buttons
|
|
307
384
|
};
|
|
308
385
|
}
|
|
309
386
|
async keepQuickPickOpen(quickPick, work) {
|
|
@@ -311,14 +388,16 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
311
388
|
quickPick.ignoreFocusOut = true;
|
|
312
389
|
try {
|
|
313
390
|
return await work();
|
|
314
|
-
}
|
|
315
|
-
finally {
|
|
391
|
+
} finally {
|
|
316
392
|
quickPick.ignoreFocusOut = previousIgnoreFocusOut;
|
|
317
393
|
quickPick.show();
|
|
318
394
|
}
|
|
319
395
|
}
|
|
320
396
|
async _handleButtonClick(quickPick, context, options) {
|
|
321
|
-
const {
|
|
397
|
+
const {
|
|
398
|
+
item,
|
|
399
|
+
button
|
|
400
|
+
} = context;
|
|
322
401
|
if (!isPromptFileItem(item)) {
|
|
323
402
|
if (isHelpButton(button)) {
|
|
324
403
|
await this._openerService.open(button.helpURI);
|
|
@@ -346,8 +425,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
346
425
|
const newFile = joinPath(newFolder.uri, newName);
|
|
347
426
|
if (isMove) {
|
|
348
427
|
await this._fileService.move(value, newFile);
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
428
|
+
} else {
|
|
351
429
|
await this._fileService.copy(value, newFile);
|
|
352
430
|
}
|
|
353
431
|
await this._openerService.open(newFile);
|
|
@@ -358,8 +436,12 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
358
436
|
if (button === DELETE_BUTTON) {
|
|
359
437
|
return await this.keepQuickPickOpen(quickPick, async () => {
|
|
360
438
|
const filename = getCleanPromptName(value);
|
|
361
|
-
const message = ( localize(
|
|
362
|
-
const {
|
|
439
|
+
const message = ( localize(5731, "Are you sure you want to delete '{0}'?", filename));
|
|
440
|
+
const {
|
|
441
|
+
confirmed
|
|
442
|
+
} = await this._dialogService.confirm({
|
|
443
|
+
message
|
|
444
|
+
});
|
|
363
445
|
if (!confirmed) {
|
|
364
446
|
return false;
|
|
365
447
|
}
|
|
@@ -371,8 +453,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
371
453
|
const disabled = this._promptsService.getDisabledPromptFiles(options.type);
|
|
372
454
|
if (button === MAKE_VISIBLE_BUTTON) {
|
|
373
455
|
disabled.delete(value);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
456
|
+
} else {
|
|
376
457
|
disabled.add(value);
|
|
377
458
|
}
|
|
378
459
|
this._promptsService.setDisabledPromptFiles(options.type, disabled);
|
|
@@ -382,14 +463,16 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
382
463
|
}
|
|
383
464
|
async managePromptFiles(type, placeholder) {
|
|
384
465
|
const cts = ( new CancellationTokenSource());
|
|
385
|
-
const quickPick = this._quickInputService.createQuickPick({
|
|
466
|
+
const quickPick = this._quickInputService.createQuickPick({
|
|
467
|
+
useSeparators: true
|
|
468
|
+
});
|
|
386
469
|
quickPick.placeholder = placeholder;
|
|
387
470
|
quickPick.canSelectMany = true;
|
|
388
471
|
quickPick.matchOnDescription = true;
|
|
389
472
|
quickPick.sortByLabel = false;
|
|
390
473
|
quickPick.busy = true;
|
|
391
474
|
const options = {
|
|
392
|
-
placeholder:
|
|
475
|
+
placeholder: "",
|
|
393
476
|
type,
|
|
394
477
|
optionNew: true,
|
|
395
478
|
optionEdit: true,
|
|
@@ -401,8 +484,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
401
484
|
try {
|
|
402
485
|
const items = await this._createPromptPickItems(options, cts.token);
|
|
403
486
|
quickPick.items = items;
|
|
404
|
-
}
|
|
405
|
-
finally {
|
|
487
|
+
} finally {
|
|
406
488
|
quickPick.busy = false;
|
|
407
489
|
}
|
|
408
490
|
return ( new Promise(resolve => {
|
|
@@ -433,7 +515,7 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
433
515
|
resolve(true);
|
|
434
516
|
quickPick.hide();
|
|
435
517
|
}));
|
|
436
|
-
disposables.add(quickPick.onDidTriggerItemButton(async
|
|
518
|
+
disposables.add(quickPick.onDidTriggerItemButton(async e => {
|
|
437
519
|
const shouldRefresh = await this._handleButtonClick(quickPick, e, options);
|
|
438
520
|
if (!isClosed && shouldRefresh) {
|
|
439
521
|
await refreshItems();
|
|
@@ -453,16 +535,6 @@ let PromptFilePickers = class PromptFilePickers {
|
|
|
453
535
|
}));
|
|
454
536
|
}
|
|
455
537
|
};
|
|
456
|
-
PromptFilePickers = ( __decorate([
|
|
457
|
-
( __param(0, IQuickInputService)),
|
|
458
|
-
( __param(1, IOpenerService)),
|
|
459
|
-
( __param(2, IFileService)),
|
|
460
|
-
( __param(3, IDialogService)),
|
|
461
|
-
( __param(4, ICommandService)),
|
|
462
|
-
( __param(5, IInstantiationService)),
|
|
463
|
-
( __param(6, IPromptsService)),
|
|
464
|
-
( __param(7, ILabelService)),
|
|
465
|
-
( __param(8, IConfigurationService))
|
|
466
|
-
], PromptFilePickers));
|
|
538
|
+
PromptFilePickers = ( __decorate([( __param(0, IQuickInputService)), ( __param(1, IOpenerService)), ( __param(2, IFileService)), ( __param(3, IDialogService)), ( __param(4, ICommandService)), ( __param(5, IInstantiationService)), ( __param(6, IPromptsService)), ( __param(7, ILabelService)), ( __param(8, IConfigurationService)), ( __param(9, IProductService))], PromptFilePickers));
|
|
467
539
|
|
|
468
540
|
export { PromptFilePickers };
|