diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 61 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 5 | ||||
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 33 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/world.rs | 7 |
8 files changed, 74 insertions, 43 deletions
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index 486832529..7235c944c 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -21,7 +21,6 @@ rustc-hash = "1.1.0" | |||
21 | rand = { version = "0.7.3", features = ["small_rng"] } | 21 | rand = { version = "0.7.3", features = ["small_rng"] } |
22 | 22 | ||
23 | ra_syntax = { path = "../ra_syntax" } | 23 | ra_syntax = { path = "../ra_syntax" } |
24 | ra_project_model = { path = "../ra_project_model" } | ||
25 | ra_text_edit = { path = "../ra_text_edit" } | 24 | ra_text_edit = { path = "../ra_text_edit" } |
26 | ra_db = { path = "../ra_db" } | 25 | ra_db = { path = "../ra_db" } |
27 | ra_ide_db = { path = "../ra_ide_db" } | 26 | ra_ide_db = { path = "../ra_ide_db" } |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 0f1c13c14..8454a975b 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -3,7 +3,6 @@ | |||
3 | use hir::{Adt, HirDisplay, Semantics, Type}; | 3 | use hir::{Adt, HirDisplay, Semantics, Type}; |
4 | use ra_ide_db::RootDatabase; | 4 | use ra_ide_db::RootDatabase; |
5 | use ra_prof::profile; | 5 | use ra_prof::profile; |
6 | use ra_project_model::{InlayHintDisplayType, InlayHintOptions}; | ||
7 | use ra_syntax::{ | 6 | use ra_syntax::{ |
8 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, | 7 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, |
9 | match_ast, SmolStr, TextRange, | 8 | match_ast, SmolStr, TextRange, |
@@ -11,7 +10,19 @@ use ra_syntax::{ | |||
11 | 10 | ||
12 | use crate::{FileId, FunctionSignature}; | 11 | use crate::{FileId, FunctionSignature}; |
13 | 12 | ||
14 | #[derive(Debug, PartialEq, Eq)] | 13 | #[derive(Clone, Debug, PartialEq, Eq)] |
14 | pub struct InlayConfig { | ||
15 | pub display_type: Vec<InlayKind>, | ||
16 | pub max_length: Option<usize>, | ||
17 | } | ||
18 | |||
19 | impl Default for InlayConfig { | ||
20 | fn default() -> Self { | ||
21 | Self { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: None } | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
15 | pub enum InlayKind { | 26 | pub enum InlayKind { |
16 | TypeHint, | 27 | TypeHint, |
17 | ParameterHint, | 28 | ParameterHint, |
@@ -27,7 +38,7 @@ pub struct InlayHint { | |||
27 | pub(crate) fn inlay_hints( | 38 | pub(crate) fn inlay_hints( |
28 | db: &RootDatabase, | 39 | db: &RootDatabase, |
29 | file_id: FileId, | 40 | file_id: FileId, |
30 | inlay_hint_opts: &InlayHintOptions, | 41 | inlay_hint_opts: &InlayConfig, |
31 | ) -> Vec<InlayHint> { | 42 | ) -> Vec<InlayHint> { |
32 | let _p = profile("inlay_hints"); | 43 | let _p = profile("inlay_hints"); |
33 | let sema = Semantics::new(db); | 44 | let sema = Semantics::new(db); |
@@ -50,12 +61,11 @@ pub(crate) fn inlay_hints( | |||
50 | fn get_param_name_hints( | 61 | fn get_param_name_hints( |
51 | acc: &mut Vec<InlayHint>, | 62 | acc: &mut Vec<InlayHint>, |
52 | sema: &Semantics<RootDatabase>, | 63 | sema: &Semantics<RootDatabase>, |
53 | inlay_hint_opts: &InlayHintOptions, | 64 | inlay_hint_opts: &InlayConfig, |
54 | expr: ast::Expr, | 65 | expr: ast::Expr, |
55 | ) -> Option<()> { | 66 | ) -> Option<()> { |
56 | match inlay_hint_opts.display_type { | 67 | if !inlay_hint_opts.display_type.contains(&InlayKind::ParameterHint) { |
57 | InlayHintDisplayType::Off | InlayHintDisplayType::TypeHints => return None, | 68 | return None; |
58 | _ => {} | ||
59 | } | 69 | } |
60 | 70 | ||
61 | let args = match &expr { | 71 | let args = match &expr { |
@@ -91,12 +101,11 @@ fn get_param_name_hints( | |||
91 | fn get_bind_pat_hints( | 101 | fn get_bind_pat_hints( |
92 | acc: &mut Vec<InlayHint>, | 102 | acc: &mut Vec<InlayHint>, |
93 | sema: &Semantics<RootDatabase>, | 103 | sema: &Semantics<RootDatabase>, |
94 | inlay_hint_opts: &InlayHintOptions, | 104 | inlay_hint_opts: &InlayConfig, |
95 | pat: ast::BindPat, | 105 | pat: ast::BindPat, |
96 | ) -> Option<()> { | 106 | ) -> Option<()> { |
97 | match inlay_hint_opts.display_type { | 107 | if !inlay_hint_opts.display_type.contains(&InlayKind::TypeHint) { |
98 | InlayHintDisplayType::Off | InlayHintDisplayType::ParameterHints => return None, | 108 | return None; |
99 | _ => {} | ||
100 | } | 109 | } |
101 | 110 | ||
102 | let ty = sema.type_of_pat(&pat.clone().into())?; | 111 | let ty = sema.type_of_pat(&pat.clone().into())?; |
@@ -214,10 +223,10 @@ fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option< | |||
214 | 223 | ||
215 | #[cfg(test)] | 224 | #[cfg(test)] |
216 | mod tests { | 225 | mod tests { |
226 | use crate::inlay_hints::{InlayConfig, InlayKind}; | ||
217 | use insta::assert_debug_snapshot; | 227 | use insta::assert_debug_snapshot; |
218 | 228 | ||
219 | use crate::mock_analysis::single_file; | 229 | use crate::mock_analysis::single_file; |
220 | use ra_project_model::{InlayHintDisplayType, InlayHintOptions}; | ||
221 | 230 | ||
222 | #[test] | 231 | #[test] |
223 | fn param_hints_only() { | 232 | fn param_hints_only() { |
@@ -228,7 +237,7 @@ mod tests { | |||
228 | let _x = foo(4, 4); | 237 | let _x = foo(4, 4); |
229 | }"#, | 238 | }"#, |
230 | ); | 239 | ); |
231 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::ParameterHints, max_length: None}).unwrap(), @r###" | 240 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![InlayKind::ParameterHint], max_length: None}).unwrap(), @r###" |
232 | [ | 241 | [ |
233 | InlayHint { | 242 | InlayHint { |
234 | range: [106; 107), | 243 | range: [106; 107), |
@@ -252,7 +261,7 @@ mod tests { | |||
252 | let _x = foo(4, 4); | 261 | let _x = foo(4, 4); |
253 | }"#, | 262 | }"#, |
254 | ); | 263 | ); |
255 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::Off, max_length: None}).unwrap(), @r###"[]"###); | 264 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![], max_length: None}).unwrap(), @r###"[]"###); |
256 | } | 265 | } |
257 | 266 | ||
258 | #[test] | 267 | #[test] |
@@ -264,7 +273,7 @@ mod tests { | |||
264 | let _x = foo(4, 4); | 273 | let _x = foo(4, 4); |
265 | }"#, | 274 | }"#, |
266 | ); | 275 | ); |
267 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions{ display_type: InlayHintDisplayType::TypeHints, max_length: None}).unwrap(), @r###" | 276 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig{ display_type: vec![InlayKind::TypeHint], max_length: None}).unwrap(), @r###" |
268 | [ | 277 | [ |
269 | InlayHint { | 278 | InlayHint { |
270 | range: [97; 99), | 279 | range: [97; 99), |
@@ -288,7 +297,7 @@ fn main() { | |||
288 | }"#, | 297 | }"#, |
289 | ); | 298 | ); |
290 | 299 | ||
291 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 300 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
292 | [ | 301 | [ |
293 | InlayHint { | 302 | InlayHint { |
294 | range: [69; 71), | 303 | range: [69; 71), |
@@ -345,7 +354,7 @@ fn main() { | |||
345 | }"#, | 354 | }"#, |
346 | ); | 355 | ); |
347 | 356 | ||
348 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 357 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
349 | [ | 358 | [ |
350 | InlayHint { | 359 | InlayHint { |
351 | range: [193; 197), | 360 | range: [193; 197), |
@@ -425,7 +434,7 @@ fn main() { | |||
425 | }"#, | 434 | }"#, |
426 | ); | 435 | ); |
427 | 436 | ||
428 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 437 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
429 | [ | 438 | [ |
430 | InlayHint { | 439 | InlayHint { |
431 | range: [21; 30), | 440 | range: [21; 30), |
@@ -489,7 +498,7 @@ fn main() { | |||
489 | }"#, | 498 | }"#, |
490 | ); | 499 | ); |
491 | 500 | ||
492 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 501 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
493 | [ | 502 | [ |
494 | InlayHint { | 503 | InlayHint { |
495 | range: [21; 30), | 504 | range: [21; 30), |
@@ -539,7 +548,7 @@ fn main() { | |||
539 | }"#, | 548 | }"#, |
540 | ); | 549 | ); |
541 | 550 | ||
542 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 551 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
543 | [ | 552 | [ |
544 | InlayHint { | 553 | InlayHint { |
545 | range: [188; 192), | 554 | range: [188; 192), |
@@ -634,7 +643,7 @@ fn main() { | |||
634 | }"#, | 643 | }"#, |
635 | ); | 644 | ); |
636 | 645 | ||
637 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 646 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
638 | [ | 647 | [ |
639 | InlayHint { | 648 | InlayHint { |
640 | range: [188; 192), | 649 | range: [188; 192), |
@@ -729,7 +738,7 @@ fn main() { | |||
729 | }"#, | 738 | }"#, |
730 | ); | 739 | ); |
731 | 740 | ||
732 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 741 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
733 | [ | 742 | [ |
734 | InlayHint { | 743 | InlayHint { |
735 | range: [252; 256), | 744 | range: [252; 256), |
@@ -801,7 +810,7 @@ fn main() { | |||
801 | }"#, | 810 | }"#, |
802 | ); | 811 | ); |
803 | 812 | ||
804 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###" | 813 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###" |
805 | [ | 814 | [ |
806 | InlayHint { | 815 | InlayHint { |
807 | range: [74; 75), | 816 | range: [74; 75), |
@@ -889,7 +898,7 @@ fn main() { | |||
889 | }"#, | 898 | }"#, |
890 | ); | 899 | ); |
891 | 900 | ||
892 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(None)).unwrap(), @r###" | 901 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig::default()).unwrap(), @r###" |
893 | [ | 902 | [ |
894 | InlayHint { | 903 | InlayHint { |
895 | range: [798; 809), | 904 | range: [798; 809), |
@@ -1011,7 +1020,7 @@ fn main() { | |||
1011 | }"#, | 1020 | }"#, |
1012 | ); | 1021 | ); |
1013 | 1022 | ||
1014 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###" | 1023 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###" |
1015 | [] | 1024 | [] |
1016 | "### | 1025 | "### |
1017 | ); | 1026 | ); |
@@ -1037,7 +1046,7 @@ fn main() { | |||
1037 | }"#, | 1046 | }"#, |
1038 | ); | 1047 | ); |
1039 | 1048 | ||
1040 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintOptions::new(Some(8))).unwrap(), @r###" | 1049 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayConfig { display_type: vec![InlayKind::TypeHint, InlayKind::ParameterHint], max_length: Some(8) }).unwrap(), @r###" |
1041 | [] | 1050 | [] |
1042 | "### | 1051 | "### |
1043 | ); | 1052 | ); |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 8b1292a41..a3acfd225 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -44,7 +44,6 @@ mod marks; | |||
44 | #[cfg(test)] | 44 | #[cfg(test)] |
45 | mod test_utils; | 45 | mod test_utils; |
46 | 46 | ||
47 | use ra_project_model::InlayHintOptions; | ||
48 | use std::sync::Arc; | 47 | use std::sync::Arc; |
49 | 48 | ||
50 | use ra_cfg::CfgOptions; | 49 | use ra_cfg::CfgOptions; |
@@ -69,7 +68,7 @@ pub use crate::{ | |||
69 | expand_macro::ExpandedMacro, | 68 | expand_macro::ExpandedMacro, |
70 | folding_ranges::{Fold, FoldKind}, | 69 | folding_ranges::{Fold, FoldKind}, |
71 | hover::HoverResult, | 70 | hover::HoverResult, |
72 | inlay_hints::{InlayHint, InlayKind}, | 71 | inlay_hints::{InlayConfig, InlayHint, InlayKind}, |
73 | references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult}, | 72 | references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult}, |
74 | runnables::{Runnable, RunnableKind, TestId}, | 73 | runnables::{Runnable, RunnableKind, TestId}, |
75 | source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, | 74 | source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, |
@@ -319,7 +318,7 @@ impl Analysis { | |||
319 | pub fn inlay_hints( | 318 | pub fn inlay_hints( |
320 | &self, | 319 | &self, |
321 | file_id: FileId, | 320 | file_id: FileId, |
322 | inlay_hint_opts: &InlayHintOptions, | 321 | inlay_hint_opts: &InlayConfig, |
323 | ) -> Cancelable<Vec<InlayHint>> { | 322 | ) -> Cancelable<Vec<InlayHint>> { |
324 | self.with_db(|db| inlay_hints::inlay_hints(db, file_id, inlay_hint_opts)) | 323 | self.with_db(|db| inlay_hints::inlay_hints(db, file_id, inlay_hint_opts)) |
325 | } | 324 | } |
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index a5012c0ef..036c8719f 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -41,12 +41,6 @@ pub struct InlayHintOptions { | |||
41 | pub max_length: Option<usize>, | 41 | pub max_length: Option<usize>, |
42 | } | 42 | } |
43 | 43 | ||
44 | impl InlayHintOptions { | ||
45 | pub fn new(max_length: Option<usize>) -> Self { | ||
46 | Self { display_type: InlayHintDisplayType::Full, max_length } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | impl Default for InlayHintOptions { | 44 | impl Default for InlayHintOptions { |
51 | fn default() -> Self { | 45 | fn default() -> Self { |
52 | Self { display_type: InlayHintDisplayType::Full, max_length: None } | 46 | Self { display_type: InlayHintDisplayType::Full, max_length: None } |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 1617eab0b..2f407723b 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -7,12 +7,40 @@ | |||
7 | //! configure the server itself, feature flags are passed into analysis, and | 7 | //! configure the server itself, feature flags are passed into analysis, and |
8 | //! tweak things like automatic insertion of `()` in completions. | 8 | //! tweak things like automatic insertion of `()` in completions. |
9 | 9 | ||
10 | use ra_project_model::InlayHintOptions; | 10 | use ra_ide::{InlayConfig, InlayKind}; |
11 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
12 | 12 | ||
13 | use ra_project_model::CargoFeatures; | 13 | use ra_project_model::CargoFeatures; |
14 | use serde::{Deserialize, Deserializer}; | 14 | use serde::{Deserialize, Deserializer}; |
15 | 15 | ||
16 | #[derive(Deserialize)] | ||
17 | #[serde(remote = "InlayKind")] | ||
18 | pub enum InlayKindDef { | ||
19 | TypeHint, | ||
20 | ParameterHint, | ||
21 | } | ||
22 | |||
23 | // Work-around until better serde support is added | ||
24 | // https://github.com/serde-rs/serde/issues/723#issuecomment-382501277 | ||
25 | fn vec_inlay_kind<'de, D>(deserializer: D) -> Result<Vec<InlayKind>, D::Error> | ||
26 | where | ||
27 | D: Deserializer<'de>, | ||
28 | { | ||
29 | #[derive(Deserialize)] | ||
30 | struct Wrapper(#[serde(with = "InlayKindDef")] InlayKind); | ||
31 | |||
32 | let v = Vec::deserialize(deserializer)?; | ||
33 | Ok(v.into_iter().map(|Wrapper(a)| a).collect()) | ||
34 | } | ||
35 | |||
36 | #[derive(Deserialize)] | ||
37 | #[serde(remote = "InlayConfig")] | ||
38 | pub struct InlayConfigDef { | ||
39 | #[serde(deserialize_with = "vec_inlay_kind")] | ||
40 | pub display_type: Vec<InlayKind>, | ||
41 | pub max_length: Option<usize>, | ||
42 | } | ||
43 | |||
16 | /// Client provided initialization options | 44 | /// Client provided initialization options |
17 | #[derive(Deserialize, Clone, Debug, PartialEq, Eq)] | 45 | #[derive(Deserialize, Clone, Debug, PartialEq, Eq)] |
18 | #[serde(rename_all = "camelCase", default)] | 46 | #[serde(rename_all = "camelCase", default)] |
@@ -31,7 +59,8 @@ pub struct ServerConfig { | |||
31 | 59 | ||
32 | pub lru_capacity: Option<usize>, | 60 | pub lru_capacity: Option<usize>, |
33 | 61 | ||
34 | pub inlay_hint_opts: InlayHintOptions, | 62 | #[serde(with = "InlayConfigDef")] |
63 | pub inlay_hint_opts: InlayConfig, | ||
35 | 64 | ||
36 | pub cargo_watch_enable: bool, | 65 | pub cargo_watch_enable: bool, |
37 | pub cargo_watch_args: Vec<String>, | 66 | pub cargo_watch_args: Vec<String>, |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 91fb66abb..729c384ac 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -177,7 +177,7 @@ pub fn main_loop( | |||
177 | .and_then(|it| it.folding_range.as_ref()) | 177 | .and_then(|it| it.folding_range.as_ref()) |
178 | .and_then(|it| it.line_folding_only) | 178 | .and_then(|it| it.line_folding_only) |
179 | .unwrap_or(false), | 179 | .unwrap_or(false), |
180 | inlay_hint_opts: config.inlay_hint_opts.clone(), | 180 | inlay_hint_opts: config.inlay_hint_opts, |
181 | cargo_watch: CheckOptions { | 181 | cargo_watch: CheckOptions { |
182 | enable: config.cargo_watch_enable, | 182 | enable: config.cargo_watch_enable, |
183 | args: config.cargo_watch_args, | 183 | args: config.cargo_watch_args, |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index fcb40432d..4f58bcb0a 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -997,7 +997,7 @@ pub fn handle_inlay_hints( | |||
997 | let analysis = world.analysis(); | 997 | let analysis = world.analysis(); |
998 | let line_index = analysis.file_line_index(file_id)?; | 998 | let line_index = analysis.file_line_index(file_id)?; |
999 | Ok(analysis | 999 | Ok(analysis |
1000 | .inlay_hints(file_id, world.options.max_inlay_hint_length)? | 1000 | .inlay_hints(file_id, &world.options.inlay_hint_opts)? |
1001 | .into_iter() | 1001 | .into_iter() |
1002 | .map(|api_type| InlayHint { | 1002 | .map(|api_type| InlayHint { |
1003 | label: api_type.label.to_string(), | 1003 | label: api_type.label.to_string(), |
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index 8043a6cd3..6eb1ea7d2 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs | |||
@@ -13,9 +13,10 @@ use lsp_types::Url; | |||
13 | use parking_lot::RwLock; | 13 | use parking_lot::RwLock; |
14 | use ra_cargo_watch::{url_from_path_with_drive_lowercasing, CheckOptions, CheckWatcher}; | 14 | use ra_cargo_watch::{url_from_path_with_drive_lowercasing, CheckOptions, CheckWatcher}; |
15 | use ra_ide::{ | 15 | use ra_ide::{ |
16 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId, | 16 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, InlayConfig, LibraryData, |
17 | SourceRootId, | ||
17 | }; | 18 | }; |
18 | use ra_project_model::{get_rustc_cfg_options, InlayHintOptions, ProjectWorkspace}; | 19 | use ra_project_model::{get_rustc_cfg_options, ProjectWorkspace}; |
19 | use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch}; | 20 | use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch}; |
20 | use relative_path::RelativePathBuf; | 21 | use relative_path::RelativePathBuf; |
21 | 22 | ||
@@ -32,7 +33,7 @@ pub struct Options { | |||
32 | pub publish_decorations: bool, | 33 | pub publish_decorations: bool, |
33 | pub supports_location_link: bool, | 34 | pub supports_location_link: bool, |
34 | pub line_folding_only: bool, | 35 | pub line_folding_only: bool, |
35 | pub inlay_hint_opts: InlayHintOptions, | 36 | pub inlay_hint_opts: InlayConfig, |
36 | pub rustfmt_args: Vec<String>, | 37 | pub rustfmt_args: Vec<String>, |
37 | pub cargo_watch: CheckOptions, | 38 | pub cargo_watch: CheckOptions, |
38 | } | 39 | } |