Skip to content

[VS Code] Allow inserting a generated code snippet into editor

User problem to solve

As a developer using Duo Chat, I want a seamless way to integrate generated code snippets into my editor without manual copy-pasting, so I can maintain my workflow and focus.

MVC Proposal

  1. Provide a simple Insert button next to each generated code block.
  2. Insert button is to the left of the Copy button.
  3. Insert code block at the current cursor position in the active editor.
  4. If there is not an active editor when the user clicks Insert, display a tooltip: "No active editor. Open a file to insert code."
    1. Insert button is in a disabled state and grayed out.
  5. If insert is successful, show an in-IDE notification in the bottom right of the editor: "Code inserted successfully"
  6. If insert is not successful, show an in-IDE notification in the bottom right of the editor: "Failed to insert code. Please try again."

GitLab UI

gitlab-ui!4357 (merged)

Edited by Dasha Adushkina