-
Notifications
You must be signed in to change notification settings - Fork 37k
Chat - implement session picker in the chat panel title #281051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a session picker in the chat panel title that allows users to switch between agent sessions. The implementation includes refactoring layout logic from contextview.ts into a new reusable layout.ts utility module, adding anchored quick pick support, and creating a custom action view item to display the session title as a clickable picker.
Key Changes:
- Extracted layout positioning logic into a new reusable module (
src/vs/base/common/layout.ts) with 1D and 2D layout functions - Added anchor support to quick input service for positioning relative to DOM elements
- Implemented a session picker action in the chat view title toolbar that opens an anchored quick pick
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/base/common/layout.ts |
New utility module containing extracted layout positioning algorithms for anchoring UI elements |
src/vs/base/browser/ui/contextview/contextview.ts |
Refactored to use the new layout utility and extracted getAnchorRect helper function |
src/vs/base/browser/ui/menu/menu.ts |
Updated to use the new layout API that returns an object with .position property |
src/vs/base/test/common/layout.test.ts |
Updated tests to verify the .position property from the new ILayoutResult return type |
src/vs/platform/quickinput/common/quickInput.ts |
Added anchor property to IPickOptions and IQuickInput interfaces for anchored positioning |
src/vs/platform/quickinput/browser/quickInputController.ts |
Implemented anchored positioning logic using the new layout utility when anchor is specified |
src/vs/workbench/contrib/chat/browser/chatViewTitleControl.ts |
Created custom action view item for displaying session title and implemented ChatViewTitleAgentPicker class |
src/vs/workbench/contrib/chat/browser/chatViewPane.ts |
Added pickSession() method to launch the session picker |
src/vs/workbench/contrib/chat/browser/actions/chatNewActions.ts |
Registered new action for picking agent sessions in the chat view title toolbar |
src/vs/workbench/contrib/chat/browser/actions/chatActions.ts |
Exported new action ID constant ACTION_ID_PICK_AGENT_SESSION |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
407d2de to
fc0f7f4
Compare
src/vs/workbench/contrib/chat/browser/actions/chatNewActions.ts
Outdated
Show resolved
Hide resolved
|
@lszomoru good start! I brought I think the changes to quick pick need review from @TylerLeonhardt |
lszomoru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bpasero, thank you very much for looking at the changes. I have pushed some changes to address your feedback. One issue that is still present is that even though I have isolated the picker, the title control still needs to expose the anchor element which is then used by the picker so that the picker can be anchored.
|
I will review after issue grooming unless you need it sooner |
bpasero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lszomoru please see my commits, by moving the action into the title, a lot of things become easier because no need to send around the HTMLElement where to show the picker.
I am seeing some slight layout issues with the picker in the title:
- it seems to increase the height of the title, making the icons jump a bit when title shows and goes
- it overflows out of the container, pushing away the sidebar:
Also it does not seem to close when clicked outside:
As for opening the session, can we borrow some of the logic we have when clicking on a session in the viewer? I mean this code:
vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.ts
Lines 43 to 45 in 89a511e
| if (session?.session.resource) { | |
| this.chatWidgetService.openSession(session.session.resource, ChatViewPaneTarget); | |
| } |
and how we open here:
vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts
Line 129 in 89a511e
| private async openAgentSession(e: IOpenEvent<IAgentSession | undefined>): Promise<void> { |
I would also suggest to support opening in background as editor as alt open behaviour from the picker.
Are we doing something to make the picker look a bit more polished?
Hence my original implementation :) |
|
@TylerLeonhardt, to make things easier to review, I have updated the PR to reduce its scope. The PR now only includes the changes to enable the |
TylerLeonhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug.mov
There's a weird behavior that happens when you attempt to drag the quick pick from the title bar. It causes the position of the command palette to get messed up.
Steps:
- open the chat panel title picker
- drag the picker down (it doesn't move, expected)
- with it still open, cmd+shift+p
- 🐛 the command palette is influenced by the location of the chat panel title quick pick
| /** | ||
| * An optional anchor for the quick input. | ||
| */ | ||
| anchor?: HTMLElement | { x: number; y: number }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being supported means that showing could happen first:
qp.show();
qp.anchor = foo;we need to update the anchor when it is set.
|
Generally, there's a lot of math here which worries me, but it's needed for the feature... I didn't test:
but since this is scoped to just the chat panel title, those don't apply I suppose |
Uh oh!
There was an error while loading. Please reload this page.