Cannot format code with Rusty Code in VS Code


#1

I’m running Visual Studio Code 1.1.0 under Kubuntu 16.04. Racer 1.2.9 and rustfmt 0.5.0 were installed via cargo and they can both work correctly in the console.

The issue now is that I cannot format code in VS Code. It produces a warning every time with doing nothing, and no logs can be found in the Task Log.

I googled it but it seems that it’s not a general issue. How can I fix it? Any help will be appreciated, thanks in advance.


#2

Have you tried to reformat a new project? The only guess (not very plausible) that I have is that in your project, there is valid main.rs and syntactically invalid lib.rs or some other bin target.


#3

Same here.
The project structure seems to be ok. I don’t think that’s the problem.


#4

I’m using the sample created by cargo new --bin hello_world


#5

Ah, I see there’s an update for RustyCode.
Still get an error but now it says that I don’t have rustfmt installed.


#6

You can now use rustfmt by configuring rust.rustfmtPath manually.

But there’re still issues. For example (upper: before, lower: after):


#7

Updating both VS Code and Rusty Code now works everything out.