aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs4
-rw-r--r--crates/ra_ide/src/completion/presentation.rs5
-rw-r--r--crates/ra_ide/src/display.rs10
-rw-r--r--crates/ra_ide/src/display/short_label.rs2
4 files changed, 11 insertions, 10 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index 05e605670..cf716540f 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -43,7 +43,7 @@ use crate::{
43 completion::{ 43 completion::{
44 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, 44 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
45 }, 45 },
46 display::function_label, 46 display::function_declaration,
47}; 47};
48 48
49pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) { 49pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) {
@@ -144,7 +144,7 @@ fn add_function_impl(
144 }; 144 };
145 let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); 145 let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end());
146 146
147 let function_decl = function_label(&func.source(ctx.db).value); 147 let function_decl = function_declaration(&func.source(ctx.db).value);
148 match ctx.config.snippet_cap { 148 match ctx.config.snippet_cap {
149 Some(cap) => { 149 Some(cap) => {
150 let snippet = format!("{} {{\n $0\n}}", function_decl); 150 let snippet = format!("{} {{\n $0\n}}", function_decl);
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index 160f2f319..6aab93e17 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -12,7 +12,8 @@ use crate::{
12 CompletionKind, Completions, 12 CompletionKind, Completions,
13 }, 13 },
14 display::{ 14 display::{
15 const_label, function_label, function_signature::FunctionSignature, macro_label, type_label, 15 const_label, function_declaration, function_signature::FunctionSignature, macro_label,
16 type_label,
16 }, 17 },
17 CompletionScore, RootDatabase, 18 CompletionScore, RootDatabase,
18}; 19};
@@ -208,7 +209,7 @@ impl Completions {
208 }) 209 })
209 .set_documentation(func.docs(ctx.db)) 210 .set_documentation(func.docs(ctx.db))
210 .set_deprecated(is_deprecated(func, ctx.db)) 211 .set_deprecated(is_deprecated(func, ctx.db))
211 .detail(function_label(&ast_node)); 212 .detail(function_declaration(&ast_node));
212 213
213 let params = function_signature 214 let params = function_signature
214 .parameter_names 215 .parameter_names
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs
index 9d413cf0a..34ce32e81 100644
--- a/crates/ra_ide/src/display.rs
+++ b/crates/ra_ide/src/display.rs
@@ -10,14 +10,14 @@ use ra_syntax::{
10 SyntaxKind::{ATTR, COMMENT}, 10 SyntaxKind::{ATTR, COMMENT},
11}; 11};
12 12
13pub(crate) use navigation_target::{ToNav, TryToNav};
14pub(crate) use short_label::ShortLabel;
15
16use ast::VisibilityOwner; 13use ast::VisibilityOwner;
17pub use navigation_target::NavigationTarget;
18use stdx::format_to; 14use stdx::format_to;
19 15
20pub(crate) fn function_label(node: &ast::FnDef) -> String { 16pub use navigation_target::NavigationTarget;
17pub(crate) use navigation_target::{ToNav, TryToNav};
18pub(crate) use short_label::ShortLabel;
19
20pub(crate) fn function_declaration(node: &ast::FnDef) -> String {
21 let mut buf = String::new(); 21 let mut buf = String::new();
22 if let Some(vis) = node.visibility() { 22 if let Some(vis) = node.visibility() {
23 format_to!(buf, "{} ", vis); 23 format_to!(buf, "{} ", vis);
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index d37260e96..5588130a1 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -9,7 +9,7 @@ pub(crate) trait ShortLabel {
9 9
10impl ShortLabel for ast::FnDef { 10impl ShortLabel for ast::FnDef {
11 fn short_label(&self) -> Option<String> { 11 fn short_label(&self) -> Option<String> {
12 Some(crate::display::function_label(self)) 12 Some(crate::display::function_declaration(self))
13 } 13 }
14} 14}
15 15