mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Improve parameter hints a bit & add emacs support
- just include the name, not e.g. `mut` - don't return empty hints (or `_`)
This commit is contained in:
parent
d1d91dfe4d
commit
18ec4e3403
3 changed files with 38 additions and 23 deletions
|
@ -169,9 +169,22 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
|
|||
res.push(self_param.syntax().text().to_string())
|
||||
}
|
||||
|
||||
res.extend(param_list.params().map(|param| {
|
||||
param.pat().map(|pat| pat.syntax().text().to_string()).unwrap_or_default()
|
||||
}));
|
||||
res.extend(
|
||||
param_list
|
||||
.params()
|
||||
.map(|param| {
|
||||
Some(
|
||||
param
|
||||
.pat()?
|
||||
.syntax()
|
||||
.descendants()
|
||||
.find_map(ast::Name::cast)?
|
||||
.text()
|
||||
.to_string(),
|
||||
)
|
||||
})
|
||||
.map(|param| param.unwrap_or_default()),
|
||||
);
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue