Reduce size of IChatSessionContext#300266
Merged
mjbvz merged 1 commit intomicrosoft:mainfrom Mar 9, 2026
Merged
Conversation
All of this info is already on the chatSessionResource
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces IChatSessionContext to only carry the session resource (and initial options), deriving chatSessionType and “untitled-ness” from the chatSessionResource so there’s a single source of truth.
Changes:
- Shrinks
IChatSessionContextby removingchatSessionTypeandisUntitled. - Adds
isUntitledChatSession(URI)and replaces ad-hoc untitled checks with the helper. - Updates call sites to derive session type via
getChatSessionType(resource)(and untitled status viaisUntitledChatSession(resource)).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/model/chatUri.ts | Adds isUntitledChatSession helper to centralize untitled detection. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Stops populating removed IChatSessionContext fields when setting contributed session context. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Removes chatSessionType and isUntitled from IChatSessionContext. |
| src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts | Derives session type from sessionResource via getChatSessionType. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Replaces ctx.chatSessionType usage with getChatSessionType(ctx.chatSessionResource) throughout. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Uses isUntitledChatSession when deciding whether to synthesize a new untitled session with options. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.ts | Replaces 'local' literal with localChatSessionType for the debug display label logic. |
| src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts | Replaces 'local' literal with localChatSessionType in context key expressions for menus. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Computes isUntitled/chatSessionType from chatSessionResource instead of reading them from IChatSessionContext. |
| src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts | Uses isUntitledChatSession to set activeSessionItem.isUntitled. |
roblourens
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All of this info is already on the chatSessionResource. I want to have a single source of truth that can't get out of sync