mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
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
This commit is contained in:
parent
02a17cdffc
commit
a40f78f92a
9 changed files with 85 additions and 93 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue