This commit is contained in:
Aleksey Kladov 2020-07-16 21:33:11 +02:00
parent 0265778e86
commit edc0190f7a
4 changed files with 11 additions and 10 deletions

View File

@ -43,7 +43,7 @@ use crate::{
completion::{
CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
},
display::function_label,
display::function_declaration,
};
pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) {
@ -144,7 +144,7 @@ fn add_function_impl(
};
let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end());
let function_decl = function_label(&func.source(ctx.db).value);
let function_decl = function_declaration(&func.source(ctx.db).value);
match ctx.config.snippet_cap {
Some(cap) => {
let snippet = format!("{} {{\n $0\n}}", function_decl);

View File

@ -12,7 +12,8 @@ use crate::{
CompletionKind, Completions,
},
display::{
const_label, function_label, function_signature::FunctionSignature, macro_label, type_label,
const_label, function_declaration, function_signature::FunctionSignature, macro_label,
type_label,
},
CompletionScore, RootDatabase,
};
@ -208,7 +209,7 @@ impl Completions {
})
.set_documentation(func.docs(ctx.db))
.set_deprecated(is_deprecated(func, ctx.db))
.detail(function_label(&ast_node));
.detail(function_declaration(&ast_node));
let params = function_signature
.parameter_names

View File

@ -10,14 +10,14 @@ use ra_syntax::{
SyntaxKind::{ATTR, COMMENT},
};
use ast::VisibilityOwner;
use stdx::format_to;
pub use navigation_target::NavigationTarget;
pub(crate) use navigation_target::{ToNav, TryToNav};
pub(crate) use short_label::ShortLabel;
use ast::VisibilityOwner;
pub use navigation_target::NavigationTarget;
use stdx::format_to;
pub(crate) fn function_label(node: &ast::FnDef) -> String {
pub(crate) fn function_declaration(node: &ast::FnDef) -> String {
let mut buf = String::new();
if let Some(vis) = node.visibility() {
format_to!(buf, "{} ", vis);

View File

@ -9,7 +9,7 @@ pub(crate) trait ShortLabel {
impl ShortLabel for ast::FnDef {
fn short_label(&self) -> Option<String> {
Some(crate::display::function_label(self))
Some(crate::display::function_declaration(self))
}
}