Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Adds ability to attach a specific diff hunk to chat directly from the hunk toolbar. When reviewing Copilot's code changes, users can now click the attach icon to add that exact change as context for follow-up comments.

Changes

  • IModifiedFileEntryChangeHunk interface: Added getModifiedLineRange() to expose the modified line range
  • DiffHunkWidget: Implements getModifiedLineRange() returning start/end line numbers from the underlying DetailedLineRangeMapping
  • AddHunkToChatAction: New action in ChatEditingEditorHunk menu with:
    • Codicon.attach icon (paperclip)
    • Order 20 (renders after diff toggle at order 10)
    • Attaches hunk range to chat widget and focuses input
  • Notebook hunks: Return undefined for line range (not applicable to cell-based changes)

Testing

  1. Have Copilot make edits to a file
  2. Hover over a diff hunk to reveal the toolbar
  3. Click the paperclip icon
  4. Verify the hunk's code range is attached to chat and input is focused
Original prompt

This section details on the original issue you should resolve

<issue_title>Ability to add Copilot-targeted comments on diffs</issue_title>
<issue_description>

Image

It would be helpful to the ability to add a comment to Copilot directly on a diff of a code change it applied. When there are many changes, it takes quite some effort to accurately explain what my comment is referring to. Say we had an icon on the toolbar next to the diff icon, it would make it very convenient to add comments targeting that particular piece of change. Copilot would then figure out how to pass it to the underlying LLM so that it has the necessary context to apply the change.</issue_description>

<agent_instructions>This should be an action in the ChatEditingEditorHunk-menu. Use the AttachSelectionToChatAction action, give it an icon (paperclip?) let it render after the diff action</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add ability to add Copilot-targeted comments on diffs Add action to attach diff hunk to chat Jan 16, 2026
Copilot AI requested a review from jrieken January 16, 2026 15:16
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.

Ability to add Copilot-targeted comments on diffs

2 participants