Skip to content

Conversation

@lszomoru
Copy link
Member

@lszomoru lszomoru commented Dec 3, 2025

  • Anchored quick pick
  • Adopt anchored quick pick in the session picker

Copilot AI review requested due to automatic review settings December 3, 2025 20:33
@lszomoru lszomoru self-assigned this Dec 3, 2025
@lszomoru lszomoru requested a review from bpasero December 3, 2025 20:33
Copy link
Contributor

Copilot AI left a 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

joaomoreno
joaomoreno previously approved these changes Dec 4, 2025
@bpasero
Copy link
Member

bpasero commented Dec 10, 2025

@lszomoru good start! I brought main back in and left some comments. On a high level I also wonder if the sessions picker could actually look a bit more like the actual session cards (i.e. 2 lines, with title and description) so that the representation is not so different?

I think the changes to quick pick need review from @TylerLeonhardt

Copy link
Member Author

@lszomoru lszomoru left a 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.

@lszomoru lszomoru requested a review from bpasero December 11, 2025 15:01
@TylerLeonhardt
Copy link
Member

I will review after issue grooming unless you need it sooner

Copy link
Member

@bpasero bpasero left a 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:
Image

Also it does not seem to close when clicked outside:

Image

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:

if (session?.session.resource) {
this.chatWidgetService.openSession(session.session.resource, ChatViewPaneTarget);
}

and how we open here:

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?

@lszomoru
Copy link
Member Author

@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.

Hence my original implementation :)

@lszomoru lszomoru requested a review from bpasero December 12, 2025 09:37
@lszomoru
Copy link
Member Author

@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 anchor option for the quick input widget and the adoption of this new option for the agent sessions picker. Please let me know if you have any questions or concerns. Thanks!

@lszomoru lszomoru marked this pull request as ready for review December 12, 2025 09:42
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a 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 };
Copy link
Member

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.

@TylerLeonhardt
Copy link
Member

Generally, there's a lot of math here which worries me, but it's needed for the feature... I didn't test:

  • what happens when the anchor is by the edge of the screen
  • how wonky does this look when the anchor is close to the bottom of the screen (I want the input on the bottom, but I know this PR doesn't do that)

but since this is scoped to just the chat panel title, those don't apply I suppose

@bpasero bpasero removed their request for review December 18, 2025 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants