diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs index 722d94f3a..83c243944 100644 --- a/crates/ra_ide_api/src/completion.rs +++ b/crates/ra_ide_api/src/completion.rs | |||
@@ -80,3 +80,25 @@ pub fn function_label(node: &ast::FnDef) -> Option<String> { | |||
80 | 80 | ||
81 | Some(label.trim().to_owned()) | 81 | Some(label.trim().to_owned()) |
82 | } | 82 | } |
83 | |||
84 | pub fn const_label(node: &ast::ConstDef) -> String { | ||
85 | let label: String = node | ||
86 | .syntax() | ||
87 | .children() | ||
88 | .filter(|child| ast::Comment::cast(child).is_none()) | ||
89 | .map(|node| node.text().to_string()) | ||
90 | .collect(); | ||
91 | |||
92 | label.trim().to_owned() | ||
93 | } | ||
94 | |||
95 | pub fn type_label(node: &ast::TypeDef) -> String { | ||
96 | let label: String = node | ||
97 | .syntax() | ||
98 | .children() | ||
99 | .filter(|child| ast::Comment::cast(child).is_none()) | ||
100 | .map(|node| node.text().to_string()) | ||
101 | .collect(); | ||
102 | |||
103 | label.trim().to_owned() | ||
104 | } | ||