@@ -41,7 +41,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
4141 "true" : atom , "false" : atom , "null" : atom , "undefined" : atom , "NaN" : atom , "Infinity" : atom ,
4242 "this" : kw ( "this" ) , "class" : kw ( "class" ) , "super" : kw ( "atom" ) ,
4343 "yield" : C , "export" : kw ( "export" ) , "import" : kw ( "import" ) , "extends" : C ,
44- "await" : C , "async" : kw ( "async" )
44+ "await" : C
4545 } ;
4646
4747 // Extend the 'normal' keywords with the TypeScript language extensions
@@ -147,9 +147,16 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
147147 return ret ( "operator" , "operator" , stream . current ( ) ) ;
148148 } else if ( wordRE . test ( ch ) ) {
149149 stream . eatWhile ( wordRE ) ;
150- var word = stream . current ( ) , known = keywords . propertyIsEnumerable ( word ) && keywords [ word ] ;
151- return ( known && state . lastType != "." ) ? ret ( known . type , known . style , word ) :
152- ret ( "variable" , "variable" , word ) ;
150+ var word = stream . current ( )
151+ if ( state . lastType != "." ) {
152+ if ( keywords . propertyIsEnumerable ( word ) ) {
153+ var kw = keywords [ word ]
154+ return ret ( kw . type , kw . style , word )
155+ }
156+ if ( word == "async" && stream . match ( / ^ \s * [ \( \w ] / , false ) )
157+ return ret ( "async" , "keyword" , word )
158+ }
159+ return ret ( "variable" , "variable" , word )
153160 }
154161 }
155162
0 commit comments