diff options
author | Aleksey Kladov <[email protected]> | 2021-01-22 15:59:22 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-01-22 16:15:34 +0000 |
commit | a40f78f92ad2050d6178dfd70374701c6bc826ae (patch) | |
tree | bd1b08a23eeaecea0b2413454cca2ca0c6631bfe /crates/completion/src/render | |
parent | 02a17cdffcfdea49981b4642be3027e564d28d9b (diff) |
More useful fn detail in completion
Detail should be rendered as shtort one line, just dumping fn header
there is not useful, despite the fact that TS does this.
The fact that this is a function should be indicated by the icon, the
same goes for pub/const/async etc qualitfiers
name is already present in the lable (and arg list should be a part of
that, as in idea)
But the return type is the small genuinerlly useful bit of info we can show here
Diffstat (limited to 'crates/completion/src/render')
-rw-r--r-- | crates/completion/src/render/function.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index 2d616b1fb..e46e21d24 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! Renderer for function calls. | 1 | //! Renderer for function calls. |
2 | 2 | ||
3 | use hir::{HasSource, Type}; | 3 | use hir::{HasSource, HirDisplay, Type}; |
4 | use ide_db::SymbolKind; | 4 | use ide_db::SymbolKind; |
5 | use syntax::{ast::Fn, display::function_declaration}; | 5 | use syntax::ast::Fn; |
6 | use test_utils::mark; | 6 | use test_utils::mark; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
@@ -55,7 +55,8 @@ impl<'a> FunctionRender<'a> { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | fn detail(&self) -> String { | 57 | fn detail(&self) -> String { |
58 | function_declaration(&self.ast_node) | 58 | let ty = self.func.ret_type(self.ctx.db()); |
59 | format!("-> {}", ty.display(self.ctx.db())) | ||
59 | } | 60 | } |
60 | 61 | ||
61 | fn add_arg(&self, arg: &str, ty: &Type) -> String { | 62 | fn add_arg(&self, arg: &str, ty: &Type) -> String { |