aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion.rs
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-04-08 09:44:23 +0100
committerVille Penttinen <[email protected]>2019-04-09 12:45:05 +0100
commit946b5789d1ea6385a345fcb4aa0658392ec44a51 (patch)
treee5c517463b5c3b0e6727c5b0717e0f03ee452fe4 /crates/ra_ide_api/src/completion.rs
parentdfaebd76aba1cfd7ac13b940d7847eb44b953cac (diff)
Move completion label functions to display
Diffstat (limited to 'crates/ra_ide_api/src/completion.rs')
-rw-r--r--crates/ra_ide_api/src/completion.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index 71a35c689..deff59cd3 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -13,12 +13,10 @@ mod complete_scope;
13mod complete_postfix; 13mod complete_postfix;
14 14
15use ra_db::SourceDatabase; 15use ra_db::SourceDatabase;
16use ra_syntax::{ast::{self, AstNode}, SyntaxKind::{ATTR, COMMENT}};
17 16
18use crate::{ 17use crate::{
19 db, 18 db,
20 FilePosition, 19 FilePosition,
21 FunctionSignature,
22 completion::{ 20 completion::{
23 completion_item::{Completions, CompletionKind}, 21 completion_item::{Completions, CompletionKind},
24 completion_context::CompletionContext, 22 completion_context::CompletionContext,
@@ -71,29 +69,3 @@ pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Opti
71 complete_postfix::complete_postfix(&mut acc, &ctx); 69 complete_postfix::complete_postfix(&mut acc, &ctx);
72 Some(acc) 70 Some(acc)
73} 71}
74
75pub fn function_label(node: &ast::FnDef) -> Option<String> {
76 Some(FunctionSignature::from(node).to_string())
77}
78
79pub fn const_label(node: &ast::ConstDef) -> String {
80 let label: String = node
81 .syntax()
82 .children_with_tokens()
83 .filter(|child| !(child.kind() == COMMENT || child.kind() == ATTR))
84 .map(|node| node.to_string())
85 .collect();
86
87 label.trim().to_owned()
88}
89
90pub fn type_label(node: &ast::TypeAliasDef) -> String {
91 let label: String = node
92 .syntax()
93 .children_with_tokens()
94 .filter(|child| !(child.kind() == COMMENT || child.kind() == ATTR))
95 .map(|node| node.to_string())
96 .collect();
97
98 label.trim().to_owned()
99}