mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Filter attributes from the completion details/label
This commit is contained in:
parent
3e367b5760
commit
040fb91387
3 changed files with 49 additions and 0 deletions
|
@ -71,6 +71,7 @@ pub fn function_label(node: &ast::FnDef) -> Option<String> {
|
|||
.children()
|
||||
.filter(|child| !child.range().is_subrange(&body_range)) // Filter out body
|
||||
.filter(|child| ast::Comment::cast(child).is_none()) // Filter out comments
|
||||
.filter(|child| ast::Attr::cast(child).is_none()) // Filter out attributes
|
||||
.map(|node| node.text().to_string())
|
||||
.collect();
|
||||
label
|
||||
|
@ -86,6 +87,7 @@ pub fn const_label(node: &ast::ConstDef) -> String {
|
|||
.syntax()
|
||||
.children()
|
||||
.filter(|child| ast::Comment::cast(child).is_none())
|
||||
.filter(|child| ast::Attr::cast(child).is_none())
|
||||
.map(|node| node.text().to_string())
|
||||
.collect();
|
||||
|
||||
|
@ -97,6 +99,7 @@ pub fn type_label(node: &ast::TypeDef) -> String {
|
|||
.syntax()
|
||||
.children()
|
||||
.filter(|child| ast::Comment::cast(child).is_none())
|
||||
.filter(|child| ast::Attr::cast(child).is_none())
|
||||
.map(|node| node.text().to_string())
|
||||
.collect();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue