mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 14:33:29 +00:00
1e20bf38b2
feat: extract_expressions_from_format_string closes #13640 - rename to `extract_expressions_from_format_string` - leave identifier from format string - but this is from rustc version 1.65.0 - Should I add flag or something? Note: the assist behaves below cases for now. I'll create an issue for these. ```rs let var = 1 + 1; // ok format!("{var} {1+1}"); // → format!("{var} {}", 1+1); format!("{var:?} {1+1}"); // → format!("{var:?} {}", 1 + 1); format!("{var} {var} {1+1}"); // → format!("{var} {var} {}", 1 + 1); // breaks (need to handle minimum width by postfix`$`) format!("{var:width$} {1+1}"); // → format!("{var:width\$} {}", 1+1); format!("{var:.prec$} {1+1}"); // → format!("{var:.prec\$} {}", 1+1); format!("Hello {:1$}! {1+1}", "x" 5); // → format("Hello {:1\$}! {}", "x", 1+1); format!("Hello {:width$}! {1+1}", "x", width = 5); // → println!("Hello {:width\$}! {}", "x", 1+1); ``` https://user-images.githubusercontent.com/38400669/204344911-f1f8fbd2-706d-414e-b1ab-d309376efb9b.mov |
||
---|---|---|
.. | ||
base-db | ||
cfg | ||
flycheck | ||
hir | ||
hir-def | ||
hir-expand | ||
hir-ty | ||
ide | ||
ide-assists | ||
ide-completion | ||
ide-db | ||
ide-diagnostics | ||
ide-ssr | ||
limit | ||
mbe | ||
parser | ||
paths | ||
proc-macro-api | ||
proc-macro-srv | ||
proc-macro-srv-cli | ||
proc-macro-test | ||
profile | ||
project-model | ||
rust-analyzer | ||
sourcegen | ||
stdx | ||
syntax | ||
test-utils | ||
text-edit | ||
toolchain | ||
tt | ||
vfs | ||
vfs-notify |