Skip to content

Commit 79bddae

Browse files
authored
fix: avoid highlights matching on codicons in Attach Context picker (microsoft#223562)
1 parent 7205ba0 commit 79bddae

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class AttachContextAction extends Action2 {
201201
value: pick.value,
202202
name: `${typeof pick.value === 'string' && pick.value.startsWith('#') ? pick.value.slice(1) : ''}${selection}`,
203203
// Apply the original icon with the new name
204-
fullName: `${pick.icon ? `$(${pick.icon.id}) ` : ''}${selection}`
204+
fullName: selection
205205
});
206206
} else if ('symbol' in pick && pick.symbol) {
207207
// Symbol
@@ -278,9 +278,10 @@ class AttachContextAction extends Action2 {
278278
for (const variable of chatVariablesService.getVariables(widget.location)) {
279279
if (variable.fullName && (!variable.isSlow || slowSupported)) {
280280
quickPickItems.push({
281-
label: `${variable.icon ? `$(${variable.icon.id}) ` : ''}${variable.fullName}`,
281+
label: variable.fullName,
282282
name: variable.name,
283283
id: variable.id,
284+
iconClass: variable.icon ? ThemeIcon.asClassName(variable.icon) : undefined,
284285
icon: variable.icon
285286
});
286287
}
@@ -293,10 +294,11 @@ class AttachContextAction extends Action2 {
293294
for (const variable of completions) {
294295
if (variable.fullName) {
295296
quickPickItems.push({
296-
label: `${variable.icon ? `$(${variable.icon.id}) ` : ''}${variable.fullName}`,
297+
label: variable.fullName,
297298
id: variable.id,
298299
command: variable.command,
299300
icon: variable.icon,
301+
iconClass: variable.icon ? ThemeIcon.asClassName(variable.icon) : undefined,
300302
value: variable.value,
301303
isDynamic: true,
302304
name: variable.name
@@ -324,8 +326,9 @@ class AttachContextAction extends Action2 {
324326
}
325327

326328
quickPickItems.push({
327-
label: localize('chatContext.symbol', '{0} Symbol...', `$(${Codicon.symbolField.id})`),
329+
label: localize('chatContext.symbol', 'Symbol...'),
328330
icon: ThemeIcon.fromId(Codicon.symbolField.id),
331+
iconClass: ThemeIcon.asClassName(Codicon.symbolField),
329332
prefix: SymbolsQuickAccessProvider.PREFIX
330333
});
331334

@@ -347,6 +350,7 @@ class AttachContextAction extends Action2 {
347350
}
348351

349352
private _show(quickInputService: IQuickInputService, commandService: ICommandService, widget: IChatWidget, quickPickItems: (IChatContextQuickPickItem | QuickPickItem)[], query: string = '') {
353+
350354
quickInputService.quickAccess.show(query, {
351355
enabledProviderPrefixes: [
352356
AnythingQuickAccessProvider.PREFIX,

src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export class ChatAttachmentsContentPart extends Disposable {
8888
}));
8989
} else {
9090
const attachmentLabel = attachment.fullName ?? attachment.name;
91-
label.setLabel(attachmentLabel, correspondingContentReference?.options?.status?.description);
91+
const withIcon = attachment.icon?.id ? `$(${attachment.icon.id}) ${attachmentLabel}` : attachmentLabel;
92+
label.setLabel(withIcon, correspondingContentReference?.options?.status?.description);
9293

9394
widget.ariaLabel = localize('chat.attachment3', "Attached context: {0}.", attachment.name);
9495
widget.tabIndex = 0;

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
524524
widget.tabIndex = 0;
525525
} else {
526526
const attachmentLabel = attachment.fullName ?? attachment.name;
527-
label.setLabel(attachmentLabel, undefined);
527+
const withIcon = attachment.icon?.id ? `$(${attachment.icon.id}) ${attachmentLabel}` : attachmentLabel;
528+
label.setLabel(withIcon, undefined);
528529

529530
widget.ariaLabel = localize('chat.attachment', "Attached context, {0}", attachment.name);
530531
widget.tabIndex = 0;

0 commit comments

Comments
 (0)