diff options
author | Laurențiu Nicola <[email protected]> | 2019-02-12 08:33:23 +0000 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2019-02-12 10:51:01 +0000 |
commit | 7e8527f74831b37c5757ea6b25e40bcbb61bb6d4 (patch) | |
tree | e7bddef556f430d31903a54fced0df760673a0e8 /crates/ra_ide_api/src/completion.rs | |
parent | 37148000dcd43e5ccba4737a3e379f1ae6861893 (diff) |
Implement completion for associated items
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 | } | ||