aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir/src/lib.rs40
-rw-r--r--crates/ide_assists/src/handlers/generate_function.rs73
-rw-r--r--crates/ide_completion/src/completions/postfix.rs14
-rw-r--r--crates/rust-analyzer/src/config.rs48
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--docs/dev/lsp-extensions.md20
-rw-r--r--docs/user/generated_config.adoc322
-rw-r--r--editors/code/package.json48
8 files changed, 423 insertions, 144 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index c4691d34c..d5a3d9034 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -812,13 +812,11 @@ impl Function {
812 /// Get this function's return type 812 /// Get this function's return type
813 pub fn ret_type(self, db: &dyn HirDatabase) -> Type { 813 pub fn ret_type(self, db: &dyn HirDatabase) -> Type {
814 let resolver = self.id.resolver(db.upcast()); 814 let resolver = self.id.resolver(db.upcast());
815 let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate();
815 let ret_type = &db.function_data(self.id).ret_type; 816 let ret_type = &db.function_data(self.id).ret_type;
816 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 817 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
817 let environment = TraitEnvironment::lower(db, &resolver); 818 let ty = Ty::from_hir_ext(&ctx, ret_type).0;
818 Type { 819 Type::new_with_resolver_inner(db, krate, &resolver, ty)
819 krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate(),
820 ty: InEnvironment { value: Ty::from_hir_ext(&ctx, ret_type).0, environment },
821 }
822 } 820 }
823 821
824 pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> { 822 pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> {
@@ -830,6 +828,7 @@ impl Function {
830 828
831 pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param> { 829 pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param> {
832 let resolver = self.id.resolver(db.upcast()); 830 let resolver = self.id.resolver(db.upcast());
831 let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate();
833 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 832 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
834 let environment = TraitEnvironment::lower(db, &resolver); 833 let environment = TraitEnvironment::lower(db, &resolver);
835 db.function_data(self.id) 834 db.function_data(self.id)
@@ -837,7 +836,7 @@ impl Function {
837 .iter() 836 .iter()
838 .map(|type_ref| { 837 .map(|type_ref| {
839 let ty = Type { 838 let ty = Type {
840 krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate(), 839 krate,
841 ty: InEnvironment { 840 ty: InEnvironment {
842 value: Ty::from_hir_ext(&ctx, type_ref).0, 841 value: Ty::from_hir_ext(&ctx, type_ref).0,
843 environment: environment.clone(), 842 environment: environment.clone(),
@@ -1403,12 +1402,9 @@ impl TypeParam {
1403 1402
1404 pub fn ty(self, db: &dyn HirDatabase) -> Type { 1403 pub fn ty(self, db: &dyn HirDatabase) -> Type {
1405 let resolver = self.id.parent.resolver(db.upcast()); 1404 let resolver = self.id.parent.resolver(db.upcast());
1406 let environment = TraitEnvironment::lower(db, &resolver); 1405 let krate = self.id.parent.module(db.upcast()).krate();
1407 let ty = Ty::Placeholder(self.id); 1406 let ty = Ty::Placeholder(self.id);
1408 Type { 1407 Type::new_with_resolver_inner(db, krate, &resolver, ty)
1409 krate: self.id.parent.module(db.upcast()).krate(),
1410 ty: InEnvironment { value: ty, environment },
1411 }
1412 } 1408 }
1413 1409
1414 pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> { 1410 pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> {
@@ -1427,14 +1423,11 @@ impl TypeParam {
1427 let params = db.generic_defaults(self.id.parent); 1423 let params = db.generic_defaults(self.id.parent);
1428 let local_idx = hir_ty::param_idx(db, self.id)?; 1424 let local_idx = hir_ty::param_idx(db, self.id)?;
1429 let resolver = self.id.parent.resolver(db.upcast()); 1425 let resolver = self.id.parent.resolver(db.upcast());
1430 let environment = TraitEnvironment::lower(db, &resolver); 1426 let krate = self.id.parent.module(db.upcast()).krate();
1431 let ty = params.get(local_idx)?.clone(); 1427 let ty = params.get(local_idx)?.clone();
1432 let subst = Substs::type_params(db, self.id.parent); 1428 let subst = Substs::type_params(db, self.id.parent);
1433 let ty = ty.subst(&subst.prefix(local_idx)); 1429 let ty = ty.subst(&subst.prefix(local_idx));
1434 Some(Type { 1430 Some(Type::new_with_resolver_inner(db, krate, &resolver, ty))
1435 krate: self.id.parent.module(db.upcast()).krate(),
1436 ty: InEnvironment { value: ty, environment },
1437 })
1438 } 1431 }
1439} 1432}
1440 1433
@@ -1523,13 +1516,10 @@ impl Impl {
1523 pub fn target_ty(self, db: &dyn HirDatabase) -> Type { 1516 pub fn target_ty(self, db: &dyn HirDatabase) -> Type {
1524 let impl_data = db.impl_data(self.id); 1517 let impl_data = db.impl_data(self.id);
1525 let resolver = self.id.resolver(db.upcast()); 1518 let resolver = self.id.resolver(db.upcast());
1519 let krate = self.id.lookup(db.upcast()).container.module(db.upcast()).krate();
1526 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 1520 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
1527 let environment = TraitEnvironment::lower(db, &resolver);
1528 let ty = Ty::from_hir(&ctx, &impl_data.target_type); 1521 let ty = Ty::from_hir(&ctx, &impl_data.target_type);
1529 Type { 1522 Type::new_with_resolver_inner(db, krate, &resolver, ty)
1530 krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate(),
1531 ty: InEnvironment { value: ty, environment },
1532 }
1533 } 1523 }
1534 1524
1535 pub fn items(self, db: &dyn HirDatabase) -> Vec<AssocItem> { 1525 pub fn items(self, db: &dyn HirDatabase) -> Vec<AssocItem> {
@@ -1725,13 +1715,11 @@ impl Type {
1725 }; 1715 };
1726 1716
1727 match db.trait_solve(self.krate, goal)? { 1717 match db.trait_solve(self.krate, goal)? {
1728 Solution::Unique(SolutionVariables(subst)) => subst.value.first().cloned(), 1718 Solution::Unique(SolutionVariables(subst)) => {
1719 subst.value.first().map(|ty| self.derived(ty.clone()))
1720 }
1729 Solution::Ambig(_) => None, 1721 Solution::Ambig(_) => None,
1730 } 1722 }
1731 .map(|ty| Type {
1732 krate: self.krate,
1733 ty: InEnvironment { value: ty, environment: Arc::clone(&self.ty.environment) },
1734 })
1735 } 1723 }
1736 1724
1737 pub fn is_copy(&self, db: &dyn HirDatabase) -> bool { 1725 pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {
diff --git a/crates/ide_assists/src/handlers/generate_function.rs b/crates/ide_assists/src/handlers/generate_function.rs
index 3870b7e75..6f95b1a07 100644
--- a/crates/ide_assists/src/handlers/generate_function.rs
+++ b/crates/ide_assists/src/handlers/generate_function.rs
@@ -83,17 +83,18 @@ struct FunctionTemplate {
83 leading_ws: String, 83 leading_ws: String,
84 fn_def: ast::Fn, 84 fn_def: ast::Fn,
85 ret_type: ast::RetType, 85 ret_type: ast::RetType,
86 should_render_snippet: bool,
86 trailing_ws: String, 87 trailing_ws: String,
87 file: FileId, 88 file: FileId,
88} 89}
89 90
90impl FunctionTemplate { 91impl FunctionTemplate {
91 fn to_string(&self, cap: Option<SnippetCap>) -> String { 92 fn to_string(&self, cap: Option<SnippetCap>) -> String {
92 let f = match cap { 93 let f = match (cap, self.should_render_snippet) {
93 Some(cap) => { 94 (Some(cap), true) => {
94 render_snippet(cap, self.fn_def.syntax(), Cursor::Replace(self.ret_type.syntax())) 95 render_snippet(cap, self.fn_def.syntax(), Cursor::Replace(self.ret_type.syntax()))
95 } 96 }
96 None => self.fn_def.to_string(), 97 _ => self.fn_def.to_string(),
97 }; 98 };
98 format!("{}{}{}", self.leading_ws, f, self.trailing_ws) 99 format!("{}{}{}", self.leading_ws, f, self.trailing_ws)
99 } 100 }
@@ -104,6 +105,8 @@ struct FunctionBuilder {
104 fn_name: ast::Name, 105 fn_name: ast::Name,
105 type_params: Option<ast::GenericParamList>, 106 type_params: Option<ast::GenericParamList>,
106 params: ast::ParamList, 107 params: ast::ParamList,
108 ret_type: ast::RetType,
109 should_render_snippet: bool,
107 file: FileId, 110 file: FileId,
108 needs_pub: bool, 111 needs_pub: bool,
109} 112}
@@ -132,7 +135,43 @@ impl FunctionBuilder {
132 let fn_name = fn_name(&path)?; 135 let fn_name = fn_name(&path)?;
133 let (type_params, params) = fn_args(ctx, target_module, &call)?; 136 let (type_params, params) = fn_args(ctx, target_module, &call)?;
134 137
135 Some(Self { target, fn_name, type_params, params, file, needs_pub }) 138 // should_render_snippet intends to express a rough level of confidence about
139 // the correctness of the return type.
140 //
141 // If we are able to infer some return type, and that return type is not unit, we
142 // don't want to render the snippet. The assumption here is in this situation the
143 // return type is just as likely to be correct as any other part of the generated
144 // function.
145 //
146 // In the case where the return type is inferred as unit it is likely that the
147 // user does in fact intend for this generated function to return some non unit
148 // type, but that the current state of their code doesn't allow that return type
149 // to be accurately inferred.
150 let (ret_ty, should_render_snippet) = {
151 match ctx.sema.type_of_expr(&ast::Expr::CallExpr(call.clone())) {
152 Some(ty) if ty.is_unknown() || ty.is_unit() => (make::ty_unit(), true),
153 Some(ty) => {
154 let rendered = ty.display_source_code(ctx.db(), target_module.into());
155 match rendered {
156 Ok(rendered) => (make::ty(&rendered), false),
157 Err(_) => (make::ty_unit(), true),
158 }
159 }
160 None => (make::ty_unit(), true),
161 }
162 };
163 let ret_type = make::ret_type(ret_ty);
164
165 Some(Self {
166 target,
167 fn_name,
168 type_params,
169 params,
170 ret_type,
171 should_render_snippet,
172 file,
173 needs_pub,
174 })
136 } 175 }
137 176
138 fn render(self) -> FunctionTemplate { 177 fn render(self) -> FunctionTemplate {
@@ -145,7 +184,7 @@ impl FunctionBuilder {
145 self.type_params, 184 self.type_params,
146 self.params, 185 self.params,
147 fn_body, 186 fn_body,
148 Some(make::ret_type(make::ty_unit())), 187 Some(self.ret_type),
149 ); 188 );
150 let leading_ws; 189 let leading_ws;
151 let trailing_ws; 190 let trailing_ws;
@@ -171,6 +210,7 @@ impl FunctionBuilder {
171 insert_offset, 210 insert_offset,
172 leading_ws, 211 leading_ws,
173 ret_type: fn_def.ret_type().unwrap(), 212 ret_type: fn_def.ret_type().unwrap(),
213 should_render_snippet: self.should_render_snippet,
174 fn_def, 214 fn_def,
175 trailing_ws, 215 trailing_ws,
176 file: self.file, 216 file: self.file,
@@ -546,7 +586,7 @@ impl Baz {
546 } 586 }
547} 587}
548 588
549fn bar(baz: Baz) ${0:-> ()} { 589fn bar(baz: Baz) -> Baz {
550 todo!() 590 todo!()
551} 591}
552", 592",
@@ -1060,6 +1100,27 @@ pub(crate) fn bar() ${0:-> ()} {
1060 } 1100 }
1061 1101
1062 #[test] 1102 #[test]
1103 fn add_function_with_return_type() {
1104 check_assist(
1105 generate_function,
1106 r"
1107fn main() {
1108 let x: u32 = foo$0();
1109}
1110",
1111 r"
1112fn main() {
1113 let x: u32 = foo();
1114}
1115
1116fn foo() -> u32 {
1117 todo!()
1118}
1119",
1120 )
1121 }
1122
1123 #[test]
1063 fn add_function_not_applicable_if_function_already_exists() { 1124 fn add_function_not_applicable_if_function_already_exists() {
1064 check_assist_not_applicable( 1125 check_assist_not_applicable(
1065 generate_function, 1126 generate_function,
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs
index 9c34ed0b6..d45ad7944 100644
--- a/crates/ide_completion/src/completions/postfix.rs
+++ b/crates/ide_completion/src/completions/postfix.rs
@@ -187,6 +187,16 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
187 ctx, 187 ctx,
188 cap, 188 cap,
189 &dot_receiver, 189 &dot_receiver,
190 "err",
191 "Err(expr)",
192 &format!("Err({})", receiver_text),
193 )
194 .add_to(acc);
195
196 postfix_snippet(
197 ctx,
198 cap,
199 &dot_receiver,
190 "some", 200 "some",
191 "Some(expr)", 201 "Some(expr)",
192 &format!("Some({})", receiver_text), 202 &format!("Some({})", receiver_text),
@@ -325,6 +335,7 @@ fn main() {
325 sn match match expr {} 335 sn match match expr {}
326 sn box Box::new(expr) 336 sn box Box::new(expr)
327 sn ok Ok(expr) 337 sn ok Ok(expr)
338 sn err Err(expr)
328 sn some Some(expr) 339 sn some Some(expr)
329 sn dbg dbg!(expr) 340 sn dbg dbg!(expr)
330 sn dbgr dbg!(&expr) 341 sn dbgr dbg!(&expr)
@@ -357,6 +368,7 @@ fn main() {
357 sn match match expr {} 368 sn match match expr {}
358 sn box Box::new(expr) 369 sn box Box::new(expr)
359 sn ok Ok(expr) 370 sn ok Ok(expr)
371 sn err Err(expr)
360 sn some Some(expr) 372 sn some Some(expr)
361 sn dbg dbg!(expr) 373 sn dbg dbg!(expr)
362 sn dbgr dbg!(&expr) 374 sn dbgr dbg!(&expr)
@@ -380,6 +392,7 @@ fn main() {
380 sn match match expr {} 392 sn match match expr {}
381 sn box Box::new(expr) 393 sn box Box::new(expr)
382 sn ok Ok(expr) 394 sn ok Ok(expr)
395 sn err Err(expr)
383 sn some Some(expr) 396 sn some Some(expr)
384 sn dbg dbg!(expr) 397 sn dbg dbg!(expr)
385 sn dbgr dbg!(&expr) 398 sn dbgr dbg!(&expr)
@@ -408,6 +421,7 @@ fn main() {
408 sn match match expr {} 421 sn match match expr {}
409 sn box Box::new(expr) 422 sn box Box::new(expr)
410 sn ok Ok(expr) 423 sn ok Ok(expr)
424 sn err Err(expr)
411 sn some Some(expr) 425 sn some Some(expr)
412 sn dbg dbg!(expr) 426 sn dbg dbg!(expr)
413 sn dbgr dbg!(&expr) 427 sn dbgr dbg!(&expr)
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 078c83f75..25df13554 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -16,7 +16,6 @@ use ide_db::helpers::{
16 insert_use::{InsertUseConfig, MergeBehavior}, 16 insert_use::{InsertUseConfig, MergeBehavior},
17 SnippetCap, 17 SnippetCap,
18}; 18};
19use itertools::Itertools;
20use lsp_types::{ClientCapabilities, MarkupKind}; 19use lsp_types::{ClientCapabilities, MarkupKind};
21use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest, RustcSource}; 20use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest, RustcSource};
22use rustc_hash::FxHashSet; 21use rustc_hash::FxHashSet;
@@ -98,13 +97,15 @@ config_data! {
98 diagnostics_enableExperimental: bool = "true", 97 diagnostics_enableExperimental: bool = "true",
99 /// List of rust-analyzer diagnostics to disable. 98 /// List of rust-analyzer diagnostics to disable.
100 diagnostics_disabled: FxHashSet<String> = "[]", 99 diagnostics_disabled: FxHashSet<String> = "[]",
101 /// List of warnings that should be displayed with info severity.\n\nThe 100 /// List of warnings that should be displayed with info severity.
102 /// warnings will be indicated by a blue squiggly underline in code and 101 ///
103 /// a blue icon in the `Problems Panel`. 102 /// The warnings will be indicated by a blue squiggly underline in code
103 /// and a blue icon in the `Problems Panel`.
104 diagnostics_warningsAsHint: Vec<String> = "[]", 104 diagnostics_warningsAsHint: Vec<String> = "[]",
105 /// List of warnings that should be displayed with hint severity.\n\nThe 105 /// List of warnings that should be displayed with hint severity.
106 /// warnings will be indicated by faded text or three dots in code and 106 ///
107 /// will not show up in the `Problems Panel`. 107 /// The warnings will be indicated by faded text or three dots in code
108 /// and will not show up in the `Problems Panel`.
108 diagnostics_warningsAsInfo: Vec<String> = "[]", 109 diagnostics_warningsAsInfo: Vec<String> = "[]",
109 110
110 /// Controls file watching implementation. 111 /// Controls file watching implementation.
@@ -158,7 +159,9 @@ config_data! {
158 lens_references: bool = "false", 159 lens_references: bool = "false",
159 160
160 /// Disable project auto-discovery in favor of explicitly specified set 161 /// Disable project auto-discovery in favor of explicitly specified set
161 /// of projects.\n\nElements must be paths pointing to `Cargo.toml`, 162 /// of projects.
163 ///
164 /// Elements must be paths pointing to `Cargo.toml`,
162 /// `rust-project.json`, or JSON objects in `rust-project.json` format. 165 /// `rust-project.json`, or JSON objects in `rust-project.json` format.
163 linkedProjects: Vec<ManifestOrProjectJson> = "[]", 166 linkedProjects: Vec<ManifestOrProjectJson> = "[]",
164 167
@@ -177,13 +180,17 @@ config_data! {
177 /// Command to be executed instead of 'cargo' for runnables. 180 /// Command to be executed instead of 'cargo' for runnables.
178 runnables_overrideCargo: Option<String> = "null", 181 runnables_overrideCargo: Option<String> = "null",
179 /// Additional arguments to be passed to cargo for runnables such as 182 /// Additional arguments to be passed to cargo for runnables such as
180 /// tests or binaries.\nFor example, it may be `--release`. 183 /// tests or binaries. For example, it may be `--release`.
181 runnables_cargoExtraArgs: Vec<String> = "[]", 184 runnables_cargoExtraArgs: Vec<String> = "[]",
182 185
183 /// Path to the rust compiler sources, for usage in rustc_private projects, or "discover" 186 /// Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private
184 /// to try to automatically find it. Any project which uses rust-analyzer with the rustcPrivate 187 /// projects, or "discover" to try to automatically find it.
188 ///
189 /// Any project which uses rust-analyzer with the rustcPrivate
185 /// crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it. 190 /// crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it.
186 rustcSource : Option<String> = "null", 191 ///
192 /// This option is not reloaded automatically; you must restart rust-analyzer for it to take effect.
193 rustcSource: Option<String> = "null",
187 194
188 /// Additional arguments to `rustfmt`. 195 /// Additional arguments to `rustfmt`.
189 rustfmt_extraArgs: Vec<String> = "[]", 196 rustfmt_extraArgs: Vec<String> = "[]",
@@ -761,7 +768,8 @@ fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json:
761} 768}
762 769
763fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json::Value { 770fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json::Value {
764 let doc = doc.iter().map(|it| it.trim()).join(" "); 771 let doc = doc_comment_to_string(doc);
772 let doc = doc.trim_end_matches('\n');
765 assert!( 773 assert!(
766 doc.ends_with('.') && doc.starts_with(char::is_uppercase), 774 doc.ends_with('.') && doc.starts_with(char::is_uppercase),
767 "bad docs for {}: {:?}", 775 "bad docs for {}: {:?}",
@@ -850,11 +858,16 @@ fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
850 .iter() 858 .iter()
851 .map(|(field, _ty, doc, default)| { 859 .map(|(field, _ty, doc, default)| {
852 let name = format!("rust-analyzer.{}", field.replace("_", ".")); 860 let name = format!("rust-analyzer.{}", field.replace("_", "."));
853 format!("[[{}]]{} (default: `{}`)::\n{}\n", name, name, default, doc.join(" ")) 861 let doc = doc_comment_to_string(*doc);
862 format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
854 }) 863 })
855 .collect::<String>() 864 .collect::<String>()
856} 865}
857 866
867fn doc_comment_to_string(doc: &[&str]) -> String {
868 doc.iter().map(|it| it.strip_prefix(' ').unwrap_or(it)).map(|it| format!("{}\n", it)).collect()
869}
870
858#[cfg(test)] 871#[cfg(test)]
859mod tests { 872mod tests {
860 use std::fs; 873 use std::fs;
@@ -897,13 +910,8 @@ mod tests {
897 #[test] 910 #[test]
898 fn generate_config_documentation() { 911 fn generate_config_documentation() {
899 let docs_path = project_root().join("docs/user/generated_config.adoc"); 912 let docs_path = project_root().join("docs/user/generated_config.adoc");
900 let current = fs::read_to_string(&docs_path).unwrap();
901 let expected = ConfigData::manual(); 913 let expected = ConfigData::manual();
902 914 ensure_file_contents(&docs_path, &expected);
903 if remove_ws(&current) != remove_ws(&expected) {
904 fs::write(&docs_path, expected).unwrap();
905 panic!("updated config manual");
906 }
907 } 915 }
908 916
909 fn remove_ws(text: &str) -> String { 917 fn remove_ws(text: &str) -> String {
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index c39095def..33bde099b 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -25,10 +25,10 @@ serde = { version = "1.0.106", features = ["derive"] }
25stdx = { path = "../stdx", version = "0.0.0" } 25stdx = { path = "../stdx", version = "0.0.0" }
26text_edit = { path = "../text_edit", version = "0.0.0" } 26text_edit = { path = "../text_edit", version = "0.0.0" }
27parser = { path = "../parser", version = "0.0.0" } 27parser = { path = "../parser", version = "0.0.0" }
28test_utils = { path = "../test_utils", version = "0.0.0" }
29profile = { path = "../profile", version = "0.0.0" } 28profile = { path = "../profile", version = "0.0.0" }
30 29
31[dev-dependencies] 30[dev-dependencies]
31test_utils = { path = "../test_utils" }
32walkdir = "2.3.1" 32walkdir = "2.3.1"
33rayon = "1" 33rayon = "1"
34expect-test = "1.1" 34expect-test = "1.1"
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 164c8482e..dd3ecc18d 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -39,7 +39,7 @@ If a language client does not know about `rust-analyzer`'s configuration options
39 39
40**Issue:** https://github.com/microsoft/language-server-protocol/issues/724 40**Issue:** https://github.com/microsoft/language-server-protocol/issues/724
41 41
42**Client Capability:** `{ "snippetTextEdit": boolean }` 42**Experimental Client Capability:** `{ "snippetTextEdit": boolean }`
43 43
44If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s: 44If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s:
45 45
@@ -72,7 +72,7 @@ At the moment, rust-analyzer guarantees that only a single edit will have `Inser
72 72
73**Issue:** https://github.com/microsoft/language-server-protocol/issues/994 73**Issue:** https://github.com/microsoft/language-server-protocol/issues/994
74 74
75**Client Capability:** `{ "codeActionGroup": boolean }` 75**Experimental Client Capability:** `{ "codeActionGroup": boolean }`
76 76
77If this capability is set, `CodeAction` returned from the server contain an additional field, `group`: 77If this capability is set, `CodeAction` returned from the server contain an additional field, `group`:
78 78
@@ -119,7 +119,7 @@ Invoking code action at this position will yield two code actions for importing
119 119
120**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002 120**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002
121 121
122**Server Capability:** `{ "parentModule": boolean }` 122**Experimental Server Capability:** `{ "parentModule": boolean }`
123 123
124This request is sent from client to server to handle "Goto Parent Module" editor action. 124This request is sent from client to server to handle "Goto Parent Module" editor action.
125 125
@@ -153,7 +153,7 @@ mod foo;
153 153
154**Issue:** https://github.com/microsoft/language-server-protocol/issues/992 154**Issue:** https://github.com/microsoft/language-server-protocol/issues/992
155 155
156**Server Capability:** `{ "joinLines": boolean }` 156**Experimental Server Capability:** `{ "joinLines": boolean }`
157 157
158This request is sent from client to server to handle "Join Lines" editor action. 158This request is sent from client to server to handle "Join Lines" editor action.
159 159
@@ -200,7 +200,7 @@ fn main() {
200 200
201**Issue:** https://github.com/microsoft/language-server-protocol/issues/1001 201**Issue:** https://github.com/microsoft/language-server-protocol/issues/1001
202 202
203**Server Capability:** `{ "onEnter": boolean }` 203**Experimental Server Capability:** `{ "onEnter": boolean }`
204 204
205This request is sent from client to server to handle <kbd>Enter</kbd> keypress. 205This request is sent from client to server to handle <kbd>Enter</kbd> keypress.
206 206
@@ -251,7 +251,7 @@ As proper cursor positioning is raison-d'etat for `onEnter`, it uses `SnippetTex
251 251
252## Structural Search Replace (SSR) 252## Structural Search Replace (SSR)
253 253
254**Server Capability:** `{ "ssr": boolean }` 254**Experimental Server Capability:** `{ "ssr": boolean }`
255 255
256This request is sent from client to server to handle structural search replace -- automated syntax tree based transformation of the source. 256This request is sent from client to server to handle structural search replace -- automated syntax tree based transformation of the source.
257 257
@@ -293,7 +293,7 @@ SSR with query `foo($a, $b) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)
293 293
294**Issue:** https://github.com/microsoft/language-server-protocol/issues/999 294**Issue:** https://github.com/microsoft/language-server-protocol/issues/999
295 295
296**Server Capability:** `{ "matchingBrace": boolean }` 296**Experimental Server Capability:** `{ "matchingBrace": boolean }`
297 297
298This request is sent from client to server to handle "Matching Brace" editor action. 298This request is sent from client to server to handle "Matching Brace" editor action.
299 299
@@ -338,7 +338,7 @@ Moreover, it would be cool if editors didn't need to implement even basic langua
338 338
339**Issue:** https://github.com/microsoft/language-server-protocol/issues/944 339**Issue:** https://github.com/microsoft/language-server-protocol/issues/944
340 340
341**Server Capability:** `{ "runnables": { "kinds": string[] } }` 341**Experimental Server Capability:** `{ "runnables": { "kinds": string[] } }`
342 342
343This request is sent from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`). 343This request is sent from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`).
344 344
@@ -421,7 +421,7 @@ Reloads project information (that is, re-executes `cargo metadata`).
421 421
422## Status Notification 422## Status Notification
423 423
424**Client Capability:** `{ "statusNotification": boolean }` 424**Experimental Client Capability:** `{ "statusNotification": boolean }`
425 425
426**Method:** `rust-analyzer/status` 426**Method:** `rust-analyzer/status`
427 427
@@ -519,7 +519,7 @@ interface InlayHint {
519 519
520## Hover Actions 520## Hover Actions
521 521
522**Client Capability:** `{ "hoverActions": boolean }` 522**Experimental Client Capability:** `{ "hoverActions": boolean }`
523 523
524If this capability is set, `Hover` request returned from the server might contain an additional field, `actions`: 524If this capability is set, `Hover` request returned from the server might contain an additional field, `actions`:
525 525
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index 5243bcbf6..042ba2d54 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -1,114 +1,322 @@
1[[rust-analyzer.assist.importMergeBehavior]]rust-analyzer.assist.importMergeBehavior (default: `"full"`):: 1[[rust-analyzer.assist.importMergeBehavior]]rust-analyzer.assist.importMergeBehavior (default: `"full"`)::
2 The strategy to use when inserting new imports or merging imports. 2+
3--
4The strategy to use when inserting new imports or merging imports.
5--
3[[rust-analyzer.assist.importPrefix]]rust-analyzer.assist.importPrefix (default: `"plain"`):: 6[[rust-analyzer.assist.importPrefix]]rust-analyzer.assist.importPrefix (default: `"plain"`)::
4 The path structure for newly inserted paths to use. 7+
8--
9The path structure for newly inserted paths to use.
10--
5[[rust-analyzer.assist.importGroup]]rust-analyzer.assist.importGroup (default: `true`):: 11[[rust-analyzer.assist.importGroup]]rust-analyzer.assist.importGroup (default: `true`)::
6 Group inserted imports by the [following order](https://rust-analyzer.github.io/manual.html#auto-import). Groups are separated by newlines. 12+
13--
14Group inserted imports by the [following order](https://rust-analyzer.github.io/manual.html#auto-import). Groups are separated by newlines.
15--
7[[rust-analyzer.callInfo.full]]rust-analyzer.callInfo.full (default: `true`):: 16[[rust-analyzer.callInfo.full]]rust-analyzer.callInfo.full (default: `true`)::
8 Show function name and docs in parameter hints. 17+
18--
19Show function name and docs in parameter hints.
20--
9[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`):: 21[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
10 Automatically refresh project info via `cargo metadata` on `Cargo.toml` changes. 22+
23--
24Automatically refresh project info via `cargo metadata` on
25`Cargo.toml` changes.
26--
11[[rust-analyzer.cargo.allFeatures]]rust-analyzer.cargo.allFeatures (default: `false`):: 27[[rust-analyzer.cargo.allFeatures]]rust-analyzer.cargo.allFeatures (default: `false`)::
12 Activate all available features (`--all-features`). 28+
29--
30Activate all available features (`--all-features`).
31--
13[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`):: 32[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
14 List of features to activate. 33+
34--
35List of features to activate.
36--
15[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `true`):: 37[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `true`)::
16 Run build scripts (`build.rs`) for more precise code analysis. 38+
39--
40Run build scripts (`build.rs`) for more precise code analysis.
41--
17[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: 42[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
18 Do not activate the `default` feature. 43+
44--
45Do not activate the `default` feature.
46--
19[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: 47[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
20 Compilation target (target triple). 48+
49--
50Compilation target (target triple).
51--
21[[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`):: 52[[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`)::
22 Internal config for debugging, disables loading of sysroot crates. 53+
54--
55Internal config for debugging, disables loading of sysroot crates.
56--
23[[rust-analyzer.checkOnSave.enable]]rust-analyzer.checkOnSave.enable (default: `true`):: 57[[rust-analyzer.checkOnSave.enable]]rust-analyzer.checkOnSave.enable (default: `true`)::
24 Run specified `cargo check` command for diagnostics on save. 58+
59--
60Run specified `cargo check` command for diagnostics on save.
61--
25[[rust-analyzer.checkOnSave.allFeatures]]rust-analyzer.checkOnSave.allFeatures (default: `null`):: 62[[rust-analyzer.checkOnSave.allFeatures]]rust-analyzer.checkOnSave.allFeatures (default: `null`)::
26 Check with all features (`--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`. 63+
64--
65Check with all features (`--all-features`).
66Defaults to `#rust-analyzer.cargo.allFeatures#`.
67--
27[[rust-analyzer.checkOnSave.allTargets]]rust-analyzer.checkOnSave.allTargets (default: `true`):: 68[[rust-analyzer.checkOnSave.allTargets]]rust-analyzer.checkOnSave.allTargets (default: `true`)::
28 Check all targets and tests (`--all-targets`). 69+
70--
71Check all targets and tests (`--all-targets`).
72--
29[[rust-analyzer.checkOnSave.command]]rust-analyzer.checkOnSave.command (default: `"check"`):: 73[[rust-analyzer.checkOnSave.command]]rust-analyzer.checkOnSave.command (default: `"check"`)::
30 Cargo command to use for `cargo check`. 74+
75--
76Cargo command to use for `cargo check`.
77--
31[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`):: 78[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
32 Do not activate the `default` feature. 79+
80--
81Do not activate the `default` feature.
82--
33[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`):: 83[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`)::
34 Check for a specific target. Defaults to `#rust-analyzer.cargo.target#`. 84+
85--
86Check for a specific target. Defaults to
87`#rust-analyzer.cargo.target#`.
88--
35[[rust-analyzer.checkOnSave.extraArgs]]rust-analyzer.checkOnSave.extraArgs (default: `[]`):: 89[[rust-analyzer.checkOnSave.extraArgs]]rust-analyzer.checkOnSave.extraArgs (default: `[]`)::
36 Extra arguments for `cargo check`. 90+
91--
92Extra arguments for `cargo check`.
93--
37[[rust-analyzer.checkOnSave.features]]rust-analyzer.checkOnSave.features (default: `null`):: 94[[rust-analyzer.checkOnSave.features]]rust-analyzer.checkOnSave.features (default: `null`)::
38 List of features to activate. Defaults to `#rust-analyzer.cargo.features#`. 95+
96--
97List of features to activate. Defaults to
98`#rust-analyzer.cargo.features#`.
99--
39[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`):: 100[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
40 Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message-format=json` or similar option. 101+
102--
103Advanced option, fully override the command rust-analyzer uses for
104checking. The command should include `--message-format=json` or
105similar option.
106--
41[[rust-analyzer.completion.addCallArgumentSnippets]]rust-analyzer.completion.addCallArgumentSnippets (default: `true`):: 107[[rust-analyzer.completion.addCallArgumentSnippets]]rust-analyzer.completion.addCallArgumentSnippets (default: `true`)::
42 Whether to add argument snippets when completing functions. 108+
109--
110Whether to add argument snippets when completing functions.
111--
43[[rust-analyzer.completion.addCallParenthesis]]rust-analyzer.completion.addCallParenthesis (default: `true`):: 112[[rust-analyzer.completion.addCallParenthesis]]rust-analyzer.completion.addCallParenthesis (default: `true`)::
44 Whether to add parenthesis when completing functions. 113+
114--
115Whether to add parenthesis when completing functions.
116--
45[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`):: 117[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
46 Whether to show postfix snippets like `dbg`, `if`, `not`, etc. 118+
119--
120Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
121--
47[[rust-analyzer.completion.autoimport.enable]]rust-analyzer.completion.autoimport.enable (default: `true`):: 122[[rust-analyzer.completion.autoimport.enable]]rust-analyzer.completion.autoimport.enable (default: `true`)::
48 Toggles the additional completions that automatically add imports when completed. Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. 123+
124--
125Toggles the additional completions that automatically add imports when completed.
126Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
127--
49[[rust-analyzer.diagnostics.enable]]rust-analyzer.diagnostics.enable (default: `true`):: 128[[rust-analyzer.diagnostics.enable]]rust-analyzer.diagnostics.enable (default: `true`)::
50 Whether to show native rust-analyzer diagnostics. 129+
130--
131Whether to show native rust-analyzer diagnostics.
132--
51[[rust-analyzer.diagnostics.enableExperimental]]rust-analyzer.diagnostics.enableExperimental (default: `true`):: 133[[rust-analyzer.diagnostics.enableExperimental]]rust-analyzer.diagnostics.enableExperimental (default: `true`)::
52 Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual. 134+
135--
136Whether to show experimental rust-analyzer diagnostics that might
137have more false positives than usual.
138--
53[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]`):: 139[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]`)::
54 List of rust-analyzer diagnostics to disable. 140+
141--
142List of rust-analyzer diagnostics to disable.
143--
55[[rust-analyzer.diagnostics.warningsAsHint]]rust-analyzer.diagnostics.warningsAsHint (default: `[]`):: 144[[rust-analyzer.diagnostics.warningsAsHint]]rust-analyzer.diagnostics.warningsAsHint (default: `[]`)::
56 List of warnings that should be displayed with info severity.\n\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the `Problems Panel`. 145+
146--
147List of warnings that should be displayed with info severity.
148
149The warnings will be indicated by a blue squiggly underline in code
150and a blue icon in the `Problems Panel`.
151--
57[[rust-analyzer.diagnostics.warningsAsInfo]]rust-analyzer.diagnostics.warningsAsInfo (default: `[]`):: 152[[rust-analyzer.diagnostics.warningsAsInfo]]rust-analyzer.diagnostics.warningsAsInfo (default: `[]`)::
58 List of warnings that should be displayed with hint severity.\n\nThe warnings will be indicated by faded text or three dots in code and will not show up in the `Problems Panel`. 153+
154--
155List of warnings that should be displayed with hint severity.
156
157The warnings will be indicated by faded text or three dots in code
158and will not show up in the `Problems Panel`.
159--
59[[rust-analyzer.files.watcher]]rust-analyzer.files.watcher (default: `"client"`):: 160[[rust-analyzer.files.watcher]]rust-analyzer.files.watcher (default: `"client"`)::
60 Controls file watching implementation. 161+
162--
163Controls file watching implementation.
164--
61[[rust-analyzer.files.excludeDirs]]rust-analyzer.files.excludeDirs (default: `[]`):: 165[[rust-analyzer.files.excludeDirs]]rust-analyzer.files.excludeDirs (default: `[]`)::
62 These directories will be ignored by rust-analyzer. 166+
167--
168These directories will be ignored by rust-analyzer.
169--
63[[rust-analyzer.hoverActions.debug]]rust-analyzer.hoverActions.debug (default: `true`):: 170[[rust-analyzer.hoverActions.debug]]rust-analyzer.hoverActions.debug (default: `true`)::
64 Whether to show `Debug` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set. 171+
172--
173Whether to show `Debug` action. Only applies when
174`#rust-analyzer.hoverActions.enable#` is set.
175--
65[[rust-analyzer.hoverActions.enable]]rust-analyzer.hoverActions.enable (default: `true`):: 176[[rust-analyzer.hoverActions.enable]]rust-analyzer.hoverActions.enable (default: `true`)::
66 Whether to show HoverActions in Rust files. 177+
178--
179Whether to show HoverActions in Rust files.
180--
67[[rust-analyzer.hoverActions.gotoTypeDef]]rust-analyzer.hoverActions.gotoTypeDef (default: `true`):: 181[[rust-analyzer.hoverActions.gotoTypeDef]]rust-analyzer.hoverActions.gotoTypeDef (default: `true`)::
68 Whether to show `Go to Type Definition` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set. 182+
183--
184Whether to show `Go to Type Definition` action. Only applies when
185`#rust-analyzer.hoverActions.enable#` is set.
186--
69[[rust-analyzer.hoverActions.implementations]]rust-analyzer.hoverActions.implementations (default: `true`):: 187[[rust-analyzer.hoverActions.implementations]]rust-analyzer.hoverActions.implementations (default: `true`)::
70 Whether to show `Implementations` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set. 188+
189--
190Whether to show `Implementations` action. Only applies when
191`#rust-analyzer.hoverActions.enable#` is set.
192--
71[[rust-analyzer.hoverActions.run]]rust-analyzer.hoverActions.run (default: `true`):: 193[[rust-analyzer.hoverActions.run]]rust-analyzer.hoverActions.run (default: `true`)::
72 Whether to show `Run` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set. 194+
195--
196Whether to show `Run` action. Only applies when
197`#rust-analyzer.hoverActions.enable#` is set.
198--
73[[rust-analyzer.hoverActions.linksInHover]]rust-analyzer.hoverActions.linksInHover (default: `true`):: 199[[rust-analyzer.hoverActions.linksInHover]]rust-analyzer.hoverActions.linksInHover (default: `true`)::
74 Use markdown syntax for links in hover. 200+
201--
202Use markdown syntax for links in hover.
203--
75[[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`):: 204[[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`)::
76 Whether to show inlay type hints for method chains. 205+
206--
207Whether to show inlay type hints for method chains.
208--
77[[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `null`):: 209[[rust-analyzer.inlayHints.maxLength]]rust-analyzer.inlayHints.maxLength (default: `null`)::
78 Maximum length for inlay hints. Default is unlimited. 210+
211--
212Maximum length for inlay hints. Default is unlimited.
213--
79[[rust-analyzer.inlayHints.parameterHints]]rust-analyzer.inlayHints.parameterHints (default: `true`):: 214[[rust-analyzer.inlayHints.parameterHints]]rust-analyzer.inlayHints.parameterHints (default: `true`)::
80 Whether to show function parameter name inlay hints at the call site. 215+
216--
217Whether to show function parameter name inlay hints at the call
218site.
219--
81[[rust-analyzer.inlayHints.typeHints]]rust-analyzer.inlayHints.typeHints (default: `true`):: 220[[rust-analyzer.inlayHints.typeHints]]rust-analyzer.inlayHints.typeHints (default: `true`)::
82 Whether to show inlay type hints for variables. 221+
222--
223Whether to show inlay type hints for variables.
224--
83[[rust-analyzer.lens.debug]]rust-analyzer.lens.debug (default: `true`):: 225[[rust-analyzer.lens.debug]]rust-analyzer.lens.debug (default: `true`)::
84 Whether to show `Debug` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 226+
227--
228Whether to show `Debug` lens. Only applies when
229`#rust-analyzer.lens.enable#` is set.
230--
85[[rust-analyzer.lens.enable]]rust-analyzer.lens.enable (default: `true`):: 231[[rust-analyzer.lens.enable]]rust-analyzer.lens.enable (default: `true`)::
86 Whether to show CodeLens in Rust files. 232+
233--
234Whether to show CodeLens in Rust files.
235--
87[[rust-analyzer.lens.implementations]]rust-analyzer.lens.implementations (default: `true`):: 236[[rust-analyzer.lens.implementations]]rust-analyzer.lens.implementations (default: `true`)::
88 Whether to show `Implementations` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 237+
238--
239Whether to show `Implementations` lens. Only applies when
240`#rust-analyzer.lens.enable#` is set.
241--
89[[rust-analyzer.lens.run]]rust-analyzer.lens.run (default: `true`):: 242[[rust-analyzer.lens.run]]rust-analyzer.lens.run (default: `true`)::
90 Whether to show `Run` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 243+
244--
245Whether to show `Run` lens. Only applies when
246`#rust-analyzer.lens.enable#` is set.
247--
91[[rust-analyzer.lens.methodReferences]]rust-analyzer.lens.methodReferences (default: `false`):: 248[[rust-analyzer.lens.methodReferences]]rust-analyzer.lens.methodReferences (default: `false`)::
92 Whether to show `Method References` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 249+
250--
251Whether to show `Method References` lens. Only applies when
252`#rust-analyzer.lens.enable#` is set.
253--
93[[rust-analyzer.lens.references]]rust-analyzer.lens.references (default: `false`):: 254[[rust-analyzer.lens.references]]rust-analyzer.lens.references (default: `false`)::
94 Whether to show `References` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 255+
256--
257Whether to show `References` lens. Only applies when
258`#rust-analyzer.lens.enable#` is set.
259--
95[[rust-analyzer.linkedProjects]]rust-analyzer.linkedProjects (default: `[]`):: 260[[rust-analyzer.linkedProjects]]rust-analyzer.linkedProjects (default: `[]`)::
96 Disable project auto-discovery in favor of explicitly specified set of projects.\n\nElements must be paths pointing to `Cargo.toml`, `rust-project.json`, or JSON objects in `rust-project.json` format. 261+
262--
263Disable project auto-discovery in favor of explicitly specified set
264of projects.
265
266Elements must be paths pointing to `Cargo.toml`,
267`rust-project.json`, or JSON objects in `rust-project.json` format.
268--
97[[rust-analyzer.lruCapacity]]rust-analyzer.lruCapacity (default: `null`):: 269[[rust-analyzer.lruCapacity]]rust-analyzer.lruCapacity (default: `null`)::
98 Number of syntax trees rust-analyzer keeps in memory. Defaults to 128. 270+
271--
272Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
273--
99[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`):: 274[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`)::
100 Whether to show `can't find Cargo.toml` error message. 275+
276--
277Whether to show `can't find Cargo.toml` error message.
278--
101[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`):: 279[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`)::
102 Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`. 280+
281--
282Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
283--
103[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`):: 284[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`)::
104 Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests). 285+
286--
287Internal config, path to proc-macro server executable (typically,
288this is rust-analyzer itself, but we override this in tests).
289--
105[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`):: 290[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::
106 Command to be executed instead of 'cargo' for runnables. 291+
292--
293Command to be executed instead of 'cargo' for runnables.
294--
107[[rust-analyzer.runnables.cargoExtraArgs]]rust-analyzer.runnables.cargoExtraArgs (default: `[]`):: 295[[rust-analyzer.runnables.cargoExtraArgs]]rust-analyzer.runnables.cargoExtraArgs (default: `[]`)::
108 Additional arguments to be passed to cargo for runnables such as tests or binaries.\nFor example, it may be `--release`. 296+
297--
298Additional arguments to be passed to cargo for runnables such as
299tests or binaries. For example, it may be `--release`.
300--
109[[rust-analyzer.rustcSource]]rust-analyzer.rustcSource (default: `null`):: 301[[rust-analyzer.rustcSource]]rust-analyzer.rustcSource (default: `null`)::
110 Path to the rust compiler sources, for usage in rustc_private projects, or "discover" to try to automatically find it. Any project which uses rust-analyzer with the rustcPrivate crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it. 302+
303--
304Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private
305projects, or "discover" to try to automatically find it.
306
307Any project which uses rust-analyzer with the rustcPrivate
308crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it.
309
310This option is not reloaded automatically; you must restart rust-analyzer for it to take effect.
311--
111[[rust-analyzer.rustfmt.extraArgs]]rust-analyzer.rustfmt.extraArgs (default: `[]`):: 312[[rust-analyzer.rustfmt.extraArgs]]rust-analyzer.rustfmt.extraArgs (default: `[]`)::
112 Additional arguments to `rustfmt`. 313+
314--
315Additional arguments to `rustfmt`.
316--
113[[rust-analyzer.rustfmt.overrideCommand]]rust-analyzer.rustfmt.overrideCommand (default: `null`):: 317[[rust-analyzer.rustfmt.overrideCommand]]rust-analyzer.rustfmt.overrideCommand (default: `null`)::
114 Advanced option, fully override the command rust-analyzer uses for formatting. 318+
319--
320Advanced option, fully override the command rust-analyzer uses for
321formatting.
322--
diff --git a/editors/code/package.json b/editors/code/package.json
index 856f1c94e..b29f006f0 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -397,7 +397,7 @@
397 "type": "boolean" 397 "type": "boolean"
398 }, 398 },
399 "rust-analyzer.cargo.autoreload": { 399 "rust-analyzer.cargo.autoreload": {
400 "markdownDescription": "Automatically refresh project info via `cargo metadata` on `Cargo.toml` changes.", 400 "markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` changes.",
401 "default": true, 401 "default": true,
402 "type": "boolean" 402 "type": "boolean"
403 }, 403 },
@@ -443,7 +443,7 @@
443 "type": "boolean" 443 "type": "boolean"
444 }, 444 },
445 "rust-analyzer.checkOnSave.allFeatures": { 445 "rust-analyzer.checkOnSave.allFeatures": {
446 "markdownDescription": "Check with all features (`--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`.", 446 "markdownDescription": "Check with all features (`--all-features`).\nDefaults to `#rust-analyzer.cargo.allFeatures#`.",
447 "default": null, 447 "default": null,
448 "type": [ 448 "type": [
449 "null", 449 "null",
@@ -469,7 +469,7 @@
469 ] 469 ]
470 }, 470 },
471 "rust-analyzer.checkOnSave.target": { 471 "rust-analyzer.checkOnSave.target": {
472 "markdownDescription": "Check for a specific target. Defaults to `#rust-analyzer.cargo.target#`.", 472 "markdownDescription": "Check for a specific target. Defaults to\n`#rust-analyzer.cargo.target#`.",
473 "default": null, 473 "default": null,
474 "type": [ 474 "type": [
475 "null", 475 "null",
@@ -485,7 +485,7 @@
485 } 485 }
486 }, 486 },
487 "rust-analyzer.checkOnSave.features": { 487 "rust-analyzer.checkOnSave.features": {
488 "markdownDescription": "List of features to activate. Defaults to `#rust-analyzer.cargo.features#`.", 488 "markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.",
489 "default": null, 489 "default": null,
490 "type": [ 490 "type": [
491 "null", 491 "null",
@@ -496,7 +496,7 @@
496 } 496 }
497 }, 497 },
498 "rust-analyzer.checkOnSave.overrideCommand": { 498 "rust-analyzer.checkOnSave.overrideCommand": {
499 "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message-format=json` or similar option.", 499 "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nchecking. The command should include `--message-format=json` or\nsimilar option.",
500 "default": null, 500 "default": null,
501 "type": [ 501 "type": [
502 "null", 502 "null",
@@ -522,7 +522,7 @@
522 "type": "boolean" 522 "type": "boolean"
523 }, 523 },
524 "rust-analyzer.completion.autoimport.enable": { 524 "rust-analyzer.completion.autoimport.enable": {
525 "markdownDescription": "Toggles the additional completions that automatically add imports when completed. Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.", 525 "markdownDescription": "Toggles the additional completions that automatically add imports when completed.\nNote that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.",
526 "default": true, 526 "default": true,
527 "type": "boolean" 527 "type": "boolean"
528 }, 528 },
@@ -532,7 +532,7 @@
532 "type": "boolean" 532 "type": "boolean"
533 }, 533 },
534 "rust-analyzer.diagnostics.enableExperimental": { 534 "rust-analyzer.diagnostics.enableExperimental": {
535 "markdownDescription": "Whether to show experimental rust-analyzer diagnostics that might have more false positives than usual.", 535 "markdownDescription": "Whether to show experimental rust-analyzer diagnostics that might\nhave more false positives than usual.",
536 "default": true, 536 "default": true,
537 "type": "boolean" 537 "type": "boolean"
538 }, 538 },
@@ -546,7 +546,7 @@
546 "uniqueItems": true 546 "uniqueItems": true
547 }, 547 },
548 "rust-analyzer.diagnostics.warningsAsHint": { 548 "rust-analyzer.diagnostics.warningsAsHint": {
549 "markdownDescription": "List of warnings that should be displayed with info severity.\\n\\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the `Problems Panel`.", 549 "markdownDescription": "List of warnings that should be displayed with info severity.\n\nThe warnings will be indicated by a blue squiggly underline in code\nand a blue icon in the `Problems Panel`.",
550 "default": [], 550 "default": [],
551 "type": "array", 551 "type": "array",
552 "items": { 552 "items": {
@@ -554,7 +554,7 @@
554 } 554 }
555 }, 555 },
556 "rust-analyzer.diagnostics.warningsAsInfo": { 556 "rust-analyzer.diagnostics.warningsAsInfo": {
557 "markdownDescription": "List of warnings that should be displayed with hint severity.\\n\\nThe warnings will be indicated by faded text or three dots in code and will not show up in the `Problems Panel`.", 557 "markdownDescription": "List of warnings that should be displayed with hint severity.\n\nThe warnings will be indicated by faded text or three dots in code\nand will not show up in the `Problems Panel`.",
558 "default": [], 558 "default": [],
559 "type": "array", 559 "type": "array",
560 "items": { 560 "items": {
@@ -575,7 +575,7 @@
575 } 575 }
576 }, 576 },
577 "rust-analyzer.hoverActions.debug": { 577 "rust-analyzer.hoverActions.debug": {
578 "markdownDescription": "Whether to show `Debug` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", 578 "markdownDescription": "Whether to show `Debug` action. Only applies when\n`#rust-analyzer.hoverActions.enable#` is set.",
579 "default": true, 579 "default": true,
580 "type": "boolean" 580 "type": "boolean"
581 }, 581 },
@@ -585,17 +585,17 @@
585 "type": "boolean" 585 "type": "boolean"
586 }, 586 },
587 "rust-analyzer.hoverActions.gotoTypeDef": { 587 "rust-analyzer.hoverActions.gotoTypeDef": {
588 "markdownDescription": "Whether to show `Go to Type Definition` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", 588 "markdownDescription": "Whether to show `Go to Type Definition` action. Only applies when\n`#rust-analyzer.hoverActions.enable#` is set.",
589 "default": true, 589 "default": true,
590 "type": "boolean" 590 "type": "boolean"
591 }, 591 },
592 "rust-analyzer.hoverActions.implementations": { 592 "rust-analyzer.hoverActions.implementations": {
593 "markdownDescription": "Whether to show `Implementations` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", 593 "markdownDescription": "Whether to show `Implementations` action. Only applies when\n`#rust-analyzer.hoverActions.enable#` is set.",
594 "default": true, 594 "default": true,
595 "type": "boolean" 595 "type": "boolean"
596 }, 596 },
597 "rust-analyzer.hoverActions.run": { 597 "rust-analyzer.hoverActions.run": {
598 "markdownDescription": "Whether to show `Run` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.", 598 "markdownDescription": "Whether to show `Run` action. Only applies when\n`#rust-analyzer.hoverActions.enable#` is set.",
599 "default": true, 599 "default": true,
600 "type": "boolean" 600 "type": "boolean"
601 }, 601 },
@@ -619,7 +619,7 @@
619 "minimum": 0 619 "minimum": 0
620 }, 620 },
621 "rust-analyzer.inlayHints.parameterHints": { 621 "rust-analyzer.inlayHints.parameterHints": {
622 "markdownDescription": "Whether to show function parameter name inlay hints at the call site.", 622 "markdownDescription": "Whether to show function parameter name inlay hints at the call\nsite.",
623 "default": true, 623 "default": true,
624 "type": "boolean" 624 "type": "boolean"
625 }, 625 },
@@ -629,7 +629,7 @@
629 "type": "boolean" 629 "type": "boolean"
630 }, 630 },
631 "rust-analyzer.lens.debug": { 631 "rust-analyzer.lens.debug": {
632 "markdownDescription": "Whether to show `Debug` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", 632 "markdownDescription": "Whether to show `Debug` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
633 "default": true, 633 "default": true,
634 "type": "boolean" 634 "type": "boolean"
635 }, 635 },
@@ -639,27 +639,27 @@
639 "type": "boolean" 639 "type": "boolean"
640 }, 640 },
641 "rust-analyzer.lens.implementations": { 641 "rust-analyzer.lens.implementations": {
642 "markdownDescription": "Whether to show `Implementations` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", 642 "markdownDescription": "Whether to show `Implementations` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
643 "default": true, 643 "default": true,
644 "type": "boolean" 644 "type": "boolean"
645 }, 645 },
646 "rust-analyzer.lens.run": { 646 "rust-analyzer.lens.run": {
647 "markdownDescription": "Whether to show `Run` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", 647 "markdownDescription": "Whether to show `Run` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
648 "default": true, 648 "default": true,
649 "type": "boolean" 649 "type": "boolean"
650 }, 650 },
651 "rust-analyzer.lens.methodReferences": { 651 "rust-analyzer.lens.methodReferences": {
652 "markdownDescription": "Whether to show `Method References` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", 652 "markdownDescription": "Whether to show `Method References` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
653 "default": false, 653 "default": false,
654 "type": "boolean" 654 "type": "boolean"
655 }, 655 },
656 "rust-analyzer.lens.references": { 656 "rust-analyzer.lens.references": {
657 "markdownDescription": "Whether to show `References` lens. Only applies when `#rust-analyzer.lens.enable#` is set.", 657 "markdownDescription": "Whether to show `References` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
658 "default": false, 658 "default": false,
659 "type": "boolean" 659 "type": "boolean"
660 }, 660 },
661 "rust-analyzer.linkedProjects": { 661 "rust-analyzer.linkedProjects": {
662 "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects.\\n\\nElements must be paths pointing to `Cargo.toml`, `rust-project.json`, or JSON objects in `rust-project.json` format.", 662 "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set\nof projects.\n\nElements must be paths pointing to `Cargo.toml`,\n`rust-project.json`, or JSON objects in `rust-project.json` format.",
663 "default": [], 663 "default": [],
664 "type": "array", 664 "type": "array",
665 "items": { 665 "items": {
@@ -689,7 +689,7 @@
689 "type": "boolean" 689 "type": "boolean"
690 }, 690 },
691 "rust-analyzer.procMacro.server": { 691 "rust-analyzer.procMacro.server": {
692 "markdownDescription": "Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests).", 692 "markdownDescription": "Internal config, path to proc-macro server executable (typically,\nthis is rust-analyzer itself, but we override this in tests).",
693 "default": null, 693 "default": null,
694 "type": [ 694 "type": [
695 "null", 695 "null",
@@ -705,7 +705,7 @@
705 ] 705 ]
706 }, 706 },
707 "rust-analyzer.runnables.cargoExtraArgs": { 707 "rust-analyzer.runnables.cargoExtraArgs": {
708 "markdownDescription": "Additional arguments to be passed to cargo for runnables such as tests or binaries.\\nFor example, it may be `--release`.", 708 "markdownDescription": "Additional arguments to be passed to cargo for runnables such as\ntests or binaries. For example, it may be `--release`.",
709 "default": [], 709 "default": [],
710 "type": "array", 710 "type": "array",
711 "items": { 711 "items": {
@@ -713,7 +713,7 @@
713 } 713 }
714 }, 714 },
715 "rust-analyzer.rustcSource": { 715 "rust-analyzer.rustcSource": {
716 "markdownDescription": "Path to the rust compiler sources, for usage in rustc_private projects, or \"discover\" to try to automatically find it. Any project which uses rust-analyzer with the rustcPrivate crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it.", 716 "markdownDescription": "Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private\nprojects, or \"discover\" to try to automatically find it.\n\nAny project which uses rust-analyzer with the rustcPrivate\ncrates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it.\n\nThis option is not reloaded automatically; you must restart rust-analyzer for it to take effect.",
717 "default": null, 717 "default": null,
718 "type": [ 718 "type": [
719 "null", 719 "null",
@@ -729,7 +729,7 @@
729 } 729 }
730 }, 730 },
731 "rust-analyzer.rustfmt.overrideCommand": { 731 "rust-analyzer.rustfmt.overrideCommand": {
732 "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting.", 732 "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nformatting.",
733 "default": null, 733 "default": null,
734 "type": [ 734 "type": [
735 "null", 735 "null",