459: use real signature in completion r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-01-08 13:10:18 +00:00
commit 958c2a2d63

View file

@ -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);