# VS Code Semantic highlighting does not highlight async/await keywords

**URL:** <https://forums.swift.org/t/vs-code-semantic-highlighting-does-not-highlight-async-await-keywords/59054>\
**Category:** VSCode Swift extension\
**Created:** [July 18, 2022, 9:41pm UTC](https://forums.swift.org/t/vs-code-semantic-highlighting-does-not-highlight-async-await-keywords/59054 "2022-07-18T21:41:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam-fowler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/adam-fowler/32/9266_2.png) [@adam-fowler](https://forums.swift.org/u/adam-fowler)\
**Post date:** [July 18, 2022, 9:41pm UTC](https://forums.swift.org/t/vs-code-semantic-highlighting-does-not-highlight-async-await-keywords/59054/1 "2022-07-18T21:41:32Z")

</div>

Moved this from server thread [Introducing Swift for Visual Studio Code](https://forums.swift.org/t/introducing-swift-for-visual-studio-code/54246)

> [@Introducing Swift for Visual Studio Code](https://forums.swift.org/t/introducing-swift-for-visual-studio-code/54246/81):
>
> the `async` and `await` contextual keywords don’t receive syntax highlighting, apparently because the semantic highlighter classifies them as `identifier`s, and as far as i can tell, it is not possible to override a semantic highlight with a textmate highlight (which correctly detects it as a keyword.)
> 
> is there a fix?

> [@Introducing Swift for Visual Studio Code](https://forums.swift.org/t/introducing-swift-for-visual-studio-code/54246/83):
>
> > [@Introducing Swift for Visual Studio Code](https://forums.swift.org/t/introducing-swift-for-visual-studio-code/54246/82):
> >
> > What version of vscode are you running? The highlighting is done VS Code. This is the code in here [vscode/swift.tmLanguage.json at main · microsoft/vscode · GitHub](https://github.com/microsoft/vscode/blob/main/extensions/swift/syntaxes/swift.tmLanguage.json)
> 
> the highlighting is not done by VSCode, it is done by sourcekitd. this is the issue i was [alluding to](https://forums.swift.org/t/introducing-swift-for-visual-studio-code/54246/63) earlier in this thread.
> 
> the reason you are seeing a colored `await` is likely because you have the syntax highlighting _turned off_, in your `settings.json`, or whatever VSCode theme you are using. because the highlighter is disabled, the editor attempts to apply the heuristics in `swift.tmLanguage.json` instead, which knows how to highlight `await` but is less accurate elsewhere.
> 
> i've observed a similar problem with `#if`, `#else` and friends, but because the VSCode swift extension doesn’t attempt to label them (whereas it labels `await` as an identifier), it is possible to provide a fallback for those in a way that is not possible for `await` and `async`, and probably `override` and the other contextual keywords as well.
> 
> (note: i don’t know why the preprocessor macros don’t get highlights, these labels exist in sourcekitd, and Atomic Blonde was always able to access them, so my guess is the VSCode extension is just discarding them.)

---

<div class="post-metadata">

**Author:** ![adam-fowler](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/adam-fowler/32/9266_2.png) [@adam-fowler](https://forums.swift.org/u/adam-fowler)\
**Post date:** [July 18, 2022, 9:50pm UTC](https://forums.swift.org/t/vs-code-semantic-highlighting-does-not-highlight-async-await-keywords/59054/2 "2022-07-18T21:50:22Z")

</div>

The Swift VS Code extension does nothing with the semantic highlighting. All the extension does is start a SourceKit-LSP server and point at the workspace folder. The LSP server then communicates directly with VS Code bypassing the extension. If the `async`, `await` and `#if` etc symbols are not being highlighted correctly I would imagine it is SourceKit-LSP's implementation of semantic highlighting that has the errors. It can't be the extension as it isn't part of the equation by this point and I doubt it is VS Code as LSP was originally developed for VS Code.

I'll investigate a little more to see if I can narrow this down.
