rust-lang / rust-lang/rust-analyzer

Emit semantic token modifier `async` for impl Future

Open
#22,407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

I randomly discovered async token modifiers getting emitted and thought it might be an interesting thing to set up to get highlighted using a specific color.
However, I noticed that some futures did not get that token modifier, leading to a confusing result, so I disabled it for now. Libraries like embassy seem to use a lot of manually implemented impl Future fns or structs that impl Future.

It would be great if the async token modifier could also get emitted for functions that don't use the async keyword but return impl Future, as well as ones that return a struct that impls Future.

Examples, note the different highlighting where the greenish color comes from the async token modifier and the yellowish one is the usual one for functions/methods:

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating rust-analyzer's semantic-token generation and the existing handling for the async token modifier, then compare async-keyword functions with functions returning impl Future or a Future-implementing struct. Done means the modifier is emitted for the requested cases without changing existing highlighting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.