@@ -124,9 +124,67 @@ config_data! {
124124 /// Unsets `#[cfg(test)]` for the specified crates.
125125 cargo_unsetTest: Vec <String > = "[\" core\" ]" ,
126126
127- /// Run the flycheck command for diagnostics on save.
127+ /// Run the check command for diagnostics on save.
128128 checkOnSave | checkOnSave_enable: bool = "true" ,
129129
130+ /// Check all targets and tests (`--all-targets`).
131+ check_allTargets | checkOnSave_allTargets: bool = "true" ,
132+ /// Cargo command to use for `cargo check`.
133+ check_command | checkOnSave_command: String = "\" check\" " ,
134+ /// Extra arguments for `cargo check`.
135+ check_extraArgs | checkOnSave_extraArgs: Vec <String > = "[]" ,
136+ /// Extra environment variables that will be set when running `cargo check`.
137+ /// Extends `#rust-analyzer.cargo.extraEnv#`.
138+ check_extraEnv | checkOnSave_extraEnv: FxHashMap <String , String > = "{}" ,
139+ /// List of features to activate. Defaults to
140+ /// `#rust-analyzer.cargo.features#`.
141+ ///
142+ /// Set to `"all"` to pass `--all-features` to Cargo.
143+ check_features | checkOnSave_features: Option <CargoFeaturesDef > = "null" ,
144+ /// Specifies the working directory for running checks.
145+ /// - "workspace": run checks for workspaces in the corresponding workspaces' root directories.
146+ // FIXME: Ideally we would support this in some way
147+ /// This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
148+ /// - "root": run checks in the project's root directory.
149+ /// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
150+ /// is set.
151+ check_invocationLocation | checkOnSave_invocationLocation: InvocationLocation = "\" workspace\" " ,
152+ /// Specifies the invocation strategy to use when running the checkOnSave command.
153+ /// If `per_workspace` is set, the command will be executed for each workspace.
154+ /// If `once` is set, the command will be executed once.
155+ /// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
156+ /// is set.
157+ check_invocationStrategy | checkOnSave_invocationStrategy: InvocationStrategy = "\" per_workspace\" " ,
158+ /// Whether to pass `--no-default-features` to Cargo. Defaults to
159+ /// `#rust-analyzer.cargo.noDefaultFeatures#`.
160+ check_noDefaultFeatures | checkOnSave_noDefaultFeatures: Option <bool > = "null" ,
161+ /// Override the command rust-analyzer uses instead of `cargo check` for
162+ /// diagnostics on save. The command is required to output json and
163+ /// should therefore include `--message-format=json` or a similar option.
164+ ///
165+ /// If you're changing this because you're using some tool wrapping
166+ /// Cargo, you might also want to change
167+ /// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
168+ ///
169+ /// If there are multiple linked projects, this command is invoked for
170+ /// each of them, with the working directory being the project root
171+ /// (i.e., the folder containing the `Cargo.toml`).
172+ ///
173+ /// An example command would be:
174+ ///
175+ /// ```bash
176+ /// cargo check --workspace --message-format=json --all-targets
177+ /// ```
178+ /// .
179+ check_overrideCommand | checkOnSave_overrideCommand: Option <Vec <String >> = "null" ,
180+ /// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
181+ ///
182+ /// Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
183+ /// `["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
184+ ///
185+ /// Aliased as `"checkOnSave.targets"`.
186+ check_targets | checkOnSave_targets | checkOnSave_target: Option <CheckOnSaveTargets > = "null" ,
187+
130188 /// Toggles the additional completions that automatically add imports when completed.
131189 /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
132190 completion_autoimport_enable: bool = "true" ,
@@ -211,64 +269,6 @@ config_data! {
211269 /// Controls file watching implementation.
212270 files_watcher: FilesWatcherDef = "\" client\" " ,
213271
214- /// Check all targets and tests (`--all-targets`).
215- flycheck_allTargets | checkOnSave_allTargets: bool = "true" ,
216- /// Cargo command to use for `cargo check`.
217- flycheck_command | checkOnSave_command: String = "\" check\" " ,
218- /// Extra arguments for `cargo check`.
219- flycheck_extraArgs | checkOnSave_extraArgs: Vec <String > = "[]" ,
220- /// Extra environment variables that will be set when running `cargo check`.
221- /// Extends `#rust-analyzer.cargo.extraEnv#`.
222- flycheck_extraEnv | checkOnSave_extraEnv: FxHashMap <String , String > = "{}" ,
223- /// List of features to activate. Defaults to
224- /// `#rust-analyzer.cargo.features#`.
225- ///
226- /// Set to `"all"` to pass `--all-features` to Cargo.
227- flycheck_features | checkOnSave_features: Option <CargoFeaturesDef > = "null" ,
228- /// Specifies the working directory for running checks.
229- /// - "workspace": run checks for workspaces in the corresponding workspaces' root directories.
230- // FIXME: Ideally we would support this in some way
231- /// This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
232- /// - "root": run checks in the project's root directory.
233- /// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
234- /// is set.
235- flycheck_invocationLocation | checkOnSave_invocationLocation: InvocationLocation = "\" workspace\" " ,
236- /// Specifies the invocation strategy to use when running the checkOnSave command.
237- /// If `per_workspace` is set, the command will be executed for each workspace.
238- /// If `once` is set, the command will be executed once.
239- /// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
240- /// is set.
241- flycheck_invocationStrategy | checkOnSave_invocationStrategy: InvocationStrategy = "\" per_workspace\" " ,
242- /// Whether to pass `--no-default-features` to Cargo. Defaults to
243- /// `#rust-analyzer.cargo.noDefaultFeatures#`.
244- flycheck_noDefaultFeatures | checkOnSave_noDefaultFeatures: Option <bool > = "null" ,
245- /// Override the command rust-analyzer uses instead of `cargo check` for
246- /// diagnostics on save. The command is required to output json and
247- /// should therefore include `--message-format=json` or a similar option.
248- ///
249- /// If you're changing this because you're using some tool wrapping
250- /// Cargo, you might also want to change
251- /// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
252- ///
253- /// If there are multiple linked projects, this command is invoked for
254- /// each of them, with the working directory being the project root
255- /// (i.e., the folder containing the `Cargo.toml`).
256- ///
257- /// An example command would be:
258- ///
259- /// ```bash
260- /// cargo check --workspace --message-format=json --all-targets
261- /// ```
262- /// .
263- flycheck_overrideCommand | checkOnSave_overrideCommand: Option <Vec <String >> = "null" ,
264- /// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
265- ///
266- /// Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
267- /// `["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
268- ///
269- /// Aliased as `"checkOnSave.targets"`.
270- flycheck_targets | checkOnSave_targets | checkOnSave_target: Option <CheckOnSaveTargets > = "null" ,
271-
272272 /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
273273 highlightRelated_breakPoints_enable: bool = "true" ,
274274 /// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
@@ -787,9 +787,9 @@ impl Config {
787787
788788 fn validate ( & self , error_sink : & mut Vec < ( String , serde_json:: Error ) > ) {
789789 use serde:: de:: Error ;
790- if self . data . flycheck_command . is_empty ( ) {
790+ if self . data . check_command . is_empty ( ) {
791791 error_sink. push ( (
792- "/flycheck /command" . to_string ( ) ,
792+ "/check /command" . to_string ( ) ,
793793 serde_json:: Error :: custom ( "expected a non-empty string" ) ,
794794 ) ) ;
795795 }
@@ -1034,7 +1034,7 @@ impl Config {
10341034
10351035 pub fn check_on_save_extra_env ( & self ) -> FxHashMap < String , String > {
10361036 let mut extra_env = self . data . cargo_extraEnv . clone ( ) ;
1037- extra_env. extend ( self . data . flycheck_extraEnv . clone ( ) ) ;
1037+ extra_env. extend ( self . data . check_extraEnv . clone ( ) ) ;
10381038 extra_env
10391039 }
10401040
@@ -1146,21 +1146,21 @@ impl Config {
11461146 }
11471147
11481148 pub fn flycheck ( & self ) -> FlycheckConfig {
1149- match & self . data . flycheck_overrideCommand {
1149+ match & self . data . check_overrideCommand {
11501150 Some ( args) if !args. is_empty ( ) => {
11511151 let mut args = args. clone ( ) ;
11521152 let command = args. remove ( 0 ) ;
11531153 FlycheckConfig :: CustomCommand {
11541154 command,
11551155 args,
11561156 extra_env : self . check_on_save_extra_env ( ) ,
1157- invocation_strategy : match self . data . flycheck_invocationStrategy {
1157+ invocation_strategy : match self . data . check_invocationStrategy {
11581158 InvocationStrategy :: Once => flycheck:: InvocationStrategy :: Once ,
11591159 InvocationStrategy :: PerWorkspace => {
11601160 flycheck:: InvocationStrategy :: PerWorkspace
11611161 }
11621162 } ,
1163- invocation_location : match self . data . flycheck_invocationLocation {
1163+ invocation_location : match self . data . check_invocationLocation {
11641164 InvocationLocation :: Root => {
11651165 flycheck:: InvocationLocation :: Root ( self . root_path . clone ( ) )
11661166 }
@@ -1169,35 +1169,35 @@ impl Config {
11691169 }
11701170 }
11711171 Some ( _) | None => FlycheckConfig :: CargoCommand {
1172- command : self . data . flycheck_command . clone ( ) ,
1172+ command : self . data . check_command . clone ( ) ,
11731173 target_triples : self
11741174 . data
1175- . flycheck_targets
1175+ . check_targets
11761176 . clone ( )
11771177 . and_then ( |targets| match & targets. 0 [ ..] {
11781178 [ ] => None ,
11791179 targets => Some ( targets. into ( ) ) ,
11801180 } )
11811181 . unwrap_or_else ( || self . data . cargo_target . clone ( ) . into_iter ( ) . collect ( ) ) ,
1182- all_targets : self . data . flycheck_allTargets ,
1182+ all_targets : self . data . check_allTargets ,
11831183 no_default_features : self
11841184 . data
1185- . flycheck_noDefaultFeatures
1185+ . check_noDefaultFeatures
11861186 . unwrap_or ( self . data . cargo_noDefaultFeatures ) ,
11871187 all_features : matches ! (
1188- self . data. flycheck_features . as_ref( ) . unwrap_or( & self . data. cargo_features) ,
1188+ self . data. check_features . as_ref( ) . unwrap_or( & self . data. cargo_features) ,
11891189 CargoFeaturesDef :: All
11901190 ) ,
11911191 features : match self
11921192 . data
1193- . flycheck_features
1193+ . check_features
11941194 . clone ( )
11951195 . unwrap_or_else ( || self . data . cargo_features . clone ( ) )
11961196 {
11971197 CargoFeaturesDef :: All => vec ! [ ] ,
11981198 CargoFeaturesDef :: Selected ( it) => it,
11991199 } ,
1200- extra_args : self . data . flycheck_extraArgs . clone ( ) ,
1200+ extra_args : self . data . check_extraArgs . clone ( ) ,
12011201 extra_env : self . check_on_save_extra_env ( ) ,
12021202 } ,
12031203 }
@@ -1887,13 +1887,6 @@ fn get_field<T: DeserializeOwned>(
18871887}
18881888
18891889fn schema ( fields : & [ ( & ' static str , & ' static str , & [ & str ] , & str ) ] ) -> serde_json:: Value {
1890- for ( ( f1, ..) , ( f2, ..) ) in fields. iter ( ) . zip ( & fields[ 1 ..] ) {
1891- fn key ( f : & str ) -> & str {
1892- f. splitn ( 2 , '_' ) . next ( ) . unwrap ( )
1893- }
1894- assert ! ( key( f1) <= key( f2) , "wrong field order: {f1:?} {f2:?}" ) ;
1895- }
1896-
18971890 let map = fields
18981891 . iter ( )
18991892 . map ( |( field, ty, doc, default) | {
0 commit comments