Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/assets/icons/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/git-merge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 68 additions & 3 deletions src/utils/editorLanguages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,88 @@ export const LANGUAGE_CONFIGS: Record<string, RepoLanguageConfig> = {
language: 'spring-boot',
id: 'java',
monacoLanguage: 'java',
fileExtensions: ['.java', '.xml', '.properties', '.yaml', '.yml'],
fileExtensions: [
'.java',
'.xml',
'.properties',
'.yaml',
'.yml',
'.gradle',
'.gradle.kts',
'.sql',
'.jsp',
'.jspx',
'.ftl',
'.vm',
'.groovy',
'.kt',
'.kts',
'.conf',
'.toml',
],
defaultTheme: 'vs-dark',
snippets: ['sysout', 'psvm', 'fori'],
},
[SUPPORTED_LANGUAGES.REACT]: {
language: 'react',
id: 'typescript',
monacoLanguage: 'typescript',
fileExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.css', '.scss'],
fileExtensions: [
'.ts',
'.tsx',
'.js',
'.jsx',
'.json',
'.css',
'.scss',
'.sass',
'.less',
'.stylus',
'.postcss',
'.vue',
'.svelte',
'.mjs',
'.cjs',
'.d.ts',
'.mdx',
'.html',
'.htm',
'.env',
'.env.local',
'.env.development',
'.env.production',
],
defaultTheme: 'vs-dark',
snippets: ['rfc', 'useState', 'useEffect'],
},
[SUPPORTED_LANGUAGES.FASTAPI]: {
language: 'fastapi',
id: 'python',
monacoLanguage: 'python',
fileExtensions: ['.py', '.pyi', '.pyx', '.requirements.txt'],
fileExtensions: [
'.py',
'.pyi',
'.pyx',
'.requirements.txt',
'.pyc',
'.pyo',
'.pyw',
'.ipynb',
'.toml',
'.cfg',
'.ini',
'.txt',
'.lock',
'.pipfile',
'.dockerfile',
'.dockerignore',
'.env',
'.jinja',
'.jinja2',
'.j2',
'.iml',
'.http',
],
defaultTheme: 'vs-dark',
snippets: ['def', 'class', 'if', 'for'],
},
Expand Down
94 changes: 94 additions & 0 deletions src/utils/fileExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import articleIcon from '@/assets/icons/article.svg';
import slidersIcon from '@/assets/icons/sliders.svg';
import folderClosedIcon from '@/assets/icons/folder-closed.svg';
import folderOpenIcon from '@/assets/icons/folder-open.svg';
import chartIcon from '@/assets/icons/chart.svg';
import noteIcon from '@/assets/icons/note.svg';
import lockIcon from '@/assets/icons/lock.svg';
import archiveIcon from '@/assets/icons/archive.svg';
import bookIcon from '@/assets/icons/book.svg';
import imageIcon from '@/assets/icons/image.svg';
import gitIcon from '@/assets/icons/git-merge.svg';

export const getLanguageFromFile = (fileName: string): string => {
const extension = fileName.split('.').pop()?.toLowerCase();
Expand All @@ -19,6 +26,17 @@ export const getLanguageFromFile = (fileName: string): string => {
properties: 'properties',
yaml: 'yaml',
yml: 'yaml',
gradle: 'groovy',
kts: 'kotlin',
sql: 'sql',
jsp: 'html',
jspx: 'xml',
ftl: 'html',
vm: 'html',
groovy: 'groovy',
kt: 'kotlin',
conf: 'ini',
toml: 'toml',

// React/TypeScript
ts: 'typescript',
Expand All @@ -28,18 +46,50 @@ export const getLanguageFromFile = (fileName: string): string => {
json: 'json',
css: 'css',
scss: 'scss',
sass: 'scss',
less: 'less',
stylus: 'stylus',
postcss: 'css',
vue: 'html',
svelte: 'html',
mjs: 'javascript',
cjs: 'javascript',
mdx: 'markdown',
htm: 'html',
env: 'properties',

// Python/FastAPI
py: 'python',
pyi: 'python',
pyx: 'python',
pyc: 'python',
pyo: 'python',
pyw: 'python',
ipynb: 'json',
cfg: 'ini',
ini: 'ini',
lock: 'yaml',
pipfile: 'toml',
dockerignore: 'plaintext',
jinja: 'html',
jinja2: 'html',
j2: 'html',
iml: 'xml',
http: 'plaintext',

// 기타 - Monaco Editor 언어 ID에 맞춰 수정
md: 'markdown',
txt: 'plaintext',
html: 'html',
dockerfile: 'dockerfile',
gitignore: 'plaintext',
log: 'plaintext',
eslintrc: 'json',
prettierrc: 'json',
editorconfig: 'ini',
nvmrc: 'plaintext',
npmrc: 'ini',
svg: 'xml',
};

return extensionMap[extension || ''] || 'plaintext';
Expand All @@ -55,6 +105,17 @@ export const getFileIcon = (fileName: string): string => {
properties: slidersIcon,
yaml: fileAltIcon,
yml: fileAltIcon,
gradle: scriptIcon,
kts: scriptIcon,
sql: chartIcon,
jsp: codeIcon,
jspx: codeIcon,
ftl: noteIcon,
vm: noteIcon,
groovy: scriptIcon,
kt: codeIcon,
conf: slidersIcon,
toml: slidersIcon,

// React/TypeScript
ts: codeIcon,
Expand All @@ -64,14 +125,47 @@ export const getFileIcon = (fileName: string): string => {
json: fileAltIcon,
css: colorsSwatchIcon,
scss: colorsSwatchIcon,
sass: colorsSwatchIcon,
less: colorsSwatchIcon,
stylus: colorsSwatchIcon,
postcss: colorsSwatchIcon,
vue: codeIcon,
svelte: codeIcon,
mjs: scriptIcon,
cjs: scriptIcon,
mdx: articleIcon,
htm: codeIcon,
env: lockIcon,

// Python/FastAPI
py: scriptIcon,
pyc: archiveIcon,
pyo: archiveIcon,
pyw: scriptIcon,
ipynb: bookIcon,
cfg: slidersIcon,
ini: slidersIcon,
lock: lockIcon,
pipfile: fileAltIcon,
dockerignore: fileOffIcon,
jinja: noteIcon,
jinja2: noteIcon,
j2: noteIcon,
iml: slidersIcon,
http: scriptIcon,

// 기타
md: articleIcon,
txt: notesIcon,
html: codeIcon,
log: notesIcon,
eslintrc: slidersIcon,
prettierrc: slidersIcon,
editorconfig: slidersIcon,
nvmrc: fileAltIcon,
npmrc: slidersIcon,
gitignore: gitIcon,
svg: imageIcon,
};

return iconMap[extension || ''] || fileOffIcon;
Expand Down