From 14c167a9f6da07024a5101ffa04bc2f79ce64353 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 8 Dec 2019 00:54:18 +0200 Subject: Omit default parameter types --- 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 + 4 files changed, 9 insertions(+), 1 deletion(-) (limited to 'crates/ra_lsp_server/src') diff --git a/crates/ra_lsp_server/src/config.rs b/crates/ra_lsp_server/src/config.rs index 67942aa41..a916c5fd6 100644 --- a/crates/ra_lsp_server/src/config.rs +++ b/crates/ra_lsp_server/src/config.rs @@ -31,6 +31,7 @@ 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")] @@ -51,6 +52,7 @@ 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 965e7c53c..01fde3b2d 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -125,6 +125,7 @@ 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 5b64b27cd..9069d1f1d 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -895,7 +895,11 @@ 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)? + .inlay_hints( + file_id, + world.options.max_inlay_hint_length, + world.options.show_default_types_in_inlay_hints, + )? .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 16cc11e8c..0b6eefcbc 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs @@ -31,6 +31,7 @@ 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