Trim unused code editor languages

This commit is contained in:
2026-06-10 12:11:25 +08:00
parent 0390734df0
commit 8cbace7585
4 changed files with 20 additions and 225 deletions
@@ -4,14 +4,6 @@ import type { CodeLanguage } from './types';
// 语言扩展懒加载映射
const languageLoaders: Record<CodeLanguage, () => Promise<Extension>> = {
javascript: async () => {
const { javascript } = await import('@codemirror/lang-javascript');
return javascript();
},
typescript: async () => {
const { javascript } = await import('@codemirror/lang-javascript');
return javascript({ typescript: true });
},
python: async () => {
const { python } = await import('@codemirror/lang-python');
return python();
@@ -24,26 +16,6 @@ const languageLoaders: Record<CodeLanguage, () => Promise<Extension>> = {
const { json } = await import('@codemirror/lang-json');
return json();
},
html: async () => {
const { html } = await import('@codemirror/lang-html');
return html();
},
css: async () => {
const { css } = await import('@codemirror/lang-css');
return css();
},
markdown: async () => {
const { markdown } = await import('@codemirror/lang-markdown');
return markdown();
},
xml: async () => {
const { xml } = await import('@codemirror/lang-xml');
return xml();
},
yaml: async () => {
const { yaml } = await import('@codemirror/lang-yaml');
return yaml();
},
};
/**
@@ -65,14 +37,7 @@ export async function getLanguageExtension(
* 支持的语言列表
*/
export const supportedLanguages: CodeLanguage[] = [
'javascript',
'typescript',
'python',
'sql',
'json',
'html',
'css',
'markdown',
'xml',
'yaml',
];
@@ -1,16 +1,9 @@
import type { EditorView } from '@codemirror/view';
export type CodeLanguage =
| 'css'
| 'html'
| 'javascript'
| 'json'
| 'markdown'
| 'python'
| 'sql'
| 'typescript'
| 'xml'
| 'yaml';
| 'sql';
export interface CodeEditorProps {
/** 代码内容 */