From 13c6ed8941187f9c10f186bb24f34fdd353b463e Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 31 Jul 2024 15:40:13 -0700 Subject: [PATCH] cherry-pick(#31939): chore(trace-viewer): copy only file name without line number 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 27d64146ec..4e2c0528fe 100644 --- a/packages/trace-viewer/src/ui/sourceTab.tsx +++ b/packages/trace-viewer/src/ui/sourceTab.tsx @@ -100,7 +100,7 @@ export const SourceTab: React.FunctionComponent<{
{ fileName && {fileName} - + {location && } } @@ -121,10 +121,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() ?? ''; }