Skip to content

Commit c4691c5

Browse files
committed
Improve WEB UI
1 parent 291aa2b commit c4691c5

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

static/app.js

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -443,34 +443,43 @@ class SmartCodeDiffApp {
443443

444444
detectLanguage(filename) {
445445
const ext = filename.toLowerCase().split('.').pop();
446+
447+
// Map extensions to the exact Language enum values the server expects
446448
const languageMap = {
447-
'c': 'c',
448-
'cpp': 'cpp', 'cc': 'cpp', 'cxx': 'cpp',
449-
'h': 'c', 'hpp': 'cpp', 'hxx': 'cpp',
450-
'js': 'javascript', 'jsx': 'javascript', 'mjs': 'javascript', 'cjs': 'javascript',
451-
'ts': 'typescript', 'tsx': 'typescript',
452-
'py': 'python', 'pyx': 'python', 'pyi': 'python',
453-
'java': 'java',
454-
'kt': 'kotlin',
455-
'rs': 'rust',
456-
'go': 'go',
457-
'rb': 'ruby',
458-
'php': 'php',
459-
'cs': 'csharp',
460-
'swift': 'swift',
461-
'sh': 'bash', 'bash': 'bash', 'zsh': 'bash',
462-
'sql': 'sql',
463-
'html': 'html', 'htm': 'html',
464-
'css': 'css', 'scss': 'css', 'sass': 'css',
465-
'json': 'json',
466-
'yaml': 'yaml', 'yml': 'yaml',
467-
'md': 'markdown',
468-
'xml': 'xml'
449+
// C language
450+
'c': 'C',
451+
'h': 'C',
452+
453+
// C++ language
454+
'cpp': 'Cpp',
455+
'cc': 'Cpp',
456+
'cxx': 'Cpp',
457+
'hpp': 'Cpp',
458+
459+
// JavaScript
460+
'js': 'JavaScript',
461+
'jsx': 'JavaScript',
462+
463+
// TypeScript
464+
'ts': 'TypeScript',
465+
'tsx': 'TypeScript',
466+
467+
// Python
468+
'py': 'Python',
469+
'pyw': 'Python',
470+
471+
// Java
472+
'java': 'Java',
473+
474+
// Rust
475+
'rs': 'Rust',
476+
477+
// Go
478+
'go': 'Go'
469479
};
470480

471-
// Return the language in lowercase format that the server expects
472-
// Default to 'c' for unknown files since that's most likely to work
473-
return languageMap[ext] || 'c';
481+
// Return the exact Language enum value or default to C
482+
return languageMap[ext] || 'C';
474483
}
475484

476485
updateFileTree() {

0 commit comments

Comments
 (0)