File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ pub fn function_label(node: &ast::FnDef) -> Option<String> {
7171 . children ( )
7272 . filter ( |child| !child. range ( ) . is_subrange ( & body_range) ) // Filter out body
7373 . filter ( |child| ast:: Comment :: cast ( child) . is_none ( ) ) // Filter out comments
74+ . filter ( |child| ast:: Attr :: cast ( child) . is_none ( ) ) // Filter out attributes
7475 . map ( |node| node. text ( ) . to_string ( ) )
7576 . collect ( ) ;
7677 label
@@ -86,6 +87,7 @@ pub fn const_label(node: &ast::ConstDef) -> String {
8687 . syntax ( )
8788 . children ( )
8889 . filter ( |child| ast:: Comment :: cast ( child) . is_none ( ) )
90+ . filter ( |child| ast:: Attr :: cast ( child) . is_none ( ) )
8991 . map ( |node| node. text ( ) . to_string ( ) )
9092 . collect ( ) ;
9193
@@ -97,6 +99,7 @@ pub fn type_label(node: &ast::TypeDef) -> String {
9799 . syntax ( )
98100 . children ( )
99101 . filter ( |child| ast:: Comment :: cast ( child) . is_none ( ) )
102+ . filter ( |child| ast:: Attr :: cast ( child) . is_none ( ) )
100103 . map ( |node| node. text ( ) . to_string ( ) )
101104 . collect ( ) ;
102105
Original file line number Diff line number Diff line change @@ -179,6 +179,26 @@ mod tests {
179179 ) ;
180180 }
181181
182+ #[ test]
183+ fn test_method_attr_filtering ( ) {
184+ check_ref_completion (
185+ "method_attr_filtering" ,
186+ r"
187+ struct A {}
188+ impl A {
189+ #[inline]
190+ fn the_method(&self) {
191+ let x = 1;
192+ let y = 2;
193+ }
194+ }
195+ fn foo(a: A) {
196+ a.<|>
197+ }
198+ " ,
199+ ) ;
200+ }
201+
182202 #[ test]
183203 fn test_tuple_field_completion ( ) {
184204 check_ref_completion (
Original file line number Diff line number Diff line change 1+ -- -
2+ created : " 2019-02-12T18:32:09.428929418Z"
3+ creator : insta @0.6 .2
4+ source : crates / ra_ide_api / src / completion / completion_item .rs
5+ expression : kind_completions
6+ -- -
7+ [
8+ CompletionItem {
9+ completion_kind: Reference ,
10+ label: " the_method" ,
11+ kind: Some (
12+ Method
13+ ),
14+ detail: Some (
15+ " fn the_method(&self)"
16+ ),
17+ documentation: None ,
18+ lookup: None ,
19+ insert_text: Some (
20+ " the_method()$0"
21+ ),
22+ insert_text_format: Snippet ,
23+ source_range: [249 ; 249 ),
24+ text_edit : None
25+ }
26+ ]
You can’t perform that action at this time.
0 commit comments