You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
650 B
32 lines
650 B
2 months ago
|
class SyntaxService {
|
||
|
static String detectFileType(String fileName) {
|
||
|
final extension = fileName.split('.').last.toLowerCase();
|
||
|
|
||
|
switch (extension) {
|
||
|
case 'dart':
|
||
|
return 'dart';
|
||
|
case 'java':
|
||
|
return 'java';
|
||
|
case 'js':
|
||
|
return 'javascript';
|
||
|
case 'py':
|
||
|
return 'python';
|
||
|
case 'html':
|
||
|
return 'html';
|
||
|
case 'css':
|
||
|
return 'css';
|
||
|
case 'json':
|
||
|
return 'json';
|
||
|
case 'xml':
|
||
|
return 'xml';
|
||
|
case 'md':
|
||
|
return 'markdown';
|
||
|
case 'yaml':
|
||
|
case 'yml':
|
||
|
return 'yaml';
|
||
|
default:
|
||
|
return 'text';
|
||
|
}
|
||
|
}
|
||
|
}
|