Turn off underline from mut variable name in VSCode

Hi, I'm using VSCode + rust-lang.rust-analyzer on macOS. The mutable variable name guess is with underlines on line 5 & 7. How can I turn the underline off from variable name in VSCode settings.json?

use std::io;

fn main() {
    println!("input: ");
    let mut guess = String::new(); //Line 5
    io::stdin()
        .read_line(&mut guess). //Line 7
        .expect("Err");
    println!("output: {guess}");
}

This answer seems to work

1 Like

Thanks very much,

https://code.visualstudio.com/docs/languages/rust#_semantic-syntax-highlighting

"editor.semanticHighlighting.enabled": false,

Well, this will disable any semantic highlighting, including useful things such as e.g. syntax highlighting of formatting strings.

false
Screenshot_20220923_180149

true
Screenshot_20220923_180129

The answer I linked to will however only disable the underlining of mutable variables (or variables holding mutable references, or &mut self method calls)

1 Like

Hi, Steff

{
    "editor.semanticTokenColorCustomizations": {
        "enabled": true,
        "rules": {
            "*.mutable": {
                "underline": false,
            }
        }
    }
}

Yes, I understand that. 10+ lines in json to turn off 1 feature - the underline for mut variable name? I prefer to turn off them all.

Actually, the only feature I need most is the outline view of symbols. The Source insight editor does a great job on this feature. I can't add underline for a variable name in text editor, so I don't need extra underline for a name. I don't need syntax highlight, auto completion too.