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

Commit 1c1d900

Browse files
committed
[ide_completion] render if a function is async/const/unsafe in completion details
1 parent 9b1978a commit 1c1d900

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/ide_completion/src/render/function.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,19 @@ fn render(
110110

111111
fn detail(db: &dyn HirDatabase, func: hir::Function) -> String {
112112
let ret_ty = func.ret_type(db);
113-
let mut detail = format!("fn({})", params_display(db, func));
113+
let mut detail = String::new();
114+
115+
if func.is_const(db) {
116+
format_to!(detail, "const ");
117+
}
118+
if func.is_async(db) {
119+
format_to!(detail, "async ");
120+
}
121+
if func.is_unsafe(db) {
122+
format_to!(detail, "unsafe ");
123+
}
124+
125+
format_to!(detail, "fn({})", params_display(db, func));
114126
if !ret_ty.is_unit() {
115127
format_to!(detail, " -> {}", ret_ty.display(db));
116128
}

0 commit comments

Comments
 (0)