diff options
author | Kirill Bulatov <[email protected]> | 2019-12-19 14:18:09 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2019-12-19 14:18:09 +0000 |
commit | 4fb25ef43bd96da94467ffa4de8fbf0af82b28d1 (patch) | |
tree | bccdcbad14a78bf670f77f1f98208009ea80b8dd /crates/ra_ide/src | |
parent | 3969c7c85373554fcd80aee359cd0def14f7a528 (diff) |
Do not add any new configuration parameters
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 44 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 7 |
2 files changed, 11 insertions, 40 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 319ac0048..4c5004f67 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -160,7 +160,7 @@ mod tests { | |||
160 | use crate::mock_analysis::single_file; | 160 | use crate::mock_analysis::single_file; |
161 | 161 | ||
162 | #[test] | 162 | #[test] |
163 | fn default_generic_types_disabled() { | 163 | fn default_generic_types_should_not_be_displayed() { |
164 | let (analysis, file_id) = single_file( | 164 | let (analysis, file_id) = single_file( |
165 | r#" | 165 | r#" |
166 | struct Test<K, T = u8> { | 166 | struct Test<K, T = u8> { |
@@ -173,7 +173,7 @@ fn main() { | |||
173 | }"#, | 173 | }"#, |
174 | ); | 174 | ); |
175 | 175 | ||
176 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, false).unwrap(), @r###" | 176 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
177 | [ | 177 | [ |
178 | InlayHint { | 178 | InlayHint { |
179 | range: [69; 71), | 179 | range: [69; 71), |
@@ -186,32 +186,6 @@ fn main() { | |||
186 | } | 186 | } |
187 | 187 | ||
188 | #[test] | 188 | #[test] |
189 | fn default_generic_types_enabled() { | ||
190 | let (analysis, file_id) = single_file( | ||
191 | r#" | ||
192 | struct Test<K, T = u8> { | ||
193 | k: K, | ||
194 | t: T, | ||
195 | } | ||
196 | |||
197 | fn main() { | ||
198 | let zz = Test { t: 23, k: 33 }; | ||
199 | }"#, | ||
200 | ); | ||
201 | |||
202 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | ||
203 | [ | ||
204 | InlayHint { | ||
205 | range: [69; 71), | ||
206 | kind: TypeHint, | ||
207 | label: "Test<i32, u8>", | ||
208 | }, | ||
209 | ] | ||
210 | "### | ||
211 | ); | ||
212 | } | ||
213 | |||
214 | #[test] | ||
215 | fn let_statement() { | 189 | fn let_statement() { |
216 | let (analysis, file_id) = single_file( | 190 | let (analysis, file_id) = single_file( |
217 | r#" | 191 | r#" |
@@ -251,7 +225,7 @@ fn main() { | |||
251 | }"#, | 225 | }"#, |
252 | ); | 226 | ); |
253 | 227 | ||
254 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 228 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
255 | [ | 229 | [ |
256 | InlayHint { | 230 | InlayHint { |
257 | range: [193; 197), | 231 | range: [193; 197), |
@@ -325,7 +299,7 @@ fn main() { | |||
325 | }"#, | 299 | }"#, |
326 | ); | 300 | ); |
327 | 301 | ||
328 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 302 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
329 | [ | 303 | [ |
330 | InlayHint { | 304 | InlayHint { |
331 | range: [21; 30), | 305 | range: [21; 30), |
@@ -354,7 +328,7 @@ fn main() { | |||
354 | }"#, | 328 | }"#, |
355 | ); | 329 | ); |
356 | 330 | ||
357 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 331 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
358 | [ | 332 | [ |
359 | InlayHint { | 333 | InlayHint { |
360 | range: [21; 30), | 334 | range: [21; 30), |
@@ -402,7 +376,7 @@ fn main() { | |||
402 | }"#, | 376 | }"#, |
403 | ); | 377 | ); |
404 | 378 | ||
405 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 379 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
406 | [ | 380 | [ |
407 | InlayHint { | 381 | InlayHint { |
408 | range: [166; 170), | 382 | range: [166; 170), |
@@ -465,7 +439,7 @@ fn main() { | |||
465 | }"#, | 439 | }"#, |
466 | ); | 440 | ); |
467 | 441 | ||
468 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 442 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
469 | [ | 443 | [ |
470 | InlayHint { | 444 | InlayHint { |
471 | range: [166; 170), | 445 | range: [166; 170), |
@@ -528,7 +502,7 @@ fn main() { | |||
528 | }"#, | 502 | }"#, |
529 | ); | 503 | ); |
530 | 504 | ||
531 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" | 505 | assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" |
532 | [ | 506 | [ |
533 | InlayHint { | 507 | InlayHint { |
534 | range: [311; 315), | 508 | range: [311; 315), |
@@ -570,7 +544,7 @@ fn main() { | |||
570 | }"#, | 544 | }"#, |
571 | ); | 545 | ); |
572 | 546 | ||
573 | assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8), true).unwrap(), @r###" | 547 | assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8)).unwrap(), @r###" |
574 | [ | 548 | [ |
575 | InlayHint { | 549 | InlayHint { |
576 | range: [74; 75), | 550 | range: [74; 75), |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index c3244a8dd..875919e60 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -348,12 +348,9 @@ impl Analysis { | |||
348 | &self, | 348 | &self, |
349 | file_id: FileId, | 349 | file_id: FileId, |
350 | max_inlay_hint_length: Option<usize>, | 350 | max_inlay_hint_length: Option<usize>, |
351 | show_default_types_in_inlay_hints: bool, | ||
352 | ) -> Cancelable<Vec<InlayHint>> { | 351 | ) -> Cancelable<Vec<InlayHint>> { |
353 | let truncate_options = hir::TruncateOptions { | 352 | let truncate_options = |
354 | max_length: max_inlay_hint_length, | 353 | hir::TruncateOptions { max_length: max_inlay_hint_length, show_default_types: false }; |
355 | show_default_types: show_default_types_in_inlay_hints, | ||
356 | }; | ||
357 | self.with_db(|db| { | 354 | self.with_db(|db| { |
358 | inlay_hints::inlay_hints(db, file_id, &db.parse(file_id).tree(), &truncate_options) | 355 | inlay_hints::inlay_hints(db, file_id, &db.parse(file_id).tree(), &truncate_options) |
359 | }) | 356 | }) |