diff --git a/packages/trace-viewer/src/ui/sourceTab.css b/packages/trace-viewer/src/ui/sourceTab.css index 61045135a3..e4e43d80b6 100644 --- a/packages/trace-viewer/src/ui/sourceTab.css +++ b/packages/trace-viewer/src/ui/sourceTab.css @@ -32,7 +32,7 @@ z-index: 10; } -.copy-icon.codicon { +.source-tab-file-name .copy-icon.codicon { display: block; cursor: pointer; } diff --git a/packages/trace-viewer/src/ui/sourceTab.tsx b/packages/trace-viewer/src/ui/sourceTab.tsx index 2601f9b6ac..f8952849cb 100644 --- a/packages/trace-viewer/src/ui/sourceTab.tsx +++ b/packages/trace-viewer/src/ui/sourceTab.tsx @@ -81,14 +81,6 @@ export const SourceTab: React.FunctionComponent<{ const showStackFrames = (stack?.length ?? 0) > 1; - const getFileName = (fullPath?: string, lineNum?: number) => { - if (!fullPath) - return ''; - const pathSep = fullPath?.includes('/') ? '/' : '\\'; - const fileName = fullPath?.split(pathSep).pop() ?? ''; - return lineNum ? `${fileName}:${lineNum}` : fileName; - }; - return
{fileName && ( @@ -116,3 +108,11 @@ export async function calculateSha1(text: string): Promise { } return hexCodes.join(''); } + +function getFileName(fullPath?: string, lineNum?: number): string { + if (!fullPath) + return ''; + const pathSep = fullPath?.includes('/') ? '/' : '\\'; + const fileName = fullPath?.split(pathSep).pop() ?? ''; + return lineNum ? `${fileName}:${lineNum}` : fileName; +}