Skip to content

Commit 05abfc7

Browse files
committed
hide type inlay hints
1 parent d7dfe93 commit 05abfc7

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

crates/ide/src/inlay_hints.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,15 @@ fn is_named_constructor(
265265
};
266266
let path = expr.path()?;
267267

268-
// If it exists, use qualifying segment as the constructor name.
269-
// If not, use the last segment.
270-
let qual_seg = match path.qualifier() {
271-
Some(qual) => qual.segment(),
272-
None => path.segment(),
268+
let callable = sema.type_of_expr(&ast::Expr::PathExpr(expr))?.original.as_callable(sema.db);
269+
let callable_kind = callable.map(|it| it.kind());
270+
let qual_seg = match callable_kind {
271+
Some(hir::CallableKind::Function(_) | hir::CallableKind::TupleEnumVariant(_)) => {
272+
path.qualifier()?.segment()
273+
}
274+
_ => path.segment(),
273275
}?;
276+
274277
let ctor_name = match qual_seg.kind()? {
275278
ast::PathSegmentKind::Name(name_ref) => {
276279
match qual_seg.generic_arg_list().map(|it| it.generic_args()) {
@@ -1348,6 +1351,13 @@ fn main() {
13481351
//- minicore: try, option
13491352
use core::ops::ControlFlow;
13501353
1354+
mod x {
1355+
pub mod y { pub struct Foo; }
1356+
pub struct Foo;
1357+
pub enum AnotherEnum {
1358+
Variant()
1359+
};
1360+
}
13511361
struct Struct;
13521362
struct TupleStruct();
13531363
@@ -1378,6 +1388,8 @@ fn times2(value: i32) -> i32 {
13781388
fn main() {
13791389
let enumb = Enum::Variant(0);
13801390
1391+
let strukt = x::Foo;
1392+
let strukt = x::y::Foo;
13811393
let strukt = Struct;
13821394
let strukt = Struct::new();
13831395

0 commit comments

Comments
 (0)