From a40f78f92ad2050d6178dfd70374701c6bc826ae Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 Jan 2021 18:59:22 +0300 Subject: 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 --- crates/completion/src/render/function.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/completion/src/render/function.rs') 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 @@ //! Renderer for function calls. -use hir::{HasSource, Type}; +use hir::{HasSource, HirDisplay, Type}; use ide_db::SymbolKind; -use syntax::{ast::Fn, display::function_declaration}; +use syntax::ast::Fn; use test_utils::mark; use crate::{ @@ -55,7 +55,8 @@ impl<'a> FunctionRender<'a> { } fn detail(&self) -> String { - function_declaration(&self.ast_node) + let ty = self.func.ret_type(self.ctx.db()); + format!("-> {}", ty.display(self.ctx.db())) } fn add_arg(&self, arg: &str, ty: &Type) -> String { -- cgit v1.2.3