diff options
author | Benjamin Coenen <[email protected]> | 2020-04-11 21:54:22 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-04-11 22:45:09 +0100 |
commit | 93bfc2d05d36a47dc05a1799210327473d702dbc (patch) | |
tree | dee25e78b24b5d1b23d73ae1009bddbd060927cf /crates/ra_hir_ty/src/display.rs | |
parent | d42346fed61f706d68fe888631a41ea5f2752d7f (diff) | |
parent | fd06fe7b13045185ab4e630b0044aa9d8bbcdf8a (diff) |
Improve autocompletion by looking on the type and name
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/display.rs')
-rw-r--r-- | crates/ra_hir_ty/src/display.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs index 0e9313aa1..d03bbd5a7 100644 --- a/crates/ra_hir_ty/src/display.rs +++ b/crates/ra_hir_ty/src/display.rs | |||
@@ -247,19 +247,21 @@ impl HirDisplay for ApplicationTy { | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | TypeCtor::Closure { .. } => { | 249 | TypeCtor::Closure { .. } => { |
250 | let sig = self.parameters[0] | 250 | let sig = self.parameters[0].callable_sig(f.db); |
251 | .callable_sig(f.db) | 251 | if let Some(sig) = sig { |
252 | .expect("first closure parameter should contain signature"); | 252 | if sig.params().is_empty() { |
253 | if sig.params().is_empty() { | 253 | write!(f, "||")?; |
254 | write!(f, "||")?; | 254 | } else if f.omit_verbose_types() { |
255 | } else if f.omit_verbose_types() { | 255 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; |
256 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; | 256 | } else { |
257 | write!(f, "|")?; | ||
258 | f.write_joined(sig.params(), ", ")?; | ||
259 | write!(f, "|")?; | ||
260 | }; | ||
261 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
257 | } else { | 262 | } else { |
258 | write!(f, "|")?; | 263 | write!(f, "{{closure}}")?; |
259 | f.write_joined(sig.params(), ", ")?; | 264 | } |
260 | write!(f, "|")?; | ||
261 | }; | ||
262 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
263 | } | 265 | } |
264 | } | 266 | } |
265 | Ok(()) | 267 | Ok(()) |