about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2021-11-27 19:12:47 +0100
committerLukas Wirth <lukastw97@gmail.com>2021-11-27 19:14:36 +0100
commit76022bfd60bfc9a7e8f4f0971ef09d3e25563dd2 (patch)
tree8fe467c38cccb045a818d2fdea84dc7c0654f958
parent82abe0493135d12090eaebe0892bafbda042c315 (diff)
downloadrust-76022bfd60bfc9a7e8f4f0971ef09d3e25563dd2.tar.gz
rust-76022bfd60bfc9a7e8f4f0971ef09d3e25563dd2.zip
fix: Show parameter hints unconditionally for logical not expressions
-rw-r--r--crates/ide/src/inlay_hints.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 985d3a4ecca..b479a20beb0 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -1,11 +1,10 @@
 use either::Either;
 use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo};
-use ide_db::RootDatabase;
-use ide_db::{base_db::FileRange, helpers::FamousDefs};
+use ide_db::{base_db::FileRange, helpers::FamousDefs, RootDatabase};
 use itertools::Itertools;
 use stdx::to_lower_snake_case;
 use syntax::{
-    ast::{self, AstNode, HasArgList, HasName},
+    ast::{self, AstNode, HasArgList, HasName, UnaryOp},
     match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
 };
 
@@ -421,6 +420,10 @@ fn should_hide_param_name_hint(
         return true;
     }
 
+    if matches!(argument, ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(UnaryOp::Not)) {
+        return false;
+    }
+
     let fn_name = match callable.kind() {
         hir::CallableKind::Function(it) => Some(it.name(sema.db).to_smol_str()),
         _ => None,
@@ -868,7 +871,8 @@ fn non_ident_pat((a, b): (u32, u32)) {}
 fn main() {
     const PARAM: u32 = 0;
     foo(PARAM);
-
+    foo(!PARAM);
+     // ^^^^^^ param
     check("");
 
     map(0);