@@ -74,6 +74,10 @@ namespace ts.DocumentHighlights {
7474            case  SyntaxKind . GetKeyword :
7575            case  SyntaxKind . SetKeyword :
7676                return  getFromAllDeclarations ( isAccessor ,  [ SyntaxKind . GetKeyword ,  SyntaxKind . SetKeyword ] ) ; 
77+             case  SyntaxKind . AwaitKeyword :
78+                 return  useParent ( node . parent ,  isAwaitExpression ,  getAsyncAndAwaitOccurrences ) ; 
79+             case  SyntaxKind . AsyncKeyword :
80+                 return  highlightSpans ( getAsyncAndAwaitOccurrences ( node ) ) ; 
7781            default :
7882                return  isModifierKind ( node . kind )  &&  ( isDeclaration ( node . parent )  ||  isVariableStatement ( node . parent ) ) 
7983                    ? highlightSpans ( getModifierOccurrences ( node . kind ,  node . parent ) ) 
@@ -368,6 +372,35 @@ namespace ts.DocumentHighlights {
368372        return  keywords ; 
369373    } 
370374
375+     function  getAsyncAndAwaitOccurrences ( node : Node ) : Node [ ]  |  undefined  { 
376+         const  func  =  < FunctionLikeDeclaration > getContainingFunction ( node ) ; 
377+         if  ( ! func )  { 
378+             return  undefined ; 
379+         } 
380+ 
381+         const  keywords : Node [ ]  =  [ ] ; 
382+ 
383+         if  ( func . modifiers )  { 
384+             func . modifiers . forEach ( modifier  =>  { 
385+                 pushKeywordIf ( keywords ,  modifier ,  SyntaxKind . AsyncKeyword ) ; 
386+             } ) ; 
387+         } 
388+ 
389+         forEachChild ( func ,  aggregate ) ; 
390+ 
391+         return  keywords ; 
392+ 
393+         function  aggregate ( node : Node ) : void { 
394+             if  ( isAwaitExpression ( node ) )  { 
395+                 pushKeywordIf ( keywords ,  node . getFirstToken ( ) ,  SyntaxKind . AwaitKeyword ) ; 
396+             } 
397+             // Do not cross function boundaries. 
398+             if  ( ! isFunctionLike ( node )  &&  ! isClassLike ( node )  &&  ! isInterfaceDeclaration ( node )  &&  ! isModuleDeclaration ( node )  &&  ! isTypeAliasDeclaration ( node )  &&  ! isTypeNode ( node ) )  { 
399+                 forEachChild ( node ,  aggregate ) ; 
400+             } 
401+         } 
402+     } 
403+ 
371404    function  getIfElseOccurrences ( ifStatement : IfStatement ,  sourceFile : SourceFile ) : HighlightSpan [ ]  { 
372405        const  keywords  =  getIfElseKeywords ( ifStatement ,  sourceFile ) ; 
373406        const  result : HighlightSpan [ ]  =  [ ] ; 
0 commit comments