add preference page to format on save (only full file)#451
add preference page to format on save (only full file)#451fabrizioiannetti wants to merge 1 commit intoeclipse-corrosion:masterfrom
Conversation
|
Would adding support for documentRangeFormattingProvider in rust-analyzer automatically enable format on save in Corrosion automatically? If so, do you think you'd be capable of fixing that upstream, in rust-analyzer directly, so all IDEs would benefit from it? |
|
Sorry for the late answer, I looked a bit into lsp4e and cdt-lsp and indeed lsp4e looks at the server capabilities and adapts the request accordingly (e.g. the range format might actually do a full-file format). CDT seems to have the same approach as you suggested: implement both and let lsp4e/the language server take care of adapting the request. I will enable both options so that once rust-analyzer supports range formatting it will be supported automatically.
I'll give a try to the nightly build. |
note that currently rnage-formatting is an unstable feature only enabled in nightly builds, so lsp4e will automatically map it to a full file format when using the stable toolchain. Copied and modified from eclipse CDT LSP.
33d1026 to
ede01ad
Compare
|
I tried with the rust nightly toolchain and using an LS settings with (from the rust analyzer docs): I get range formatting on save (it also requires this fix on lsp4e: eclipse-lsp4e/lsp4e#1294) I have also updated the |
rust-analyzer currently does not support range formatting as reported in the capabilites:
"capabilities":{
...
"documentFormattingProvider":true,
"documentRangeFormattingProvider":false,
...
leave the (disabled) preference, to be activated when rust-analyzer supports it.
Copied and modified from eclipse CDT LSP.