-
Notifications
You must be signed in to change notification settings - Fork 3
/
defaultCodeModes.ts
109 lines (107 loc) · 3.23 KB
/
defaultCodeModes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import {StreamLanguage} from '@codemirror/language'
import {type Extension} from '@codemirror/state'
export interface CodeMode {
name: string
loader: ModeLoader
}
export type ModeLoader = () => Promise<Extension | undefined> | Extension | undefined
export const defaultCodeModes: CodeMode[] = [
{
name: 'groq',
loader: () =>
import('@codemirror/lang-javascript').then(({javascriptLanguage}) => javascriptLanguage),
},
{
name: 'javascript',
loader: () =>
import('@codemirror/lang-javascript').then(({javascript}) => javascript({jsx: false})),
},
{
name: 'jsx',
loader: () =>
import('@codemirror/lang-javascript').then(({javascript}) => javascript({jsx: true})),
},
{
name: 'typescript',
loader: () =>
import('@codemirror/lang-javascript').then(({javascript}) =>
javascript({jsx: false, typescript: true}),
),
},
{
name: 'tsx',
loader: () =>
import('@codemirror/lang-javascript').then(({javascript}) =>
javascript({jsx: true, typescript: true}),
),
},
{name: 'php', loader: () => import('@codemirror/lang-php').then(({php}) => php())},
{name: 'sql', loader: () => import('@codemirror/lang-sql').then(({sql}) => sql())},
{
name: 'mysql',
loader: () => import('@codemirror/lang-sql').then(({sql, MySQL}) => sql({dialect: MySQL})),
},
{name: 'json', loader: () => import('@codemirror/lang-json').then(({json}) => json())},
{
name: 'markdown',
loader: () => import('@codemirror/lang-markdown').then(({markdown}) => markdown()),
},
{name: 'java', loader: () => import('@codemirror/lang-java').then(({java}) => java())},
{name: 'html', loader: () => import('@codemirror/lang-html').then(({html}) => html())},
{
name: 'csharp',
loader: () =>
import('@codemirror/legacy-modes/mode/clike').then(({csharp}) =>
StreamLanguage.define(csharp),
),
},
{
name: 'sh',
loader: () =>
import('@codemirror/legacy-modes/mode/shell').then(({shell}) => StreamLanguage.define(shell)),
},
{
name: 'css',
loader: () =>
import('@codemirror/legacy-modes/mode/css').then(({css}) => StreamLanguage.define(css)),
},
{
name: 'scss',
loader: () =>
import('@codemirror/legacy-modes/mode/css').then(({css}) => StreamLanguage.define(css)),
},
{
name: 'sass',
loader: () =>
import('@codemirror/legacy-modes/mode/sass').then(({sass}) => StreamLanguage.define(sass)),
},
{
name: 'ruby',
loader: () =>
import('@codemirror/legacy-modes/mode/ruby').then(({ruby}) => StreamLanguage.define(ruby)),
},
{
name: 'python',
loader: () =>
import('@codemirror/legacy-modes/mode/python').then(({python}) =>
StreamLanguage.define(python),
),
},
{
name: 'xml',
loader: () =>
import('@codemirror/legacy-modes/mode/xml').then(({xml}) => StreamLanguage.define(xml)),
},
{
name: 'yaml',
loader: () =>
import('@codemirror/legacy-modes/mode/yaml').then(({yaml}) => StreamLanguage.define(yaml)),
},
{
name: 'golang',
loader: () =>
import('@codemirror/legacy-modes/mode/go').then(({go}) => StreamLanguage.define(go)),
},
{name: 'text', loader: () => undefined},
{name: 'batch', loader: () => undefined},
]