aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/display
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-01-18 13:00:43 +0000
committerGitHub <[email protected]>2020-01-18 13:00:43 +0000
commit3a7724e44181ccd5c248589538bd82458b5a9407 (patch)
treee7dfad0f3f90e709580040a3a8894658ee926fe4 /crates/ra_ide/src/display
parentd1d91dfe4d52856403a17e2644a22c919690010d (diff)
parent18ec4e3403854995d44841a066ff3b190d8115e6 (diff)
Merge #2875
2875: Improve parameter hints a bit & add emacs support r=matklad a=flodiebold - just include the name, not e.g. `mut` - don't return empty hints (or `_`) CC @brotzeit for the Emacs change Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r--crates/ra_ide/src/display/function_signature.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index ddc53a52b..1e4a472b4 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -169,9 +169,22 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
169 res.push(self_param.syntax().text().to_string()) 169 res.push(self_param.syntax().text().to_string())
170 } 170 }
171 171
172 res.extend(param_list.params().map(|param| { 172 res.extend(
173 param.pat().map(|pat| pat.syntax().text().to_string()).unwrap_or_default() 173 param_list
174 })); 174 .params()
175 .map(|param| {
176 Some(
177 param
178 .pat()?
179 .syntax()
180 .descendants()
181 .find_map(ast::Name::cast)?
182 .text()
183 .to_string(),
184 )
185 })
186 .map(|param| param.unwrap_or_default()),
187 );
175 } 188 }
176 res 189 res
177 } 190 }