feat(shell): add visible underline to clickable links in terminal output#631
Conversation
Add underline/noUnderline ANSI escape codes to the ANSI constants table and a formatLinkSentinel() helper that wraps text in underline codes. Uses \x1b[24m (no-underline) instead of \x1b[0m (full reset) so that surrounding styles like gray from formatSystemMessage are preserved. The underline is applied regardless of the colorSupport setting because it communicates clickability, not decoration.
Wrap each clickable action sentinel with ANSI underline codes so that links are visually discoverable without hovering. Updated emission sites: - maybeWriteActionLine: each of the two link segments (Collection View, Query Playground) is underlined separately; the gap between them stays un-underlined. - initializeSession settings-hint: only the clickable portion is underlined. - handleEvalError settings-hint: same treatment.
Verify that ShellTerminalLinkProvider regex patterns correctly match action sentinels wrapped in ANSI underline codes, both standalone and combined with the existing gray color wrapping. New test cases: - Underline-only wrapped collection view action line - Gray + underline wrapped collection view action line - Underline-wrapped settings action line - Both collection view and playground links with individual underline wrapping on the same line
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds persistent visual discoverability for extension-provided terminal links in the Interactive Shell by underlining link sentinels using ANSI SGR codes, while preserving surrounding styling.
Changes:
- Added ANSI underline constants and a
formatLinkSentinel()helper to wrap clickable sentinel text. - Updated shell PTY output sites to underline Collection View / Playground / Settings sentinels.
- Expanded terminal link provider tests to cover underline-wrapped (and gray+underline) lines, including multi-link lines.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/documentdb/shell/ShellTerminalLinkProvider.test.ts | Adds link-detection tests for underline-wrapped link sentinels, including multiple links in one line. |
| src/documentdb/shell/ShellOutputFormatter.ts | Introduces underline/no-underline ANSI codes and a helper to wrap link sentinel output. |
| src/documentdb/shell/DocumentDBShellPty.ts | Applies underline wrapping when emitting clickable terminal sentinel text. |
| docs/ai-and-plans/PRs/631-visible-underline-shell-links.md | Documents rationale, scope, and technical approach for underlined terminal links. |
…tings hint helper - Add startIndex/length assertions to all 4 underline-wrapped link tests to verify visual and interactive boundaries stay aligned (LOW-1) - Extract private writeSettingsHintLine() to deduplicate the settings hint formatting pattern in DocumentDBShellPty (INFO-1)
af29ae5 to
715f9b2
Compare
Review fixes applied — 715f9b24Both Copilot review comments addressed: LOW-1: Added
|
✅ Code Quality Checks
This comment is updated automatically on each push. |
📦 Build Size Report
Download artifact · updated automatically on each push. |
Summary
Clickable action links in the Interactive Shell terminal output (Collection View, Query Playground, Settings) are now visually underlined, making them discoverable without requiring a hover.
Problem
The shell emits clickable sentinels after query results and on error hints. These links are registered with VS Code's
TerminalLinkProviderAPI, which only highlights them on hover or Ctrl+click. There is no API flag to make extension-provided terminal links visually distinct at rest. Users had no visual cue that the text was clickable.Solution
Emit ANSI underline escape codes (
\x1b[4m/\x1b[24m) around each link sentinel at the point of output. This is a purely visual change; the existingShellTerminalLinkProviderregex patterns already tolerate ANSI escape sequences at link boundaries, so no link detection logic needed to change.Key decisions:
\x1b[24m(underline-off) instead of\x1b[0m(full reset): Preserves surrounding styles (e.g., gray fromformatSystemMessage) instead of clobbering them.colorSupportsetting: Underline communicates clickability, not decoration. Users who disable colors still benefit from knowing what is clickable.startIndex/lengthin the link provider, so visual and interactive boundaries align.Changes
ShellOutputFormatter.ts: Addedunderline/noUnderlineto the ANSI constants table. AddedformatLinkSentinel(text)helper.DocumentDBShellPty.ts: Wrapped each link sentinel withformatLinkSentinel()at all three emission sites (maybeWriteActionLine,initializeSessionsettings hint,handleEvalErrorsettings hint).ShellTerminalLinkProvider.test.ts: Added 4 test cases verifying link detection works with underline-wrapped sentinels (standalone, combined with gray, and multi-link lines).Testing