Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f87f468

Browse files
Add doc(alias)-based function name completion
1 parent 410acd7 commit f87f468

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

crates/ide-completion/src/render/function.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ fn render(
147147
}
148148
}
149149
}
150+
151+
item.doc_aliases(ctx.doc_aliases);
150152
item
151153
}
152154

crates/ide-completion/src/tests/special.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,3 +1105,48 @@ fn here_we_go() {
11051105
"#]],
11061106
);
11071107
}
1108+
1109+
#[test]
1110+
fn completes_fn_name_via_doc_alias_in_fn_body() {
1111+
check(
1112+
r#"
1113+
#[doc(alias = "qux")]
1114+
fn foo() {}
1115+
fn bar() { qu$0 }
1116+
"#,
1117+
expect![[r#"
1118+
fn bar() fn()
1119+
fn foo() (alias qux) fn()
1120+
bt u32
1121+
kw const
1122+
kw crate::
1123+
kw enum
1124+
kw extern
1125+
kw false
1126+
kw fn
1127+
kw for
1128+
kw if
1129+
kw if let
1130+
kw impl
1131+
kw let
1132+
kw loop
1133+
kw match
1134+
kw mod
1135+
kw return
1136+
kw self::
1137+
kw static
1138+
kw struct
1139+
kw trait
1140+
kw true
1141+
kw type
1142+
kw union
1143+
kw unsafe
1144+
kw use
1145+
kw while
1146+
kw while let
1147+
sn macro_rules
1148+
sn pd
1149+
sn ppd
1150+
"#]],
1151+
);
1152+
}

0 commit comments

Comments
 (0)