Skip to content

Commit

Permalink
add more languages!
Browse files Browse the repository at this point in the history
  • Loading branch information
kokofixcomputers authored Oct 27, 2024
1 parent a804362 commit 10e0a94
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion resources/scripts/components/server/files/FileEditContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const isMobile = () => {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
};

const getLanguageFromFilename = (filename: string) => {
const getLanguageFromFilename = (filename) => {
const extension = filename.split('.').pop();
switch (extension) {
case 'js':
Expand Down Expand Up @@ -68,6 +68,53 @@ const getLanguageFromFilename = (filename: string) => {
case 'yaml':
case 'yml':
return 'yaml';

// New cases for PowerShell
case 'ps1':
return 'powershell';
case 'psm1':
return 'powershell';
case 'psd1':
return 'powershell';

// Additional languages
case 'd.ts':
return 'typescript';
case 'hpp':
return 'cpp';
case 'kt':
return 'kotlin';
case 'swift':
return 'swift';
case 'm':
case 'h':
return 'objectivec';
case 'scala':
return 'scala';
case 'bash':
case 'zsh':
return 'shell';
case 'dart':
return 'dart';
case 'r':
return 'r';
case 'hs':
return 'haskell';
case 'ex':
case 'exs':
return 'elixir';
case 'lua':
return 'lua';
case 'groovy':
case 'gvy':
return 'groovy';
case 'coffee':
return 'coffeescript';
case 'graphql':
case 'gql':
return 'graphql';

// Default
default:
return 'plaintext';
}
Expand Down

0 comments on commit 10e0a94

Please sign in to comment.