Skip to content

feat(vscode): polish chat styling and add code, line, command and message copy - #135

Open
zy1233 wants to merge 1 commit into
mainfrom
feat/vscode-chat-ux
Open

zy1233 wants to merge 1 commit into
mainfrom
feat/vscode-chat-ux

Conversation

@zy1233

@zy1233 zy1233 commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Summary

Upgrades the VS Code extension (vscode/) chat UI/UX and copy workflow toward a mainstream coding-agent experience while keeping the webview pure-DOM/CSP-safe (no innerHTML from agent text, no new runtime dependencies).

Chat Output & Styling (vscode/media/chat.css, vscode/src/webview/dom.ts, vscode/src/webview/main.ts)

  • Message cards & typography: Distinct rounded user prompt cards, improved prose line-height and table/blockquote styling, clean empty-transcript hint, single-line ellipsis on header metadata, pulsing indicator for busy/starting states, and streaming indicator on active thinking blocks.
  • Code block header & per-line layout: Fenced code blocks now render a header bar with the normalized language label (code fallback) and whole-block copy button, plus line-level .code-line rows with sticky per-line copy buttons while preserving pre.code code textContent byte-for-byte.
  • Collapsible thinking & tool cards: Custom rotating SVG chevrons on <details class="thought"> and <details class="tool-output">, status-colored left accent borders and pills (data-status) on tool call cards.
  • Composer & navigation: Auto-resizing textarea (field-sizing: content), IME-safe Enter submission (isComposing || keyCode === 229), and a floating ↓ Latest button when scrolled away from the tail.

Copy Interactions (vscode/src/core/copy.ts, vscode/src/webview/dom.ts, vscode/src/webview/main.ts)

  • Code block & per-line copy: Copy full code blocks or individual non-empty lines; for shell/untagged snippets (sh, bash, zsh, powershell, pwsh, cmd, etc.), leading $ and PS> prompts are stripped so commands paste cleanly into a terminal.
  • Inline code: Click-to-copy on inline <code> spans (ignored when text is selected, and links containing <code> continue to open via openLink).
  • Tool calls & permissions: Header copy button on tool calls (rawInput.command -> rawInput.path -> title), overlay copy button on tool output, and click-to-copy on non-trust permission summaries.
  • Whole-message copy: Hover/focus-revealed copy buttons on user and assistant messages.
  • Accessibility & clean selection: Button labels use CSS attr(data-label) (textContent === ""), hover reveal uses opacity (never display: none), and feedback uses an off-transcript role="status" live region (Copied / Copy failed with VoiceOver repeat-announcement deduplication).

Verification

Run from vscode/:

  • npm run build (esbuild.mjs): built dist/extension.js (432.3kb) and dist/webview.js (254.5kb).
  • npm run check:
    • npm run typecheck: tsc --noEmit -p tsconfig.json && tsc --noEmit -p src/webview/tsconfig.json passed.
    • npm run lint: eslint . passed.
    • npm test (vitest run): 20 passed | 3 skipped (23), 363 passed | 18 skipped (381) (3 opt-in real-*.test.ts files and 1 platform-specific test in locate.test.ts skipped; all 34 tests in test/webview.test.ts in headless Chrome and 6 unit tests in test/copy.test.ts passed).

This branch has not been deployed

No deployments
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.

1 participant