From 73c06660071c7e6dfa8b9693fc3fc7e1bc7c309b Mon Sep 17 00:00:00 2001 From: Andrew Truong Date: Mon, 28 Oct 2024 22:31:58 -0400 Subject: [PATCH] test --- .../Home/Browse2/Browse2OpDefCode.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefCode.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefCode.tsx index cd387912963..a7bc87daae8 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefCode.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefCode.tsx @@ -39,10 +39,18 @@ export const Browse2OpDefCode: FC<{uri: string; maxRowsInView?: number}> = ({ const detectLanguage = (code: string) => { // Simple language detection based on file extension or content - if (uri.endsWith('.py')) return 'python'; - if (uri.endsWith('.js') || uri.endsWith('.ts')) return 'javascript'; - if (code.includes('def ') || code.includes('import ')) return 'python'; - if (code.includes('function ') || code.includes('const ')) return 'javascript'; + if (uri.endsWith('.py')) { + return 'python'; + } + if (uri.endsWith('.js') || uri.endsWith('.ts')) { + return 'javascript'; + } + if (code.includes('def ') || code.includes('import ')) { + return 'python'; + } + if (code.includes('function ') || code.includes('const ')) { + return 'javascript'; + } return 'plaintext'; };