Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 549aae7

Browse files
committed
Add a few more doc lines to the span crate
1 parent 8a5bb9d commit 549aae7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/span/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
2931
pub 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.
3237
pub 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,

0 commit comments

Comments
 (0)