mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
use real signature in completion
This commit is contained in:
parent
6ba4fa0bc7
commit
821f5186ba
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