@@ -815,7 +815,7 @@ impl<'a> InFile<&'a SyntaxNode> {
815815 /// Falls back to the macro call range if the node cannot be mapped up fully.
816816 ///
817817 /// For attributes and derives, this will point back to the attribute only.
818- /// For the entire item `InFile::use original_file_range_full`.
818+ /// For the entire item use [ `InFile::original_file_range_full`] .
819819 pub fn original_file_range ( self , db : & dyn db:: AstDatabase ) -> FileRange {
820820 match self . file_id . repr ( ) {
821821 HirFileIdRepr :: FileId ( file_id) => FileRange { file_id, range : self . value . text_range ( ) } ,
@@ -830,6 +830,21 @@ impl<'a> InFile<&'a SyntaxNode> {
830830 }
831831 }
832832
833+ /// Falls back to the macro call range if the node cannot be mapped up fully.
834+ pub fn original_file_range_full ( self , db : & dyn db:: AstDatabase ) -> FileRange {
835+ match self . file_id . repr ( ) {
836+ HirFileIdRepr :: FileId ( file_id) => FileRange { file_id, range : self . value . text_range ( ) } ,
837+ HirFileIdRepr :: MacroFile ( mac_file) => {
838+ if let Some ( res) = self . original_file_range_opt ( db) {
839+ return res;
840+ }
841+ // Fall back to whole macro call.
842+ let loc = db. lookup_intern_macro_call ( mac_file. macro_call_id ) ;
843+ loc. kind . original_call_range_with_body ( db)
844+ }
845+ }
846+ }
847+
833848 /// Attempts to map the syntax node back up its macro calls.
834849 pub fn original_file_range_opt ( self , db : & dyn db:: AstDatabase ) -> Option < FileRange > {
835850 match ascend_node_border_tokens ( db, self ) {
0 commit comments