]> git.lizzy.rs Git - rust.git/blobdiff - crates/rust-analyzer/src/config.rs
Make group imports configurable
[rust.git] / crates / rust-analyzer / src / config.rs
index 556fc2eeb6e235c38e806d54969a8de6909bbcc3..cac48e9117099074a33638e3137cdc66b32e3d2e 100644 (file)
@@ -35,7 +35,8 @@ struct ConfigData {
         assist_importMergeBehaviour: MergeBehaviorDef  = "\"full\"",
         /// The path structure for newly inserted paths to use.
         assist_importPrefix: ImportPrefixDef           = "\"plain\"",
-
+        /// Group inserted imports by the [following order](https://rust-analyzer.github.io/manual.html#auto-import). Groups are separated by newlines.
+        assist_importGroup: bool                       = "true",
         /// Show function name and docs in parameter hints.
         callInfo_full: bool = "true",
 
@@ -46,8 +47,8 @@ struct ConfigData {
         cargo_allFeatures: bool          = "false",
         /// List of features to activate.
         cargo_features: Vec<String>      = "[]",
-        /// Run `cargo check` on startup to get the correct value for package
-        /// OUT_DIRs.
+        /// Run build scripts (`build.rs`) for more precise code analysis.
+        cargo_runBuildScripts |
         cargo_loadOutDirsFromCheck: bool = "false",
         /// Do not activate the `default` feature.
         cargo_noDefaultFeatures: bool    = "false",
@@ -167,8 +168,7 @@ struct ConfigData {
         /// Whether to show `can't find Cargo.toml` error message.
         notifications_cargoTomlNotFound: bool      = "true",
 
-        /// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be
-        /// enabled.
+        /// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
         procMacro_enable: bool                     = "false",
         /// Internal config, path to proc-macro server executable (typically,
         /// this is rust-analyzer itself, but we override this in tests).
@@ -480,8 +480,8 @@ pub fn notifications(&self) -> NotificationsConfig {
     pub fn cargo_autoreload(&self) -> bool {
         self.data.cargo_autoreload
     }
-    pub fn load_out_dirs_from_check(&self) -> bool {
-        self.data.cargo_loadOutDirsFromCheck
+    pub fn run_build_scripts(&self) -> bool {
+        self.data.cargo_runBuildScripts || self.data.procMacro_enable
     }
     pub fn cargo(&self) -> CargoConfig {
         let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {
@@ -575,6 +575,7 @@ fn insert_use_config(&self) -> InsertUseConfig {
                 ImportPrefixDef::ByCrate => PrefixKind::ByCrate,
                 ImportPrefixDef::BySelf => PrefixKind::BySelf,
             },
+            group: self.data.assist_importGroup,
         }
     }
     pub fn completion(&self) -> CompletionConfig {