Preserve selection context when "Ask in Chat" from inline chat#304734
Merged
Preserve selection context when "Ask in Chat" from inline chat#304734
Conversation
…chat Pass the session's file URI and initial selection to the panel chat widget when continuing an inline chat session in panel chat. The selection is added as a file attachment before the request is sent, ensuring the panel chat has the same context as the original inline chat session. Fixes #249226 Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/d8bafe8b-3607-4025-864e-0d47bd376f9c
Copilot
AI
changed the title
[WIP] Fix inline chat selection context issue
Preserve selection context when "Ask in Chat" from inline chat
Mar 25, 2026
jrieken
approved these changes
Mar 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes loss of editor selection context when using “Ask in Chat” from an inline chat termination prompt by carrying the originating file URI + initial selection through to panel chat and attaching it before submitting the request.
Changes:
- Extend
askInPanelChatto accept an optional{ uri, selection }file context. - Pass
session.uriandsession.initialSelectionfromcontinueInPanelChatintoaskInPanelChat. - Attach the file+selection to the panel chat widget’s
attachmentModelprior to callingacceptInput.
joaomoreno
approved these changes
Mar 25, 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.
Clicking "Ask in Chat" from the inline chat termination prompt sends the original prompt to panel chat but drops the file selection that was active when the inline chat session started.
session.uriandsession.initialSelectionfromcontinueInPanelChatthrough toaskInPanelChatacceptInput, matching the pattern used inQueueInChatAction📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.