Skip to content

Commit b1c4b4c

Browse files
authored
Add syntax highlighting for 'export' & 'as' keywords (#1381)
* Highlight 'export' keyword in orange for Source 2+ * Highlight 'as' keyword in orange for Source 1+
1 parent bd02324 commit b1c4b4c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/editors/ace/modes/source.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ export function HighlightRulesSelector(
8585
const ChapterKeywordSelector = () => {
8686
const output = []
8787
if (id >= 1) {
88-
output.push('import', 'const', 'else', 'if', 'return', 'function', 'debugger')
88+
output.push('import', 'as', 'const', 'else', 'if', 'return', 'function', 'debugger')
89+
}
90+
if (id >= 2) {
91+
output.push('export')
8992
}
9093
if (id >= 3) {
9194
output.push('while', 'for', 'break', 'continue', 'let')
@@ -95,6 +98,9 @@ export function HighlightRulesSelector(
9598

9699
const ChapterAndVariantForbiddenWordSelector = () => {
97100
const forbiddenWords = []
101+
if (id < 2) {
102+
forbiddenWords.push('export')
103+
}
98104
if (id < 3) {
99105
forbiddenWords.push('while', 'for', 'break', 'continue', 'let')
100106
}
@@ -131,7 +137,7 @@ export function HighlightRulesSelector(
131137
'variable.language':
132138
'this|arguments|' + // Pseudo
133139
'var|yield|async|await|with|switch|throw|try|eval|' + // forbidden words
134-
'class|enum|extends|super|export|implements|private|public|' +
140+
'class|enum|extends|super|implements|private|public|' +
135141
'interface|package|protected|static|in|of|instanceof|new|' +
136142
'case|catch|default|delete|do|finally|' +
137143
ChapterAndVariantForbiddenWordSelector()

0 commit comments

Comments
 (0)