Skip to content

Commit 93d270f

Browse files
authored
use icons instead of bullet points in thinking (#285394)
1 parent d51f2a7 commit 93d270f

File tree

2 files changed

+63
-14
lines changed

2 files changed

+63
-14
lines changed

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

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,46 @@ function extractTextFromPart(content: IChatThinkingPart): string {
3131
return raw.trim();
3232
}
3333

34+
function getToolInvocationIcon(toolId: string): ThemeIcon {
35+
const lowerToolId = toolId.toLowerCase();
36+
37+
if (
38+
lowerToolId.includes('search') ||
39+
lowerToolId.includes('grep') ||
40+
lowerToolId.includes('find') ||
41+
lowerToolId.includes('list') ||
42+
lowerToolId.includes('semantic') ||
43+
lowerToolId.includes('changes') ||
44+
lowerToolId.includes('codebase')
45+
) {
46+
return Codicon.search;
47+
}
48+
49+
if (
50+
lowerToolId.includes('read') ||
51+
lowerToolId.includes('get_file') ||
52+
lowerToolId.includes('problems')
53+
) {
54+
return Codicon.eye;
55+
}
56+
57+
if (
58+
lowerToolId.includes('edit') ||
59+
lowerToolId.includes('create')
60+
) {
61+
return Codicon.pencil;
62+
}
63+
64+
// default to generic tool icon
65+
return Codicon.tools;
66+
}
67+
68+
function createThinkingIcon(icon: ThemeIcon): HTMLElement {
69+
const iconElement = $('span.chat-thinking-icon');
70+
iconElement.classList.add(...ThemeIcon.asClassNameArray(icon));
71+
return iconElement;
72+
}
73+
3474
function extractTitleFromThinkingContent(content: string): string | undefined {
3575
const headerMatch = content.match(/^\*\*([^*]+)\*\*/);
3676
return headerMatch ? headerMatch[1] : undefined;
@@ -198,6 +238,7 @@ export class ChatThinkingContentPart extends ChatCollapsibleContentPart implemen
198238
this.markdownResult = rendered;
199239
if (!target) {
200240
clearNode(this.textContainer);
241+
this.textContainer.appendChild(createThinkingIcon(Codicon.comment));
201242
this.textContainer.appendChild(rendered.element);
202243
}
203244
}
@@ -432,7 +473,13 @@ export class ChatThinkingContentPart extends ChatCollapsibleContentPart implemen
432473
}
433474

434475
public appendItem(content: HTMLElement, toolInvocationId?: string, toolInvocation?: IChatToolInvocation | IChatToolInvocationSerialized): void {
435-
this.wrapper.appendChild(content);
476+
const itemWrapper = $('.chat-thinking-tool-wrapper');
477+
const icon = toolInvocationId ? getToolInvocationIcon(toolInvocationId) : Codicon.tools;
478+
const iconElement = createThinkingIcon(icon);
479+
itemWrapper.appendChild(iconElement);
480+
itemWrapper.appendChild(content);
481+
482+
this.wrapper.appendChild(itemWrapper);
436483
if (toolInvocationId) {
437484
this.toolInvocationCount++;
438485
let toolCallLabel: string;

src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatThinkingContent.css

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
margin: 0 0 2px 6px;
4444
}
4545

46-
.codicon {
46+
.codicon:not(.chat-thinking-icon) {
4747
display: none;
4848
}
4949
}
@@ -68,8 +68,9 @@
6868
}
6969

7070
/* chain of thought lines */
71-
.chat-tool-invocation-part,
71+
.chat-thinking-tool-wrapper,
7272
.chat-thinking-item.markdown-content {
73+
position: relative;
7374

7475
&::before {
7576
content: '';
@@ -80,31 +81,32 @@
8081
width: 1px;
8182
border-radius: 0;
8283
background-color: var(--vscode-chat-requestBorder);
83-
mask-image: linear-gradient(to bottom, #000 0 9px, transparent 9px 21px, #000 21px 100%);
84+
mask-image: linear-gradient(to bottom, #000 0 5px, transparent 5px 25px, #000 24px 100%);
8485
}
8586

8687
&:first-child::before {
87-
mask-image: linear-gradient(to bottom, transparent 0 21px, #000 21px 100%);
88+
mask-image: linear-gradient(to bottom, transparent 0 25px, #000 25px 100%);
8889
}
8990

9091
&:last-child::before {
91-
mask-image: linear-gradient(to bottom, #000 0 9px, transparent 9px 100%);
92+
mask-image: linear-gradient(to bottom, #000 0 5px, transparent 5px 100%);
9293
}
9394

9495
&:only-child::before {
9596
background: none;
9697
mask-image: none;
9798
}
9899

99-
&::after {
100-
content: '';
100+
> .chat-thinking-icon {
101101
position: absolute;
102-
left: 8px;
103-
top: 12px;
104-
width: 6px;
105-
height: 6px;
106-
border-radius: 50%;
107-
background-color: var(--vscode-chat-requestBorder);
102+
left: 5px;
103+
top: 9px;
104+
width: 12px;
105+
height: 12px;
106+
font-size: 12px;
107+
line-height: 12px;
108+
text-align: center;
109+
color: var(--vscode-descriptionForeground);
108110
}
109111

110112
}

0 commit comments

Comments
 (0)