File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { useTester } from '../TesterContext'
44import { useSubscribers } from './useSubscribers'
55import { Text } from 'ink'
66import { Block , Line } from './Blocks'
7+ import { Link } from './Link'
78
89export function StackEntryText ( {
910 entry,
@@ -16,7 +17,11 @@ export function StackEntryText({
1617 ] , [ entry ] )
1718 tester . resolveErrorStackEntry ( entry )
1819
19- return < Text color = "redBright" dimColor > at { String ( entry ) } </ Text >
20+ const { url} = entry . resolved . get ( )
21+
22+ return url
23+ ? < Link url = { url } > { `at String(entry)` } </ Link >
24+ : < Text color = "redBright" dimColor > at { String ( entry ) } </ Text >
2025}
2126
2227export function XErrorComponent ( {
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { Text , TextProps } from 'ink'
3+
4+ export function Link ( {
5+ children,
6+ url,
7+ ...others
8+ } : TextProps & {
9+ children : string
10+ url : string
11+ } ) {
12+ return < Text { ...others } > { ttyHyperlink ( url , children ) } </ Text >
13+ }
14+
15+ export function ttyHyperlink (
16+ url : string ,
17+ text : string ,
18+ ) {
19+ return [
20+ OSC , '8;' ,
21+ '' , // params
22+ ';' ,
23+ url ,
24+ BEL ,
25+ text ,
26+ OSC , '8;;' ,
27+ BEL ,
28+ ] . join ( '' )
29+ }
30+
31+ const OSC = '\u001B]'
32+ const BEL = '\u0007'
You can’t perform that action at this time.
0 commit comments