diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-12 19:31:22 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-12 19:31:22 +0000 |
commit | 61324a845bde0959c1f9ac86ce31d022812f4c21 (patch) | |
tree | ad3e3f696a6680493caaf8300acb26f1bfae761f /crates/ra_ide_api/src/completion.rs | |
parent | 24287d024dd72d0f8325c9de7b7e90db58a634dc (diff) | |
parent | 040fb91387105bca7f2b6fcb845f836217b0a7ee (diff) |
Merge #811
811: Filter attributes from the completion details/label r=kjeremy a=lnicola
Before:
![image](https://user-images.githubusercontent.com/308347/52657254-efba9a00-2f00-11e9-952f-901910cfc459.png)
After:
![image](https://user-images.githubusercontent.com/308347/52657278-fb0dc580-2f00-11e9-9267-8aff44c93447.png)
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs index 2b94931c6..4a38d62bb 100644 --- a/crates/ra_ide_api/src/completion.rs +++ b/crates/ra_ide_api/src/completion.rs | |||
@@ -71,6 +71,7 @@ pub fn function_label(node: &ast::FnDef) -> Option<String> { | |||
71 | .children() | 71 | .children() |
72 | .filter(|child| !child.range().is_subrange(&body_range)) // Filter out body | 72 | .filter(|child| !child.range().is_subrange(&body_range)) // Filter out body |
73 | .filter(|child| ast::Comment::cast(child).is_none()) // Filter out comments | 73 | .filter(|child| ast::Comment::cast(child).is_none()) // Filter out comments |
74 | .filter(|child| ast::Attr::cast(child).is_none()) // Filter out attributes | ||
74 | .map(|node| node.text().to_string()) | 75 | .map(|node| node.text().to_string()) |
75 | .collect(); | 76 | .collect(); |
76 | label | 77 | label |
@@ -86,6 +87,7 @@ pub fn const_label(node: &ast::ConstDef) -> String { | |||
86 | .syntax() | 87 | .syntax() |
87 | .children() | 88 | .children() |
88 | .filter(|child| ast::Comment::cast(child).is_none()) | 89 | .filter(|child| ast::Comment::cast(child).is_none()) |
90 | .filter(|child| ast::Attr::cast(child).is_none()) | ||
89 | .map(|node| node.text().to_string()) | 91 | .map(|node| node.text().to_string()) |
90 | .collect(); | 92 | .collect(); |
91 | 93 | ||
@@ -97,6 +99,7 @@ pub fn type_label(node: &ast::TypeDef) -> String { | |||
97 | .syntax() | 99 | .syntax() |
98 | .children() | 100 | .children() |
99 | .filter(|child| ast::Comment::cast(child).is_none()) | 101 | .filter(|child| ast::Comment::cast(child).is_none()) |
102 | .filter(|child| ast::Attr::cast(child).is_none()) | ||
100 | .map(|node| node.text().to_string()) | 103 | .map(|node| node.text().to_string()) |
101 | .collect(); | 104 | .collect(); |
102 | 105 | ||