Skip to content

Commit 55c703b

Browse files
committed
feat(ide-completion): explictly show async keyword on impl trait
1 parent 48fb66b commit 55c703b

File tree

1 file changed

+4
-2
lines changed
  • src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list

1 file changed

+4
-2
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list/trait_impl.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ fn add_function_impl(
180180
) {
181181
let fn_name = func.name(ctx.db);
182182

183+
let is_async = func.is_async(ctx.db);
183184
let label = format_smolstr!(
184-
"fn {}({})",
185+
"{}fn {}({})",
186+
if is_async { "async " } else { "" },
185187
fn_name.display(ctx.db),
186188
if func.assoc_fn_params(ctx.db).is_empty() { "" } else { ".." }
187189
);
@@ -193,7 +195,7 @@ fn add_function_impl(
193195
});
194196

195197
let mut item = CompletionItem::new(completion_kind, replacement_range, label);
196-
item.lookup_by(format!("fn {}", fn_name.display(ctx.db)))
198+
item.lookup_by(format!("{}fn {}", if is_async { "async "} else { "" },fn_name.display(ctx.db)))
197199
.set_documentation(func.docs(ctx.db))
198200
.set_relevance(CompletionRelevance { is_item_from_trait: true, ..Default::default() });
199201

0 commit comments

Comments
 (0)