mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #459
459: use real signature in completion r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
958c2a2d63
1 changed files with 4 additions and 6 deletions
|
@ -150,12 +150,10 @@ impl Builder {
|
|||
fn from_function(mut self, ctx: &CompletionContext, function: hir::Function) -> Builder {
|
||||
// If not an import, add parenthesis automatically.
|
||||
if ctx.use_item_syntax.is_none() {
|
||||
if let Some(sig_info) = function.signature_info(ctx.db) {
|
||||
if sig_info.params.is_empty() {
|
||||
self.snippet = Some(format!("{}()$0", self.label));
|
||||
} else {
|
||||
self.snippet = Some(format!("{}($0)", self.label));
|
||||
}
|
||||
if function.signature(ctx.db).args().is_empty() {
|
||||
self.snippet = Some(format!("{}()$0", self.label));
|
||||
} else {
|
||||
self.snippet = Some(format!("{}($0)", self.label));
|
||||
}
|
||||
}
|
||||
self.kind = Some(CompletionItemKind::Function);
|
||||
|
|
Loading…
Reference in a new issue