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

Commit 7c2d703

Browse files
bors[bot]jhgg
andauthored
11437: [ide_completion] render if a function is async/const/unsafe in completion details r=Veykril a=jhgg this change renders in the autocomplete detail, whether a function is async/const/unsafe. i found myself wanting to know this information at a glance, so now it renders here: ![image](https://user-images.githubusercontent.com/5489149/153089518-5419afe4-b2c6-4be8-80f7-585f5c514ff2.png) Co-authored-by: Jake Heinz <[email protected]>
2 parents 8ac4595 + 1c1d900 commit 7c2d703

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)