diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-10-28 14:48:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 14:48:14 -0400 |
commit | 7c80f15020ba9c133fb17d908d8f3aeea4da71d2 (patch) | |
tree | 351c247d0726cb0ddd0edf08181e5292c75ea658 /cli/lsp/tsc.rs | |
parent | d1d42e6ba7324c97db8b488e41419564f29b475d (diff) |
fix(lsp): correct `parameterNames.suppressWhenArgumentMatchesName` and `variableTypes.suppressWhenTypeMatchesName` (#16469)
Closes #16468
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r-- | cli/lsp/tsc.rs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index bed06e088..90658b8d7 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -3009,7 +3009,7 @@ impl From<&config::WorkspaceSettings> for UserPreferences { (&inlay_hints.parameter_names.enabled).into(), ), include_inlay_parameter_name_hints_when_argument_matches_name: Some( - inlay_hints + !inlay_hints .parameter_names .suppress_when_argument_matches_name, ), @@ -3020,9 +3020,7 @@ impl From<&config::WorkspaceSettings> for UserPreferences { inlay_hints.variable_types.enabled, ), include_inlay_variable_type_hints_when_type_matches_name: Some( - inlay_hints - .variable_types - .suppress_when_argument_matches_name, + !inlay_hints.variable_types.suppress_when_type_matches_name, ), include_inlay_property_declaration_type_hints: Some( inlay_hints.property_declaration_types.enabled, @@ -3447,6 +3445,7 @@ mod tests { use super::*; use crate::http_cache::HttpCache; use crate::http_util::HeadersMap; + use crate::lsp::config::WorkspaceSettings; use crate::lsp::documents::Documents; use crate::lsp::documents::LanguageId; use crate::lsp::text::LineIndex; @@ -4306,4 +4305,27 @@ mod tests { ); } } + + #[test] + fn include_supress_inlay_hit_settings() { + let mut settings = WorkspaceSettings::default(); + settings + .inlay_hints + .parameter_names + .suppress_when_argument_matches_name = true; + settings + .inlay_hints + .variable_types + .suppress_when_type_matches_name = true; + let user_preferences: UserPreferences = (&settings).into(); + assert_eq!( + user_preferences.include_inlay_variable_type_hints_when_type_matches_name, + Some(false) + ); + assert_eq!( + user_preferences + .include_inlay_parameter_name_hints_when_argument_matches_name, + Some(false) + ); + } } |