rust-lang / rust-lang/rust-analyzer
Semantic tokens: more granular custom modifiers for assignments
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
A very common existing use case is to set a distinct style for function.mutable and method.mutable to highlight sites where mutations can occur.
This is very nice, but it does not cover the case of assignments. Mutation happened, but no distinct style was applied:
It would be great if the place expression and the operator receive an additional .assigning or .mutating modifier, so that they can be specifically selected for highlighting.
Currently without this feature, the next best thing is to set a style for variable.mutable. This way the mutable variable is always highlighted:
But this comes with the downside that the variable is highlighted everywhere even when it's used immutably. Personally I consider this a distraction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing rust-analyzer's semantic-token handling for assignments and inspect how existing function.mutable, method.mutable, and variable.mutable modifiers are produced. Confirm whether the place expression and operator can both receive an assigning or mutating modifier, then add coverage showing that assignment sites are highlighted without affecting immutable uses.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100