Highlight Rust async and await as keywords - #3892
Open
JMak-Security wants to merge 1 commit into
Open
Conversation
bat's Rust syntax highlighting patch (assets/patches/Rust.sublime-syntax.patch) targets an older snapshot of sublimehq/Packages' Rust.sublime-syntax (pinned submodule commit 759d6eed) whose keyword.control.rust match only lists break|else|for|if|loop|match|while|continue. async and await aren't included, so both render as plain text instead of keywords. Add async|await to that same alternation, matching the style already used for the rest of the keyword list. Verified against the actual pinned submodule content (fetched directly rather than the current upstream HEAD, which has since restructured this section entirely) that the patch context at line 139 matches exactly and applies cleanly with `patch --strip=0`. Adds a regression test case (async fn with chained .await calls) and its expected highlighted output, generated to match bat's existing Monokai Extended color scheme (keyword.control.rust colored the same as the other control-flow keywords already in that list). Closes sharkdpgh-1534.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1534. Carries forward #3849 (by @coyaSONG), open since 2026-07-18 with zero review activity.
The bug
assets/patches/Rust.sublime-syntax.patchpatches bat's vendored copy ofsublimehq/Packages'Rust.sublime-syntax(pinned at submodule commit759d6eed). That vendored file'skeyword.control.rustmatch only covers:asyncandawaitaren't in the list, so both render as plain text instead of keywords.The fix
Add
async|awaitto the same alternation, in the same style as the rest of the list:Verification
I don't have a way to run bat's full asset-build pipeline here (
assets/create.shneeds thesublimehq/Packagessubmodule initialized, which is large enough that it wasn't practical to fetch in full). Instead I verified the fix concretely:Rust.sublime-syntaxdirectly (not the current upstream HEAD, which has since restructured this whole section — upstream now already listsasync|await|else|for|if|loop|match|try|while|yieldtogether, so this is purely a local vendoring-lag fix, not something that needs a submodule bump).@@ -139 +139 @@context matches that pinned file exactly, line for line.patch --strip=0 < patches/Rust.sublime-syntax.patchagainst it (the same invocationcreate.shuses) and confirmed it applies cleanly with no fuzz, producing the expectedasync|await|break|...line.Also carries forward #3849's regression test: an
async fnwith chained.awaitcalls intests/syntax-tests/source/Rust/output.rs, with the matching expected highlighted output (async/awaitcolored the same as the otherkeyword.control.rustentries) intests/syntax-tests/highlighted/Rust/output.rs.