Skip to content

Commit 7efc870

Browse files
authored
tweak labels and grouping of tools and tool sets (microsoft#249895)
1 parent 6a040cf commit 7efc870

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class ToolsContextPickerPick implements IChatContextPickerItem {
9696

9797
items.sort((a, b) => {
9898
let res = a.toolInfo.ordinal - b.toolInfo.ordinal;
99+
if (res === 0) {
100+
res = a.toolInfo.label.localeCompare(b.toolInfo.label);
101+
}
99102
if (res === 0) {
100103
res = a.label.localeCompare(b.label);
101104
}
@@ -105,7 +108,6 @@ class ToolsContextPickerPick implements IChatContextPickerItem {
105108
let lastGroupLabel: string | undefined;
106109
const picks: (IQuickPickSeparator | Pick)[] = [];
107110

108-
109111
for (const item of items) {
110112
if (lastGroupLabel !== item.toolInfo.label) {
111113
picks.push({ type: 'separator', label: item.toolInfo.label });

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function showToolsPicker(
164164
const key = ToolDataSource.toKey(toolSetOrTool.source);
165165
bucket = toolBuckets.get(key) ?? {
166166
type: 'item',
167-
label: toolSetOrTool.source.label,
167+
label: localize('ext', 'Extension: {0}', toolSetOrTool.source.label),
168168
ordinal: BucketOrdinal.Extension,
169169
picked: false,
170170
alwaysShow: true,

src/vs/workbench/contrib/chat/common/languageModelToolsService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { PromptElementJSON, stringifyPromptElementJSON } from './tools/promptTsx
2121
import { VSBuffer } from '../../../../base/common/buffer.js';
2222
import { derived, IObservable, IReader, ITransaction, ObservableSet } from '../../../../base/common/observable.js';
2323
import { Iterable } from '../../../../base/common/iterator.js';
24+
import { localize } from '../../../../nls.js';
2425

2526
export interface IToolData {
2627
id: string;
@@ -91,13 +92,13 @@ export namespace ToolDataSource {
9192

9293
export function classify(source: ToolDataSource): { readonly ordinal: number; readonly label: string } {
9394
if (source.type === 'internal') {
94-
return { ordinal: 3, label: 'Built-In' };
95+
return { ordinal: 1, label: localize('builtin', 'Built-In') };
9596
} else if (source.type === 'mcp') {
96-
return { ordinal: 1, label: 'MCP Servers' };
97+
return { ordinal: 2, label: localize('mcp', 'MCP Server: {0}', source.label) };
9798
} else if (source.type === 'user') {
98-
return { ordinal: 0, label: 'User Defined' };
99+
return { ordinal: 0, label: localize('user', 'User Defined') };
99100
} else {
100-
return { ordinal: 2, label: 'Extensions' };
101+
return { ordinal: 3, label: localize('ext', 'Extension: {0}', source.label) };
101102
}
102103
}
103104
}

0 commit comments

Comments
 (0)