From 4fb25ef43bd96da94467ffa4de8fbf0af82b28d1 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 19 Dec 2019 16:18:09 +0200 Subject: Do not add any new configuration parameters --- crates/ra_ide/src/inlay_hints.rs | 44 ++++++-------------------- crates/ra_ide/src/lib.rs | 7 ++-- crates/ra_lsp_server/src/config.rs | 2 -- crates/ra_lsp_server/src/main_loop.rs | 1 - crates/ra_lsp_server/src/main_loop/handlers.rs | 6 +--- crates/ra_lsp_server/src/world.rs | 1 - 6 files changed, 12 insertions(+), 49 deletions(-) (limited to 'crates') 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 { use crate::mock_analysis::single_file; #[test] - fn default_generic_types_disabled() { + fn default_generic_types_should_not_be_displayed() { let (analysis, file_id) = single_file( r#" struct Test { @@ -173,7 +173,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, false).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [69; 71), @@ -185,32 +185,6 @@ fn main() { ); } - #[test] - fn default_generic_types_enabled() { - let (analysis, file_id) = single_file( - r#" -struct Test { - k: K, - t: T, -} - -fn main() { - let zz = Test { t: 23, k: 33 }; -}"#, - ); - - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" - [ - InlayHint { - range: [69; 71), - kind: TypeHint, - label: "Test", - }, - ] - "### - ); - } - #[test] fn let_statement() { let (analysis, file_id) = single_file( @@ -251,7 +225,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [193; 197), @@ -325,7 +299,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [21; 30), @@ -354,7 +328,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [21; 30), @@ -402,7 +376,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [166; 170), @@ -465,7 +439,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [166; 170), @@ -528,7 +502,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, None, true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" [ InlayHint { range: [311; 315), @@ -570,7 +544,7 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8), true).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8)).unwrap(), @r###" [ InlayHint { 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 { &self, file_id: FileId, max_inlay_hint_length: Option, - show_default_types_in_inlay_hints: bool, ) -> Cancelable> { - let truncate_options = hir::TruncateOptions { - max_length: max_inlay_hint_length, - show_default_types: show_default_types_in_inlay_hints, - }; + let truncate_options = + hir::TruncateOptions { max_length: max_inlay_hint_length, show_default_types: false }; self.with_db(|db| { inlay_hints::inlay_hints(db, file_id, &db.parse(file_id).tree(), &truncate_options) }) diff --git a/crates/ra_lsp_server/src/config.rs b/crates/ra_lsp_server/src/config.rs index a916c5fd6..67942aa41 100644 --- a/crates/ra_lsp_server/src/config.rs +++ b/crates/ra_lsp_server/src/config.rs @@ -31,7 +31,6 @@ pub struct ServerConfig { pub lru_capacity: Option, pub max_inlay_hint_length: Option, - pub show_default_types_in_inlay_hints: bool, /// For internal usage to make integrated tests faster. #[serde(deserialize_with = "nullable_bool_true")] @@ -52,7 +51,6 @@ impl Default for ServerConfig { use_client_watching: false, lru_capacity: None, max_inlay_hint_length: None, - show_default_types_in_inlay_hints: false, with_sysroot: true, feature_flags: FxHashMap::default(), cargo_features: Default::default(), diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 01fde3b2d..965e7c53c 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -125,7 +125,6 @@ pub fn main_loop( .and_then(|it| it.line_folding_only) .unwrap_or(false), max_inlay_hint_length: config.max_inlay_hint_length, - show_default_types_in_inlay_hints: config.show_default_types_in_inlay_hints, } }; diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 9069d1f1d..5b64b27cd 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -895,11 +895,7 @@ pub fn handle_inlay_hints( let analysis = world.analysis(); let line_index = analysis.file_line_index(file_id)?; Ok(analysis - .inlay_hints( - file_id, - world.options.max_inlay_hint_length, - world.options.show_default_types_in_inlay_hints, - )? + .inlay_hints(file_id, world.options.max_inlay_hint_length)? .into_iter() .map(|api_type| InlayHint { label: api_type.label.to_string(), diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 0b6eefcbc..16cc11e8c 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs @@ -31,7 +31,6 @@ pub struct Options { pub supports_location_link: bool, pub line_folding_only: bool, pub max_inlay_hint_length: Option, - pub show_default_types_in_inlay_hints: bool, } /// `WorldState` is the primary mutable state of the language server -- cgit v1.2.3