Skip to content

Commit 4c202ca

Browse files
committed
Fixes
1 parent f35de7a commit 4c202ca

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ export function registerChatActions() {
580580

581581
const ckey = contextKeyService.createKey('chatSessionType', session.providerType);
582582
const actions = menuService.getMenuActions(MenuId.ChatSessionsMenu, contextKeyService);
583-
const menuActions = getContextMenuActions(actions, 'navigation');
583+
const menuActions = getContextMenuActions(actions, 'inline');
584584
ckey.reset();
585585

586586
// Use primary actions if available, otherwise fall back to secondary actions

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import { IContextKeyService, ContextKeyExpr } from '../../../../platform/context
2020
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
2121
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
2222
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
23-
import { IMenuService } from '../../../../platform/actions/common/actions.js';
23+
import { IMenuService, MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';
2424
import { getActionBarActions } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';
25-
import { DisposableStore } from '../../../../base/common/lifecycle.js';
25+
import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
2626
import { ViewPaneContainer } from '../../../browser/parts/views/viewPaneContainer.js';
2727
import { ViewPane, IViewPaneOptions } from '../../../browser/parts/views/viewPane.js';
2828
import { Extensions, IViewContainersRegistry, IViewDescriptorService, ViewContainerLocation, IViewsRegistry, IViewDescriptor } from '../../../common/views.js';
@@ -37,7 +37,6 @@ import { CancellationToken } from '../../../../base/common/cancellation.js';
3737
import { FuzzyScore } from '../../../../base/common/filters.js';
3838
import { ResourceLabels, IResourceLabel } from '../../../browser/labels.js';
3939
import { ActionBar } from '../../../../base/browser/ui/actionbar/actionbar.js';
40-
import { Disposable } from '../../../../base/common/lifecycle.js';
4140
import { append, $, getActiveWindow, clearNode } from '../../../../base/browser/dom.js';
4241
import { URI } from '../../../../base/common/uri.js';
4342
import { IEditorGroupsService, IEditorGroup } from '../../../services/editor/common/editorGroupsService.js';
@@ -49,7 +48,6 @@ import { EditorInput } from '../../../common/editor/editorInput.js';
4948
import { ChatEditorInput } from './chatEditorInput.js';
5049
import { IChatWidgetService, IChatWidget } from './chat.js';
5150
import { ChatAgentLocation, ChatConfiguration } from '../common/constants.js';
52-
import { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';
5351
import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
5452
import { IWorkbenchContribution } from '../../../common/contributions.js';
5553
import { IViewsService } from '../../../services/views/common/viewsService.js';
@@ -62,15 +60,11 @@ export const VIEWLET_ID = 'workbench.view.chat.sessions';
6260

6361
// Helper function to create context overlay for session items
6462
function getSessionItemContextOverlay(session: IChatSessionItem, provider?: IChatSessionItemProvider): [string, any][] {
65-
const overlay: [string, any][] = [
66-
[ChatContextKeys.sessionId.key, session.id],
67-
[ChatContextKeys.sessionLabel.key, session.label],
68-
];
69-
63+
const overlay: [string, any][] = [];
7064
if (provider) {
7165
overlay.push([ChatContextKeys.sessionType.key, provider.chatSessionType]);
7266
}
73-
67+
7468
return overlay;
7569
}
7670

@@ -636,7 +630,8 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
636630
renderTemplate(container: HTMLElement): ISessionTemplateData {
637631
const element = append(container, $('.chat-session-item'));
638632
const resourceLabel = this.labels.create(element, { supportHighlights: true });
639-
const actionBar = new ActionBar(container);
633+
const actionsContainer = append(resourceLabel.element, $('.actions'));
634+
const actionBar = new ActionBar(actionsContainer);
640635
const elementDisposable = new DisposableStore();
641636

642637
return {
@@ -650,7 +645,7 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
650645
renderElement(element: ITreeNode<IChatSessionItem, FuzzyScore>, index: number, templateData: ISessionTemplateData): void {
651646
const session = element.element;
652647
const sessionWithProvider = session as IChatSessionItem & { provider: IChatSessionItemProvider };
653-
648+
654649
// Clear previous element disposables
655650
templateData.elementDisposable.clear();
656651

@@ -691,7 +686,7 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
691686

692687
// Create context overlay for this specific session item
693688
const contextOverlay = getSessionItemContextOverlay(session, sessionWithProvider.provider);
694-
689+
695690
const contextKeyService = this.contextKeyService.createOverlay(contextOverlay);
696691

697692
// Create menu for this session item
@@ -703,12 +698,15 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
703698
const setupActionBar = () => {
704699
templateData.actionBar.clear();
705700

701+
const actions = menu.getActions({ arg: session, shouldForwardArgs: true });
702+
706703
const { primary } = getActionBarActions(
707-
menu.getActions({ arg: session, shouldForwardArgs: true }),
708-
'inline'
704+
actions,
705+
'inline',
709706
);
707+
710708
templateData.actionBar.push(primary, { icon: true, label: false });
711-
709+
712710
// Set context for the action bar
713711
templateData.actionBar.context = session;
714712
};

src/vs/workbench/contrib/chat/browser/media/chatSessions.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,15 @@
4040
.chat-sessions-message .no-sessions-message .codicon {
4141
opacity: 0.7;
4242
}
43+
44+
/* Hide action bar actions by default */
45+
.chat-sessions-tree .chat-session-item .actions .action-label {
46+
display: none;
47+
}
48+
49+
/* Show action bar actions on hover and focus */
50+
.chat-sessions-tree .chat-session-item:hover .actions .action-label,
51+
.chat-sessions-tree .monaco-list-row.focused .chat-session-item .actions .action-label,
52+
.chat-sessions-tree .monaco-list-row.selected .chat-session-item .actions .action-label {
53+
display: block;
54+
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ export namespace ChatContextKeys {
100100

101101
export const panelLocation = new RawContextKey<ViewContainerLocation>('chatPanelLocation', undefined, { type: 'number', description: localize('chatPanelLocation', "The location of the chat panel.") });
102102

103-
export const sessionId = new RawContextKey<string>('chatSessionId', '', { type: 'string', description: localize('chatSessionId', "The ID of the current chat session item.") });
104-
export const sessionLabel = new RawContextKey<string>('chatSessionLabel', '', { type: 'string', description: localize('chatSessionLabel', "The label of the current chat session item.") });
105103
export const sessionType = new RawContextKey<string>('chatSessionType', '', { type: 'string', description: localize('chatSessionType', "The type of the current chat session item.") });
106104
}
107105

0 commit comments

Comments
 (0)