Skip to content

Conversation

@meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Oct 24, 2025

fixes #271387
fixes #271388

demo.mov

Copilot AI review requested due to automatic review settings October 24, 2025 19:25
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

This PR adds terminal output dropdown functionality and implements command reveal on focus. It integrates terminal commands as attachments in chat, allowing users to attach terminal command output to chat conversations and navigate directly to commands in the terminal.

Key Changes:

  • Added support for terminal command attachments in chat with associated UI widgets and hover previews
  • Implemented command reveal functionality that scrolls to and highlights commands when terminal instances are focused
  • Extended terminal URI handling to support command IDs for direct navigation to specific commands

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
terminalCommand.ts Added unique ID and session tracking to terminal commands
capabilities.ts Extended command interfaces with ID and chat session fields
decorationAddon.ts Added "Attach To Chat" action for terminal commands
xtermTerminal.ts Updated constructor to accept resource parameter for URI-based navigation
terminalUri.ts Extended URI generation to include command IDs
terminalService.ts Implemented openResource method to reveal commands in terminals
chatVariableEntries.ts Added ITerminalVariableEntry type for terminal command attachments
chatAttachmentWidgets.ts Implemented TerminalCommandAttachmentWidget for displaying terminal commands
chatContext.ts Added TerminalContext class for terminal command context integration
chatTerminalToolProgressPart.ts Added collapsible output preview with show/hide functionality
Test files Updated test instantiations to match new constructor signatures

@meganrogge meganrogge requested a review from Tyriar October 24, 2025 19:26
@meganrogge meganrogge self-assigned this Oct 24, 2025
@meganrogge meganrogge added this to the October 2025 milestone Oct 24, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Tyriar
Tyriar previously requested changes Oct 24, 2025
@meganrogge meganrogge enabled auto-merge (squash) October 24, 2025 21:21
return;
}
const expanded = !this._outputContainer.classList.contains('expanded');
this._outputContainer.classList.toggle('expanded', expanded);
Copy link
Member

Choose a reason for hiding this comment

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

This was a previous command I had before checking out the branch and expanding:

Image

See the height is not correct and the output isn't either (it should just be 2). Note the actual terminal no longer exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Repro steps exactly? When I kill the associated terminal, both of those actions are removed for me

if (result.truncated) {
const note = document.createElement('div');
note.classList.add('chat-terminal-output-info');
note.textContent = localize('chat.terminalOutputTruncated', 'Output truncated to first {0} characters.', MAX_TERMINAL_OUTPUT_PREVIEW_LENGTH);
Copy link
Member

Choose a reason for hiding this comment

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

Current:

Image

Don't need to do this in this PR, but one of the benefits of using xterm is better rendering of the text:

Image

We also won't end up hitting problems when too much content is added like this and performance problems when scrolling won't be a problem since scrolling is virtualized.


private async _collectOutput(terminalInstance: ITerminalInstance): Promise<{ text: string; truncated: boolean }> {
this._attachedCommand ??= this._resolveCommand(terminalInstance);
let text = this._attachedCommand?.getOutput() ?? '';
Copy link
Member

Choose a reason for hiding this comment

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

TerminalCommand knows about xterm and the markers, this should use getContentsAsHtml internally using that information

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.

Showing completed terminal tool output in chat view Pop out button should show the terminal command via addressable URI

3 participants