From 71b8e225016ca6963de2731451488530c0c75287 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 31 Jul 2024 17:59:39 -0700 Subject: [PATCH] =?UTF-8?q?cherry-pick(#31939):=20chore(trace-viewer):=20c?= =?UTF-8?q?opy=20only=20file=20name=20without=E2=80=A6=20(#31942)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … 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() ?? ''; }