diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-03-01 15:20:30 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-03-01 15:20:30 +0100 |
| commit | 549aae7c07db78b11871aa1a01bae637e7190b18 (patch) | |
| tree | 2a536137de9426d221b6169ff2a75cd27eca4e9f | |
| parent | 8a5bb9d5acb664448e2f8410662b59e078c6f0f0 (diff) | |
Add a few more doc lines to the span crate
| -rw-r--r-- | crates/span/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/span/src/lib.rs b/crates/span/src/lib.rs index 00f82646077..6b363e9050c 100644 --- a/crates/span/src/lib.rs +++ b/crates/span/src/lib.rs @@ -26,9 +26,14 @@ pub struct FileRange { pub range: TextRange, } +/// See crates\hir-expand\src\ast_id_map.rs +/// This is a type erased FileAstId. pub type ErasedFileAstId = la_arena::Idx<syntax::SyntaxNodePtr>; // The first index is always the root node's AstId +/// The root ast id always points to the encompassing file, using this in spans is discouraged as +/// any range relative to it will be effectively absolute, ruining the entire point of anchored +/// relative text ranges. pub const ROOT_ERASED_FILE_AST_ID: ErasedFileAstId = la_arena::Idx::from_raw(la_arena::RawIdx::from_u32(0)); @@ -47,6 +52,7 @@ pub struct SpanData<Ctx> { /// We need the anchor for incrementality, as storing absolute ranges will require /// recomputation on every change in a file at all times. pub range: TextRange, + /// The anchor this span is relative to. pub anchor: SpanAnchor, /// The syntax context of the span. pub ctx: Ctx, |
