Intelsence in VSC + Win11

My VSC + Win11 and rust-analiser help me printing:

println!()
  1. Can I manually change it ?
    I want:
println!( " {:?} ", 1 ) ;
  1. If yes, do you advise me to do that ?

Try changing it and see what happens.

If the resulting code isn't valid, the compiler will emit an error telling you why and it might give you some suggestions for what went wrong or how to fix it.

Also, the documentation for println!() and Rust's formatting machinery is available online if you want to learn more about how to print messages or control how something is printed (e.g. say you want the number to take u 15 characters and be right-aligned).

1 Like

I want to learn how to do it. Where? In cargo? In vsc? When I watch youtube blogers I notice some of them have normal code snippets in their non-vsc IDE

I would make a new Rust project on my computer (cargo new) and open the folder in Visual Studio Code. From there you can edit src/main.rs and run it (cargo run) as much as you want.

You might also want to follow along with The Rust Book. It will walk you through the process of creating and editing a Rust project, as well as a lot of the useful CLI commands (e.g. cargo build for compiling and cargo run for running your code) and standard library functionality.

Then when you get stuck, you can try to figure it out yourself (by searching Google for the error message, reading source code, etc.) and ask questions on this forum if you still can't make any headway.

1 Like

Thank You for your response very much.. It seems, we are talking about different things.. :smile: I am talking not about editing rust code. In VSCode when I click . ( dot ) vsc (or maybe rust-analizer ) offers me a list of code snippets ( templates ) , for example:

 println!()  

or

 for  in  {
     
 }

So, is there a way to change (to extend)

'println!()' template to 'println!(":?",);' template ?