Skip to content

Commit

Permalink
add missing extensions to the code edtior language detection
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscox committed Jan 17, 2025
1 parent 517e33a commit ce32e40
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/code-editor/use-code-editor-language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function detectLanguage(fileName?: string): CodeEditorLanguage | undefined {
const extension = last(fileName?.split('.') ?? []);

if (extension) {
return extensionMap[extension];
return extensionMap[extension.toLowerCase()];
}
}

Expand All @@ -32,6 +32,7 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
cmake: 'cmake',
cob: 'cobol',
coffee: 'coffeescript',
cpp: 'cpp',
cr: 'crystal',
cs: 'csharp',
css: 'css',
Expand All @@ -55,14 +56,19 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
go: 'go',
groovy: 'groovy',
hs: 'haskell',
html: 'html',
http: 'http',
hx: 'haxe',
idl: 'idl',
java: 'java',
jinja: 'jinja2',
jl: 'julia',
js: 'javascript',
json: 'json',
jsx: 'jsx',
kt: 'kotlin',
less: 'less',
lezer: 'lezer',
liquid: 'liquid',
lisp: 'commonLisp',
ls: 'livescript',
Expand All @@ -77,6 +83,7 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
mps: 'mumps',
mrc: 'mirc',
mscgen: 'mscgen',
mysql: 'mysql',
nb: 'mathematica',
nc: 'nesC',
ng: 'angular',
Expand All @@ -88,16 +95,19 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
oz: 'oz',
pas: 'pascal',
pgsql: 'pgsql',
php: 'php',
pig: 'pig',
pl: 'perl',
pp: 'puppet',
properties: 'properties',
proto: 'protobuf',
ps1: 'powershell',
py: 'python',
q: 'q',
r: 'r',
rb: 'ruby',
rq: 'sparql',
rs: 'rust',
s: 'gas',
sas: 'sas',
scala: 'scala',
Expand All @@ -108,7 +118,7 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
sieve: 'sieve',
sol: 'solidity',
solr: 'solr',
sql: 'mysql',
sql: 'sql',
st: 'smalltalk',
styl: 'stylus',
svelte: 'svelte',
Expand All @@ -129,9 +139,12 @@ const extensionMap: Record<string, CodeEditorLanguage> = {
vhd: 'vhdl',
vm: 'velocity',
vue: 'vue',
wat: 'wast',
webidl: 'webIDL',
xls: 'spreadsheet',
xml: 'xml',
xq: 'xQuery',
yml: 'yaml',
yaml: 'yaml',
ys: 'yacas',
z80: 'z80',
Expand Down

0 comments on commit ce32e40

Please sign in to comment.