aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/config.rs91
1 files changed, 47 insertions, 44 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 602423919..f4c154058 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -16,20 +16,24 @@ use serde::Deserialize;
16#[derive(Debug, Clone)] 16#[derive(Debug, Clone)]
17pub struct Config { 17pub struct Config {
18 pub client_caps: ClientCapsConfig, 18 pub client_caps: ClientCapsConfig,
19
20 pub with_sysroot: bool,
19 pub publish_diagnostics: bool, 21 pub publish_diagnostics: bool,
20 pub notifications: NotificationsConfig, 22 pub use_client_watching: bool,
21 pub inlay_hints: InlayHintsConfig, 23 // TODO: move to experimental capabilities
22 pub completion: CompletionConfig,
23 pub call_info_full: bool,
24 pub rustfmt: RustfmtConfig,
25 pub check: Option<FlycheckConfig>,
26 pub vscode_lldb: bool, 24 pub vscode_lldb: bool,
27 pub proc_macro_srv: Option<String>,
28 pub lru_capacity: Option<usize>, 25 pub lru_capacity: Option<usize>,
29 pub use_client_watching: bool, 26 pub proc_macro_srv: Option<String>,
30 pub exclude_globs: Vec<String>, 27 pub exclude_globs: Vec<String>,
28 pub notifications: NotificationsConfig,
29
31 pub cargo: CargoConfig, 30 pub cargo: CargoConfig,
32 pub with_sysroot: bool, 31 pub rustfmt: RustfmtConfig,
32 pub check: Option<FlycheckConfig>,
33
34 pub inlay_hints: InlayHintsConfig,
35 pub completion: CompletionConfig,
36 pub call_info_full: bool,
33} 37}
34 38
35#[derive(Debug, Clone)] 39#[derive(Debug, Clone)]
@@ -59,12 +63,28 @@ pub struct ClientCapsConfig {
59impl Default for Config { 63impl Default for Config {
60 fn default() -> Self { 64 fn default() -> Self {
61 Config { 65 Config {
66 client_caps: ClientCapsConfig::default(),
67
68 with_sysroot: true,
62 publish_diagnostics: true, 69 publish_diagnostics: true,
70 use_client_watching: false,
71 vscode_lldb: false,
72 lru_capacity: None,
73 proc_macro_srv: None,
74 exclude_globs: Vec::new(),
63 notifications: NotificationsConfig { 75 notifications: NotificationsConfig {
64 workspace_loaded: true, 76 workspace_loaded: true,
65 cargo_toml_not_found: true, 77 cargo_toml_not_found: true,
66 }, 78 },
67 client_caps: ClientCapsConfig::default(), 79
80 cargo: CargoConfig::default(),
81 rustfmt: RustfmtConfig::Rustfmt { extra_args: Vec::new() },
82 check: Some(FlycheckConfig::CargoCommand {
83 command: "check".to_string(),
84 all_targets: true,
85 extra_args: Vec::new(),
86 }),
87
68 inlay_hints: InlayHintsConfig { 88 inlay_hints: InlayHintsConfig {
69 type_hints: true, 89 type_hints: true,
70 parameter_hints: true, 90 parameter_hints: true,
@@ -77,19 +97,6 @@ impl Default for Config {
77 add_call_argument_snippets: true, 97 add_call_argument_snippets: true,
78 }, 98 },
79 call_info_full: true, 99 call_info_full: true,
80 rustfmt: RustfmtConfig::Rustfmt { extra_args: Vec::new() },
81 check: Some(FlycheckConfig::CargoCommand {
82 command: "check".to_string(),
83 all_targets: true,
84 extra_args: Vec::new(),
85 }),
86 vscode_lldb: false,
87 proc_macro_srv: None,
88 lru_capacity: None,
89 use_client_watching: false,
90 exclude_globs: Vec::new(),
91 cargo: CargoConfig::default(),
92 with_sysroot: true,
93 } 100 }
94 } 101 }
95} 102}
@@ -103,15 +110,22 @@ impl Config {
103 *self = Default::default(); 110 *self = Default::default();
104 self.client_caps = client_caps; 111 self.client_caps = client_caps;
105 112
106 set(value, "/excludeGlobs", &mut self.exclude_globs); 113 set(value, "/withSysroot", &mut self.with_sysroot);
114 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics);
107 set(value, "/useClientWatching", &mut self.use_client_watching); 115 set(value, "/useClientWatching", &mut self.use_client_watching);
116 set(value, "/vscodeLldb", &mut self.vscode_lldb);
108 set(value, "/lruCapacity", &mut self.lru_capacity); 117 set(value, "/lruCapacity", &mut self.lru_capacity);
118 set(value, "/excludeGlobs", &mut self.exclude_globs);
119 set(value, "/featureFlags/notifications.workspace-loaded", &mut self.notifications.workspace_loaded);
120 set(value, "/featureFlags/notifications.cargo-toml-not-found", &mut self.notifications.cargo_toml_not_found);
109 121
110 set(value, "/inlayHintsType", &mut self.inlay_hints.type_hints); 122 set(value, "/cargoFeatures/noDefaultFeatures", &mut self.cargo.no_default_features);
111 set(value, "/inlayHintsParameter", &mut self.inlay_hints.parameter_hints); 123 set(value, "/cargoFeatures/allFeatures", &mut self.cargo.all_features);
112 set(value, "/inlayHintsChaining", &mut self.inlay_hints.chaining_hints); 124 set(value, "/cargoFeatures/features", &mut self.cargo.features);
113 set(value, "/inlayHintsMaxLength", &mut self.inlay_hints.max_length); 125 set(value, "/cargoFeatures/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check);
114 126 if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt {
127 set(value, "/rustfmtArgs", extra_args);
128 }
115 if let Some(false) = get(value, "cargo_watch_enable") { 129 if let Some(false) = get(value, "cargo_watch_enable") {
116 self.check = None 130 self.check = None
117 } else { 131 } else {
@@ -123,21 +137,10 @@ impl Config {
123 } 137 }
124 }; 138 };
125 139
126 set(value, "/withSysroot", &mut self.with_sysroot); 140 set(value, "/inlayHintsType", &mut self.inlay_hints.type_hints);
127 if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { 141 set(value, "/inlayHintsParameter", &mut self.inlay_hints.parameter_hints);
128 set(value, "/rustfmtArgs", extra_args); 142 set(value, "/inlayHintsChaining", &mut self.inlay_hints.chaining_hints);
129 } 143 set(value, "/inlayHintsMaxLength", &mut self.inlay_hints.max_length);
130
131 set(value, "/cargoFeatures/noDefaultFeatures", &mut self.cargo.no_default_features);
132 set(value, "/cargoFeatures/allFeatures", &mut self.cargo.all_features);
133 set(value, "/cargoFeatures/features", &mut self.cargo.features);
134 set(value, "/cargoFeatures/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check);
135
136 set(value, "/vscodeLldb", &mut self.vscode_lldb);
137
138 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics);
139 set(value, "/featureFlags/notifications.workspace-loaded", &mut self.notifications.workspace_loaded);
140 set(value, "/featureFlags/notifications.cargo-toml-not-found", &mut self.notifications.cargo_toml_not_found);
141 set(value, "/featureFlags/completion.enable-postfix", &mut self.completion.enable_postfix_completions); 144 set(value, "/featureFlags/completion.enable-postfix", &mut self.completion.enable_postfix_completions);
142 set(value, "/featureFlags/completion.insertion.add-call-parenthesis", &mut self.completion.add_call_parenthesis); 145 set(value, "/featureFlags/completion.insertion.add-call-parenthesis", &mut self.completion.add_call_parenthesis);
143 set(value, "/featureFlags/completion.insertion.add-argument-snippets", &mut self.completion.add_call_argument_snippets); 146 set(value, "/featureFlags/completion.insertion.add-argument-snippets", &mut self.completion.add_call_argument_snippets);