From c4b6ad3b1e0da9b0128ba713f975a8a674023f9b Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 5 May 2026 08:32:04 -0400 Subject: [PATCH] fix .await syntax to actually highlight --- syntax/rust.vim | 3 ++- test/coverage.vader | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/syntax/rust.vim b/syntax/rust.vim index 8407b56e..f0173b08 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -52,7 +52,8 @@ syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipempty syn keyword rustStorage move mut ref static const syn match rustDefault /\/ -syn keyword rustAwait await +" Match from the dot so `.await` wins over the generic identifier match. +syn match rustAwait /\.\%(await\>\)/hs=s+1 display syn match rustKeyword /\!\@!/ display syn keyword rustPubScopeCrate crate contained diff --git a/test/coverage.vader b/test/coverage.vader index 84734e7d..5b81e5ee 100644 --- a/test/coverage.vader +++ b/test/coverage.vader @@ -21,4 +21,16 @@ Execute (RustEmitAsm - see that we actually get assembly output): bd call delete('test.rs') +Given rust (await syntax highlighting): + async fn main() { + foo.await?; + foo.await.bar(); + foo.awaiting(); + } + +Execute (.await only highlights postfix await): + AssertEqual 'rustAwait', synIDattr(synID(2, 9, 1), 'name') + AssertEqual 'rustAwait', synIDattr(synID(3, 9, 1), 'name') + AssertEqual 'rustFuncCall', synIDattr(synID(4, 9, 1), 'name') + # TODO: a lot more tests