Sessions: Add session count display to agent session sections (#303514)

Add session count display to agent session sections

Co-authored-by: mrleemurray <mrleemurray@users.noreply.github.com>
This commit is contained in:
Lee Murray
2026-03-20 14:58:27 +00:00
committed by GitHub
parent d5a7770451
commit c8fda5b0f6
2 changed files with 17 additions and 1 deletions

View File

@@ -573,6 +573,7 @@ export function toStatusLabel(status: AgentSessionStatus): string {
interface IAgentSessionSectionTemplate {
readonly container: HTMLElement;
readonly label: HTMLSpanElement;
readonly count: HTMLSpanElement;
readonly toolbar: MenuWorkbenchToolBar;
readonly contextKeyService: IContextKeyService;
readonly disposables: IDisposable;
@@ -596,6 +597,7 @@ export class AgentSessionSectionRenderer implements ICompressibleTreeRenderer<IA
'div.agent-session-section@container',
[
h('span.agent-session-section-label@label'),
h('span.agent-session-section-count@count'),
h('div.agent-session-section-toolbar@toolbar')
]
);
@@ -611,6 +613,7 @@ export class AgentSessionSectionRenderer implements ICompressibleTreeRenderer<IA
return {
container: elements.container,
label: elements.label,
count: elements.count,
toolbar,
contextKeyService,
disposables
@@ -622,6 +625,9 @@ export class AgentSessionSectionRenderer implements ICompressibleTreeRenderer<IA
// Label
template.label.textContent = element.element.label;
// Count
template.count.textContent = String(element.element.sessions.length);
// Toolbar
ChatContextKeys.agentSessionSection.bindTo(template.contextKeyService).set(element.element.section);
template.toolbar.context = element.element;
@@ -691,7 +697,7 @@ export class AgentSessionsAccessibilityProvider implements IListAccessibilityPro
getAriaLabel(element: AgentSessionListItem): string | null {
if (isAgentSessionSection(element)) {
return localize('agentSessionSectionAriaLabel', "{0} sessions section", element.label);
return localize('agentSessionSectionAriaLabel', "{0} sessions section, {1} sessions", element.label, element.sessions.length);
}
return localize('agentSessionItemAriaLabel', "{0} session {1} ({2}), created {3}", element.providerLabel, element.label, toStatusLabel(element.status), new Date(element.timing.created).toLocaleString());

View File

@@ -318,6 +318,11 @@
flex: 1;
}
.agent-session-section-count {
opacity: 0.7;
margin-right: 4px;
}
.agent-session-section-toolbar {
/* for the absolute positioning of the toolbar below */
position: relative;
@@ -332,6 +337,11 @@
}
}
.monaco-list-row:hover .agent-session-section .agent-session-section-count,
.monaco-list-row.focused:not(.selected) .agent-session-section .agent-session-section-count {
display: none;
}
.monaco-list-row:hover .agent-session-section .agent-session-section-toolbar,
.monaco-list-row.focused:not(.selected) .agent-session-section .agent-session-section-toolbar {
width: 22px;