in components/RunCard.renderPathCell.tsx [27:44]
function openInNewTab(fileName: string, text: string, region: SimpleRegion | undefined): void {
const line = region?.startLine ?? 1
const col = region?.startColumn ?? 1
const length = (region?.endColumn ?? 1) - col
const [_, pre, hi, post] = new RegExp(`((?:.*?\\n){${line - 1}}.{${col - 1}})(.{${length}})((?:.|\\n)*)`, 's').exec(text)
const escape = unsafe => unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
const {document} = window.open()
document.title = fileName
document.body.innerHTML = `<pre>${escape(pre)}<mark>${escape(hi)}</mark>${escape(post)}</pre>`
setTimeout(() => document.body.querySelector('mark').scrollIntoView({ block: 'center' }))
}