aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r--crates/rust-analyzer/src/config.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index b700d025f..2e99db36c 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -218,6 +218,10 @@ config_data! {
218 /// Advanced option, fully override the command rust-analyzer uses for 218 /// Advanced option, fully override the command rust-analyzer uses for
219 /// formatting. 219 /// formatting.
220 rustfmt_overrideCommand: Option<Vec<String>> = "null", 220 rustfmt_overrideCommand: Option<Vec<String>> = "null",
221 /// Enables the use of rustfmt's unstable range formatting command for the
222 /// `textDocument/rangeFormatting` request. The rustfmt option is unstable and only
223 /// available on a nightly build.
224 rustfmt_enableRangeFormatting: bool = "false",
221 225
222 /// Workspace symbol search scope. 226 /// Workspace symbol search scope.
223 workspace_symbol_search_scope: WorskpaceSymbolSearchScopeDef = "\"workspace\"", 227 workspace_symbol_search_scope: WorskpaceSymbolSearchScopeDef = "\"workspace\"",
@@ -304,7 +308,7 @@ pub struct NotificationsConfig {
304 308
305#[derive(Debug, Clone)] 309#[derive(Debug, Clone)]
306pub enum RustfmtConfig { 310pub enum RustfmtConfig {
307 Rustfmt { extra_args: Vec<String> }, 311 Rustfmt { extra_args: Vec<String>, enable_range_formatting: bool },
308 CustomCommand { command: String, args: Vec<String> }, 312 CustomCommand { command: String, args: Vec<String> },
309} 313}
310 314
@@ -569,9 +573,10 @@ impl Config {
569 let command = args.remove(0); 573 let command = args.remove(0);
570 RustfmtConfig::CustomCommand { command, args } 574 RustfmtConfig::CustomCommand { command, args }
571 } 575 }
572 Some(_) | None => { 576 Some(_) | None => RustfmtConfig::Rustfmt {
573 RustfmtConfig::Rustfmt { extra_args: self.data.rustfmt_extraArgs.clone() } 577 extra_args: self.data.rustfmt_extraArgs.clone(),
574 } 578 enable_range_formatting: self.data.rustfmt_enableRangeFormatting,
579 },
575 } 580 }
576 } 581 }
577 pub fn flycheck(&self) -> Option<FlycheckConfig> { 582 pub fn flycheck(&self) -> Option<FlycheckConfig> {