@@ -18,7 +18,7 @@ use ra_ap_ide_db::line_index::{LineCol, LineIndex};
18
18
use ra_ap_ide_db:: RootDatabase ;
19
19
use ra_ap_parser:: SyntaxKind ;
20
20
use ra_ap_span:: { EditionedFileId , TextSize } ;
21
- use ra_ap_syntax:: ast:: HasName ;
21
+ use ra_ap_syntax:: ast:: { Const , Fn , HasName , Static } ;
22
22
use ra_ap_syntax:: {
23
23
ast, AstNode , NodeOrToken , SyntaxElementChildren , SyntaxError , SyntaxNode , SyntaxToken ,
24
24
TextRange ,
@@ -563,7 +563,31 @@ impl<'a> Translator<'a> {
563
563
} ) ( ) ;
564
564
}
565
565
566
- pub ( crate ) fn should_be_excluded ( & self , item : & impl ast:: HasAttrs ) -> bool {
566
+ pub ( crate ) fn should_be_excluded ( & self , item : & ( impl ast:: HasAttrs + ast:: AstNode ) ) -> bool {
567
+ let syntax = item. syntax ( ) ;
568
+ if let Some ( body) = syntax. parent ( ) . and_then ( Fn :: cast) . and_then ( |x| x. body ( ) ) {
569
+ if body. syntax ( ) == item. syntax ( ) {
570
+ log:: warn!( "Skipping Fn body" ) ;
571
+ return true ;
572
+ }
573
+ }
574
+ if let Some ( body) = syntax. parent ( ) . and_then ( Const :: cast) . and_then ( |x| x. body ( ) ) {
575
+ if body. syntax ( ) == item. syntax ( ) {
576
+ log:: warn!( "Skipping Const body" ) ;
577
+ return true ;
578
+ }
579
+ }
580
+ if let Some ( body) = syntax
581
+ . parent ( )
582
+ . and_then ( Static :: cast)
583
+ . and_then ( |x| x. body ( ) )
584
+ {
585
+ if body. syntax ( ) == item. syntax ( ) {
586
+ log:: warn!( "Skipping Static body" ) ;
587
+ return true ;
588
+ }
589
+ }
590
+
567
591
self . semantics . is_some_and ( |sema| {
568
592
item. attrs ( ) . any ( |attr| {
569
593
attr. as_simple_call ( ) . is_some_and ( |( name, tokens) | {
0 commit comments