When I try to execute command "Format selection" vscode says
Sorry, but there is no formatter for 'rust'-files installed.
Is it supported?
There are two formatting modes: Whole file and range formatting. Whole file formatting is stable and can always be used. Range formatting is unstable and only activated if you set "rust.unstable_features": true, in your config (Docs). It is currently behind a flag because range formatting can break your code.
FYI anyone finding this - "whole file" formatting shortcut is ctrl-shift-i
There are two formatting modes: Whole file and range formatting. Whole file formatting is stable and can always be used. Range formatting is unstable and only activated if you set
"rust.unstable_features": true,in your config (Docs). It is currently behind a flag because range formatting can break your code.
I have set "rust.unstable_features":true. However, I cannot execute command "Format selection" still. Has range formatting been removed?
It should pop up in the menu, yes. Are you using nightly?
On Tue, 18 Sep 2018 at 11:19, zstcode notifications@github.com wrote:
There are two formatting modes: Whole file and range formatting. Whole
file formatting is stable and can always be used. Range formatting is
unstable and only activated if you set "rust.unstable_features": true, in
your config (Docs https://github.com/rust-lang-nursery/rls#configuration).
It is currently behind a flag because range formatting can break your code.I have set "rust.unstable_features":true. However, I cannot execute
command "Format selection" still. Has range formatting been removed?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rust-lang-nursery/rls-vscode/issues/201#issuecomment-422320515,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8y3b2j-a4UmfO0TebOG48zuLIF0VQGks5ucLqqgaJpZM4Qr9wm
.
It should pop up in the menu, yes. Are you using nightly?
…
On Tue, 18 Sep 2018 at 11:19, zstcode @.*> wrote: There are two formatting modes: Whole file and range formatting. Whole file formatting is stable and can always be used. Range formatting is unstable and only activated if you set "rust.unstable_features": true, in your config (Docs https://github.com/rust-lang-nursery/rls#configuration). It is currently behind a flag because range formatting can break your code. I have set "rust.unstable_features":true. However, I cannot execute command "Format selection" still. Has range formatting been removed? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#201 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8y3b2j-a4UmfO0TebOG48zuLIF0VQGks5ucLqqgaJpZM4Qr9wm .
Oh, thanks for your help! I am new to rust and using stable. After switching to nightly, I find this at the pop-up menu.
I also ran into the problem described in the original issue https://github.com/rust-lang-nursery/rls-vscode/issues/201#issue-277093998. In my case, uninstalling and re-installing the Rust (rls) extension in Visual Studio Code solved the problem.
There are two formatting modes: Whole file and range formatting. Whole file formatting is stable and can always be used.
I want to use only whole-file formatting. I don't have rust.unstable_features":true enabled. When I run Format Document using Option-Shift-F it says
There is no formatter for 'rust' files installed.
Is it possible to use Format Document without rust.unstable_features":true?
It works now after following these two steps of the Quick Start:
- Open a Rust project (File > Add Folder to Workspace...). Open the folder for the whole project (i.e., the folder containing 'Cargo.toml'), not the 'src' folder.
- You'll be prompted to install the RLS. Once installed, the RLS should start building your project.
I had simply opened a Rust source file, which was not sufficient to trigger installing RLS.
Just for my curiosity, is it possible to install RLS using rustup component add rls rust-analysis rust-src rather than Add Folder to Workspace?
See https://github.com/rust-lang/rls#step-2-install-the-rls
Most helpful comment
It works now after following these two steps of the Quick Start:
I had simply opened a Rust source file, which was not sufficient to trigger installing RLS.