mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +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 {
|
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);
|
||||||
|
|
Loading…
Reference in a new issue