From ecd384212df7b048b40931c879f3b7c29f5ab8e6 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 31 Jul 2024 15:40:13 -0700 Subject: [PATCH] chore(trace-viewer): copy only file name without line number (#31939) As discussed in the meeting, copy only file name which is shown in the same line, do not include highlighted line number. --- packages/trace-viewer/src/ui/sourceTab.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/trace-viewer/src/ui/sourceTab.tsx b/packages/trace-viewer/src/ui/sourceTab.tsx index 121b226216..cfa6e2ccd4 100644 --- a/packages/trace-viewer/src/ui/sourceTab.tsx +++ b/packages/trace-viewer/src/ui/sourceTab.tsx @@ -103,7 +103,7 @@ export const SourceTab: React.FunctionComponent<{ main={
{ fileName && {fileName} - + {location && } } @@ -124,10 +124,9 @@ export async function calculateSha1(text: string): Promise { return hexCodes.join(''); } -function getFileName(fullPath?: string, lineNum?: number): string { +function getFileName(fullPath?: string): string { if (!fullPath) return ''; const pathSep = fullPath?.includes('/') ? '/' : '\\'; - const fileName = fullPath?.split(pathSep).pop() ?? ''; - return lineNum ? `${fileName}:${lineNum}` : fileName; + return fullPath?.split(pathSep).pop() ?? ''; }