Skip to content

Commit f2202f1

Browse files
authored
Merge pull request #1996 from calebfoss/syntax-highlighting-instance-backup
Enable syntax highlighting in Instance Mode
2 parents 458a2a3 + 7a4d219 commit f2202f1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

client/utils/p5-javascript.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
158158
} else if (wordRE.test(ch)) {
159159
stream.eatWhile(wordRE);
160160
var word = stream.current()
161-
if (state.lastType != ".") {
162-
if (keywords.propertyIsEnumerable(word)) {
163-
var kw = keywords[word]
164-
return ret(kw.type, kw.style, word)
165-
}
166-
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
167-
return ret("async", "keyword", word)
161+
if (keywords.propertyIsEnumerable(word)) {
162+
var kw = keywords[word]
163+
return ret(kw.type, kw.style, word)
168164
}
165+
if (state.lastType != "." && word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
166+
return ret("async", "keyword", word)
169167
return ret("variable", "variable", word)
170168
}
171169
}
@@ -285,6 +283,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
285283
if (combinator(type, content)) {
286284
while(cc.length && cc[cc.length - 1].lex)
287285
cc.pop()();
286+
if (style?.slice(0, 2) === "p5") return style;
288287
if (cx.marked) return cx.marked;
289288
if (type == "variable" && inScope(state, content)) return "variable-2";
290289
return style;

0 commit comments

Comments
 (0)