Chat view: introduce session title and back button (fix #277537)#278874
Chat view: introduce session title and back button (fix #277537)#278874
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds AI-generated chat session titles to VS Code's chat interface. When a chat session has a custom title (generated by AI or set manually), it is displayed in a secondary title bar below the main "Chat" title. The feature also includes a "Back to Chat" button to clear the current session and start fresh.
Key Changes
- Added a secondary title display mechanism that shows AI-generated titles or "Generating title..." state
- Integrated with the chat model's
setCustomTitleevent to update the title dynamically - Created a new menu location (
ChatSecondaryTitleMenuId) with a "Back to Chat" action
| if (!title) { | ||
| return undefined; | ||
| } | ||
| return title.startsWith('Chat: ') ? title : `Chat: ${title}`; |
There was a problem hiding this comment.
When does the chatmodel title start with 'Chat: '? Would that be a localized string, and should the 'Chat: ' in this method be localized?
There was a problem hiding this comment.
Oop yes this should totally be localized. Thank you for the catch.
Also, the "Chat: " prefix will be rendered when:
- The activity bar is in the Top, Bottom, Hidden positions
- The activity bar is in the Default position AND the Show Icons config set
- The activity bar is in any position AND there are multiple views being rendered in the chat view pane
The "Chat: " prefix will NOT be rendered when:
- The activity bar is in the Default position AND the Show Labels config set
The idea (in theory) was to include the "Chat: " prefix as a sort of method of way finding –– it becomes easier to contextualize what the custom titles represent. Without it could become confusing, especially in configurations like when the activity bar in the hidden position:
And then the idea for not including the Chat prefix when the activity bar is in the Default position and the Show Labels config set is due to redundant "Chat" text right next to each other. Looks weird/off.
There was a problem hiding this comment.
But if I'm understanding the code correctly, you're operating on the chatmodel title, not the view title, so I don't think there will be a case where the title already is prefixed with "chat:"
|
I don't think people will like the shift down when the title gets generated, but I assume things are all still in flux |
Yeah I'm guessing the same, but tis indeed in flux. Perhaps we can leave that one to the scream test and then adjust based on whatever feedback we get. |
bpasero
left a comment
There was a problem hiding this comment.
I am not at all an owner of the chatViewPane.ts file, but when I look at the before and after, I find the change makes the rather simple chatViewPane.ts quite complex. Is there any chance we could encapsulate this logic into a separate file that then chatViewPane.ts simply depends on, just to separate concerns?
Having looked at chatWidget.ts, I think there we really missed the opportunity to keep the file readable (not just for humans but also AI!). The smaller the file, I think the easier to make changes in the future.
As for the UX: its a bit jarring that a chat at first does not have a title and then only later gets a title, which in turn pushes the chat down. I wonder if we can invent some generic title that then later is replaced? I am also not 100% sure about using all uppercase, at least when the title is above the chat and not part of the view title.

Resolves #277537
Changes include:
Default position with labels (secondary title bar IS rendered WITHOUT chat prefix):
Default position with icons (secondary title bar IS rendered WITH chat prefix):
Top position (secondary title bar IS NOT rendered):
Bottom/Hidden positions (secondary title bar IS NOT rendered):
Default, Top, Bottom/Hidden positions with multiple views (secondary title bar IS NOT rendered):