Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
andrewtruong committed Oct 29, 2024
1 parent 639a75c commit 73c0666
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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';
};

0 comments on commit 73c0666

Please sign in to comment.