File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,14 @@ pub struct FileRange {
2626 pub range : TextRange ,
2727}
2828
29+ /// See crates\hir-expand\src\ast_id_map.rs
30+ /// This is a type erased FileAstId.
2931pub type ErasedFileAstId = la_arena:: Idx < syntax:: SyntaxNodePtr > ;
3032
3133// The first index is always the root node's AstId
34+ /// The root ast id always points to the encompassing file, using this in spans is discouraged as
35+ /// any range relative to it will be effectively absolute, ruining the entire point of anchored
36+ /// relative text ranges.
3237pub const ROOT_ERASED_FILE_AST_ID : ErasedFileAstId =
3338 la_arena:: Idx :: from_raw ( la_arena:: RawIdx :: from_u32 ( 0 ) ) ;
3439
@@ -47,6 +52,7 @@ pub struct SpanData<Ctx> {
4752 /// We need the anchor for incrementality, as storing absolute ranges will require
4853 /// recomputation on every change in a file at all times.
4954 pub range : TextRange ,
55+ /// The anchor this span is relative to.
5056 pub anchor : SpanAnchor ,
5157 /// The syntax context of the span.
5258 pub ctx : Ctx ,
You can’t perform that action at this time.
0 commit comments