-
Notifications
You must be signed in to change notification settings - Fork 257
Better Rustfmt integration #3
Comments
@nrc, |
Use PathBuf and Path where necessary.
And other issues:
Formatting is currently behind the 'unstable features' flag, we should fix at least the above two and rust-lang/rustfmt#562, before turning it on by default. (copied into OP) |
re formatting on save, @KalitaAlexey is correct. To do it you add the following to setttings.json:
I feel like we should document this somewhere since it is not obvious. |
@nrc This is editor/IDE-specific, so I think it'd be best to add it somewhere in rls_vscode (maybe under a section like Supported Features for VSCode?). |
I've made formatting a whole file stable, formatting ranges is still unstable |
Has there been any progress on range formatting? This is quite a common need when you don't own the project, you want to only format the bits you're touching. |
Afraid not. It's one of the things I'd like to work on after 1.0 |
Question: it doesn't look like |
It should be handled by the RLS, not the plugin. This is probably a bug. |
Please ignore: I think it was a red herring due to an error in my |
Hey, thanks for all the work. Just wondering, should line formatting for ranges work or not ? Should it work by setting the unstable settings to true ? Seems the issues for those are closed, but cannot get it working by default at least with VScode and the Rust (rls) extension. |
Range formatting doesn't work and it would be a very nice improvement to have this. I'm not sure the status of this issue is being tracked very actively. Can rustfmt do this yet? |
Technically it can, it's just gated behind unstable features flag for Rustfmt: |
Return only modified lines in formatting responses Ticks few boxes in #3. (that's an early issue!) Closes #334. This is currently based on rust-lang/rustfmt#3424 and so currently blocked until it merges. Configures Rustfmt to use `EmitMode::ModifiedLines` and parses the response - this should work with both statically-linked and externally provided Rustfmt. @alexheretic do you think you could take a look and double-check?
Last remaining points (only return changed file range and return no-op if nothing changed) were addressed by #1385 and this works as expected. As such, I'm happy to close this tracking issue! The last remaining thing to keep in mind is that range formatting is still gated behind unstable features but that's tracked upstream at rust-lang/rustfmt#3397. |
RLS currently supports rudimentary Rustfmt integration. It could be improved a lot:
The text was updated successfully, but these errors were encountered: