rust-lang / rust-lang/rust-analyzer

Format specifier, I want to change the color of the debug symbols

Open
#12,131 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In this line:

println!("value of x: {:?} ok?", x);

I wish to change the color of :? or any debug symbol such as :x etc.

image

Currently you can see that the {:?} is all gray. But when I change it to :x

image

the x is red.

image

According to Developer: Inspect Editor Tokens and Scopes the x is a variable

image

When that is not true, it is a debug symbol.

Whereas :? is a format specifier.

image

I want to modify the debug symbol to another color. I want to all together modify the : and whatever comes after it such as a ?, x, b etc.

I know I have to put it under "editor.semanticTokenColorCustomizations" and under rules but not sure what is the name of the field?

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

Reproduce the Rust format-string examples from the issue in VS Code and inspect their semantic tokens and scopes. Trace how rust-analyzer classifies :?, :x, :b, and related format specifiers, then add a customizable token classification whose color can be set through semanticTokenColorCustomizations; done means each requested specifier can be styled distinctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.