aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/display/function_signature.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index 9572debd8..b081ecaad 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -207,7 +207,18 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
207 res.push(raw_param); 207 res.push(raw_param);
208 } 208 }
209 209
210 res.extend(param_list.params().map(|param| param.syntax().text().to_string())); 210 // macro-generated functions are missing whitespace
211 fn fmt_param(param: ast::Param) -> String {
212 let text = param.syntax().text().to_string();
213 match text.find(':') {
214 Some(pos) if 1 + pos < text.len() => {
215 format!("{} {}", &text[0..1 + pos].trim(), &text[1 + pos..].trim())
216 }
217 _ => text,
218 }
219 }
220
221 res.extend(param_list.params().map(fmt_param));
211 res_types.extend(param_list.params().map(|param| { 222 res_types.extend(param_list.params().map(|param| {
212 let param_text = param.syntax().text().to_string(); 223 let param_text = param.syntax().text().to_string();
213 match param_text.split(':').nth(1).and_then(|it| it.get(1..)) { 224 match param_text.split(':').nth(1).and_then(|it| it.get(1..)) {