Skip to content

Implement paste threshold adjustment and "Insert in Prompt" feature - #331978

Merged
Logan Ramos (lramos15) merged 5 commits into
mainfrom
lramos15/agents/vscode-issue-331852-proposal
Aug 21, 2026
Merged

Logan Ramos (lramos15) merged 5 commits into
mainfrom
lramos15/agents/vscode-issue-331852-proposal

Conversation

@lramos15

Copy link
Copy Markdown
Member

This pull request implements the proposed changes to improve the paste functionality in the chat input based on the feedback from issue #331852. The following key changes have been made:

  • Threshold Adjustment: Increased the pastedTextArtifactDefaultMinLength from 1000 to 10000, and added a new minimum line requirement of 10. This change aims to reduce false positives for long URLs and dictated sentences that should remain inline.

  • Single Setting: Introduced a new setting chat.pasteAsAttachmentThreshold in the Settings UI, which allows users to configure the paste threshold without the need for separate auto or never options.

  • "Insert in Prompt" Feature: Added the ability to right-click on a pasted-text pill to replace its inline reference with the actual text, allowing users to drop the attachment easily. This feature has been implemented for both the main chat input and the Agents window.

  • Plain-text Paste Keybinding: Bound the existing editor.action.pasteAsText command to Ctrl+Shift+V (or Cmd+Shift+V on Mac) when the chat input has focus, ensuring that plain text can be pasted without interference from chat providers.

  • Test Coverage: Updated and added tests to ensure the new functionality works as intended, with all tests passing successfully.

The proposal to add a one-time inline hint for auto-attachments has been dropped based on feedback, as it was deemed unnecessary with the new threshold and insert feature.

Please review the changes and provide feedback.

Copilot AI balanced review requested due to automatic review settings August 21, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves chat paste behavior by reducing unwanted attachments and allowing pasted-text attachments to be restored inline.

Changes:

  • Adds configurable character and line thresholds.
  • Adds “Insert in Prompt” for standard Chat and Agents.
  • Adds a plain-text paste keybinding and tests.
Show a summary per file
File Description
chatPasteProviders.test.ts Tests threshold behavior.
constants.ts Defines the new setting.
chatPasteProviders.ts Applies configurable paste thresholds.
chatInputPart.ts Restores attachments into prompts.
chat.shared.contribution.ts Registers the threshold setting.
chatAttachmentWidgets.ts Adds the attachment context-menu action.
chatCopyActions.ts Registers plain-text paste keybinding.
newChatInputPaste.test.ts Tests Agents paste lifecycle.
newChatInput.ts Connects the Agents insertion handler.
newChatContextAttachments.ts Adds the Agents context-menu action.
agentHostInputCompletions.ts Implements Agents text restoration.

Review details

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 11/11 changed files
  • Comments generated: 6
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Base: 6a6f4648 Current: a28c93a3

No screenshot changes.

- Remove unused code from agentHostInputCompletions and newChatContextAttachments.
- Optimize chatInputPart and chatAttachmentWidgets for better efficiency.
- Update tests for newChatInputPaste to reflect changes in functionality.
@lramos15
Logan Ramos (lramos15) marked this pull request as ready for review August 21, 2026 16:27
Logan Ramos (lramos15) and others added 2 commits August 21, 2026 12:27
The image section called `artifactLocation`, but the helper is named
`sessionArtifactLocation`, as the five other call sites use. This broke
compilation and threw `ReferenceError` from the two Session Artifacts
tests that build an image section.

Introduced by #331946 and present on main.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b8277a07-8be3-4c23-a886-ba92a9c4cac0
@lramos15
Logan Ramos (lramos15) enabled auto-merge (squash) August 21, 2026 16:50
@lramos15
Logan Ramos (lramos15) merged commit e1801a0 into main Aug 21, 2026
27 checks passed
@lramos15
Logan Ramos (lramos15) deleted the lramos15/agents/vscode-issue-331852-proposal branch August 21, 2026 16:58
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 21, 2026
Abdullah Atrash (abdullahatrash) added a commit to abdullahatrash/flowleap-agent-v2 that referenced this pull request Sep 20, 2026
* port(chat-ui): preserve #file reference when editing text before it (#394)

Upstream d750fe2 (microsoft#333965), applied clean with its tests.
Typing before an existing #file attachment silently deleted the attachment.
Adds touchesReference and findReferenceRangeForNonOverlappingEdit.

* port(chat-ui): highlight generic tool output by content type (#394)

Upstream 63acf08 (microsoft#333923). chatInputOutputMarkdownProgressPart.ts
applied clean; the chatToolOutputContentSubPart.ts hunk was hand-applied because the
fork's adjacent-code-part loop predates upstream's refactor. The agentHost
stateToProgressAdapter.ts hunk and its test are dropped (Agent Host only).
Our patent tools return large JSON payloads into exactly this part.

* port(chat-ui): fix IME handling in the chat find widget (#394)

Upstream b9861ad (microsoft#332950), applied clean with its tests.
Composition input (CJK) broke search in the transcript find widget.

* port(chat-ui): fix transcript Find keybindings (#394)

Upstream cefc831 (microsoft#333135). chatFindActions.ts, chatFindWidget.ts,
chatListWidget.ts and the find tests applied clean; the chatListWidget.test.ts hunk was
hand-applied because that test file is diverged. Enter/Escape/F3 inside the transcript
find widget went to the generic tree find instead of chat Find.

* port(chat-ui): configurable paste-to-attachment threshold and Insert in Prompt (#394)

Upstream e1801a0 (microsoft#331978). chatPasteProviders.ts, chatCopyActions.ts,
constants.ts, chatAccessibilityHelp.ts, the chat.shared.contribution.ts configuration
registration and the paste tests all applied clean. The src/vs/sessions hunks are left
out: the fork has no caller of createPastedTextArtifact there, and sessions files belong
to the deferred wave W.

* port(chat-ui): remove the line requirement for paste attachments (#394)

Upstream 36053db (microsoft#335100), hand-applied: the fork's
chatPasteProviders.ts lacks the GitHub-URL pattern that surrounds the hunk, and its
chatAccessibilityHelp.ts and both test files are behind upstream's base. A short paste
now becomes an attachment on character count alone, so pasting a single-line claim
works like pasting a multi-line one.

* port(chat-ui): reuse text buffers for checkpoint replay (#394)

Upstream 903d0d0 (microsoft#336095), applied clean with its tests.
Checkpoint restore rebuilt a text model per replayed edit.

* port(chat-ui): constrain symbol tools to the active workspace (#394)

Upstream d8cfdc7 (microsoft#333144), applied clean with its tests.
renameTool and usagesTool no longer reach outside the active workspace folder.
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants