-
Notifications
You must be signed in to change notification settings - Fork 37.2k
render xterm instead of html for the chat terminal output #278684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 refactors terminal command output rendering to use xterm's VT sequences instead of HTML serialization. The change introduces a new DetachedTerminalCommandMirror class that creates a detached terminal instance to render command output using VT sequences, replacing the previous HTML-based approach.
Key changes:
- Introduces
DetachedTerminalCommandMirrorclass to handle VT-based terminal rendering - Adds
getRangeAsVT()method toXtermTerminalfor extracting VT sequences between markers - Removes fallback output parameter and HTML serialization logic from
TerminalCommandArtifactCollector - Simplifies
ChatTerminalToolOutputSectionby removing HTML sanitization and static output rendering
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| chatTerminalCommandMirror.ts | New class that creates detached terminal instances to render command output using VT sequences |
| xtermTerminal.ts | Adds getRangeAsVT() method to extract VT sequences between markers using the serialize addon |
| terminal.ts | Adds getRangeAsVT() interface method and makes raw property available on IDetachedXtermTerminal |
| terminalCommandArtifactCollector.ts | Simplifies capture logic by removing HTML serialization and fallback output handling |
| runInTerminalTool.ts | Updates calls to remove fallback output parameter |
| chatTerminalToolProgressPart.ts | Major refactor to use VT rendering instead of HTML, removes sanitization logic |
| chatTerminalToolProgressPart.css | Updates styles for terminal container and adds styling for empty state |
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
3cdd138 to
0d2609f
Compare
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/chatContentParts/media/chatTerminalToolProgressPart.css
Outdated
Show resolved
Hide resolved
| * Mirrors a terminal command's output into a detached terminal instance. | ||
| * Used in the chat terminal tool progress part to show command output for example. | ||
| */ | ||
| export class DetachedTerminalCommandMirror extends Disposable implements IDetachedTerminalCommandMirror { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want some unit tests for this, they'll be a lot more important in the next PR though. Basically they should write stuff to XtermTerminal, pass in the command and verify they both serialize to the same text. For the streaming PR we want it to check as things are progressing.
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
...ch/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts
Outdated
Show resolved
Hide resolved
…irror.ts Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
…ocationParts/chatTerminalToolProgressPart.ts Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
fixes #276946