Skip to content

Commit d9b2291

Browse files
bors[bot]Veykril
andauthored
Merge #10876
10876: fix: Show parameter hints unconditionally for logical not expressions r=Veykril a=Veykril Closes #8491 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 2876df1 + 76022bf commit d9b2291

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

crates/ide/src/inlay_hints.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use either::Either;
22
use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo};
3-
use ide_db::RootDatabase;
4-
use ide_db::{base_db::FileRange, helpers::FamousDefs};
3+
use ide_db::{base_db::FileRange, helpers::FamousDefs, RootDatabase};
54
use itertools::Itertools;
65
use stdx::to_lower_snake_case;
76
use syntax::{
8-
ast::{self, AstNode, HasArgList, HasName},
7+
ast::{self, AstNode, HasArgList, HasName, UnaryOp},
98
match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
109
};
1110

@@ -421,6 +420,10 @@ fn should_hide_param_name_hint(
421420
return true;
422421
}
423422

423+
if matches!(argument, ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(UnaryOp::Not)) {
424+
return false;
425+
}
426+
424427
let fn_name = match callable.kind() {
425428
hir::CallableKind::Function(it) => Some(it.name(sema.db).to_smol_str()),
426429
_ => None,
@@ -868,7 +871,8 @@ fn non_ident_pat((a, b): (u32, u32)) {}
868871
fn main() {
869872
const PARAM: u32 = 0;
870873
foo(PARAM);
871-
874+
foo(!PARAM);
875+
// ^^^^^^ param
872876
check("");
873877
874878
map(0);

0 commit comments

Comments
 (0)