Skip to content

Preserve selection context when "Ask in Chat" from inline chat#304734

Merged
jrieken merged 2 commits intomainfrom
copilot/fix-inline-chat-context-loss
Mar 25, 2026
Merged

Preserve selection context when "Ask in Chat" from inline chat#304734
jrieken merged 2 commits intomainfrom
copilot/fix-inline-chat-context-loss

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

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.

  • Pass session.uri and session.initialSelection from continueInPanelChat through to askInPanelChat
  • Attach the file+selection to the widget's attachment model before calling acceptInput, matching the pattern used in QueueInChatAction

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI linked an issue Mar 25, 2026 that may be closed by this pull request
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 25, 2026
…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
Copilot AI requested a review from jrieken March 25, 2026 12:09
@jrieken jrieken marked this pull request as ready for review March 25, 2026 13:49
Copilot AI review requested due to automatic review settings March 25, 2026 13:49
@jrieken jrieken enabled auto-merge March 25, 2026 13:49
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

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 askInPanelChat to accept an optional { uri, selection } file context.
  • Pass session.uri and session.initialSelection from continueInPanelChat into askInPanelChat.
  • Attach the file+selection to the panel chat widget’s attachmentModel prior to calling acceptInput.

@jrieken jrieken merged commit 7d7fff2 into main Mar 25, 2026
42 of 44 checks passed
@jrieken jrieken deleted the copilot/fix-inline-chat-context-loss branch March 25, 2026 14:48
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.

Ask in Chat from inline affordance drops context

4 participants