use real signature in completion

This commit is contained in:
Aleksey Kladov 2019-01-08 16:08:58 +03:00
parent 6ba4fa0bc7
commit 821f5186ba

View file

@ -150,12 +150,10 @@ impl Builder {
fn from_function(mut self, ctx: &CompletionContext, function: hir::Function) -> Builder { fn from_function(mut self, ctx: &CompletionContext, function: hir::Function) -> Builder {
// If not an import, add parenthesis automatically. // If not an import, add parenthesis automatically.
if ctx.use_item_syntax.is_none() { if ctx.use_item_syntax.is_none() {
if let Some(sig_info) = function.signature_info(ctx.db) { if function.signature(ctx.db).args().is_empty() {
if sig_info.params.is_empty() { self.snippet = Some(format!("{}()$0", self.label));
self.snippet = Some(format!("{}()$0", self.label)); } else {
} else { self.snippet = Some(format!("{}($0)", self.label));
self.snippet = Some(format!("{}($0)", self.label));
}
} }
} }
self.kind = Some(CompletionItemKind::Function); self.kind = Some(CompletionItemKind::Function);