Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
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 /\<try\>!\@!/ display

syn keyword rustPubScopeCrate crate contained
Expand Down
12 changes: 12 additions & 0 deletions test/coverage.vader
Original file line number Diff line number Diff line change
Expand Up @@ -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