mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Implement completion for associated items
This commit is contained in:
parent
37148000dc
commit
7e8527f748
7 changed files with 265 additions and 1 deletions
|
@ -80,3 +80,25 @@ pub fn function_label(node: &ast::FnDef) -> Option<String> {
|
|||
|
||||
Some(label.trim().to_owned())
|
||||
}
|
||||
|
||||
pub fn const_label(node: &ast::ConstDef) -> String {
|
||||
let label: String = node
|
||||
.syntax()
|
||||
.children()
|
||||
.filter(|child| ast::Comment::cast(child).is_none())
|
||||
.map(|node| node.text().to_string())
|
||||
.collect();
|
||||
|
||||
label.trim().to_owned()
|
||||
}
|
||||
|
||||
pub fn type_label(node: &ast::TypeDef) -> String {
|
||||
let label: String = node
|
||||
.syntax()
|
||||
.children()
|
||||
.filter(|child| ast::Comment::cast(child).is_none())
|
||||
.map(|node| node.text().to_string())
|
||||
.collect();
|
||||
|
||||
label.trim().to_owned()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue