rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

No autocompletion for consts inside format strings.

Open anthony-S93 opened this issue 1 year ago • 2 comments

Code sample:

fn main() {
    let variable1 = 1;
    let variable2 = 2;
    
    const CONSTANT = 3;
    println!("Some format string {}");
}

Current behavior:

https://github.com/rust-lang/rust-analyzer/assets/69449791/5b2944d2-6308-403e-b11c-3f6f2520988e

When applied to format strings, only variables, not constant, will be included in the autocompletion list. Is this by design or is it a bug?

anthony-S93 avatar Feb 19 '24 18:02 anthony-S93

That's a bug, we are only handling locals here https://github.com/rust-lang/rust-analyzer/blob/2223b4fa71e543ac6dd1abd4770a69fab8dbdec1/crates/ide-completion/src/completions/format_string.rs#L33-L36

Veykril avatar Feb 19 '24 20:02 Veykril

@rustbot claim

norskeld avatar Feb 29 '24 17:02 norskeld