pub struct DocumentAnalysis {Show 14 fields
pub source: String,
pub line_index: LineIndex,
pub root: Option<SyntaxNode>,
pub include_tree: Option<IncludeTree>,
pub main_path: Option<PathBuf>,
pub diagnostics: Vec<SemanticDiagnostic>,
pub type_map: HashMap<(u32, u32), Type>,
pub scope_store: ScopeStore,
pub scope_extents: Vec<(ScopeId, (u32, u32))>,
pub definition_map: HashMap<(String, RootSymbolKind), (PathBuf, u32, u32)>,
pub doc_map: HashMap<(u32, u32), DocComment>,
pub include_doc_maps: Option<HashMap<PathBuf, HashMap<(u32, u32), DocComment>>>,
pub class_super: HashMap<String, String>,
pub sig_definition_locations: Option<HashMap<String, (PathBuf, u32)>>,
}Expand description
Result of document-level analysis: source, AST, diagnostics, scope, types, definition map, doc maps, class hierarchy.
Fields§
§source: StringMain document source (what the client has).
line_index: LineIndexLine index for the main document.
root: Option<SyntaxNode>Program root (main file); None if parse failed.
include_tree: Option<IncludeTree>When Some, the document has includes; tree holds main + included files.
main_path: Option<PathBuf>Path of the main document (when file URI), for go-to-def on include.
diagnostics: Vec<SemanticDiagnostic>Semantic and parse diagnostics.
type_map: HashMap<(u32, u32), Type>Map from expression span (start, end) to inferred type.
scope_store: ScopeStore§scope_extents: Vec<(ScopeId, (u32, u32))>Scope extent (ScopeId, (start_byte, end_byte)) for scope_at_offset.
definition_map: HashMap<(String, RootSymbolKind), (PathBuf, u32, u32)>(name, kind) -> (path, start_byte, end_byte) for root-level symbols.
doc_map: HashMap<(u32, u32), DocComment>Map from declaration (start_byte, end_byte) to parsed Doxygen-style documentation.
include_doc_maps: Option<HashMap<PathBuf, HashMap<(u32, u32), DocComment>>>When Some (with include_tree), doc_map per included file path.
class_super: HashMap<String, String>Class name -> superclass name (for visibility: subclass can see protected).
sig_definition_locations: Option<HashMap<String, (PathBuf, u32)>>When Some, function/global name -> (path, 0-based line) from .sig files for hover/definition links.
Implementations§
Source§impl DocumentAnalysis
impl DocumentAnalysis
Sourcepub fn new_with_options(
options: &DocumentAnalysisOptions<'_>,
) -> DocumentAnalysis
pub fn new_with_options( options: &DocumentAnalysisOptions<'_>, ) -> DocumentAnalysis
Run parsing and analysis from options.
When main_path is set and build_include_tree succeeds, uses
the include tree and analyzes with included files and signature_roots. Otherwise parses a
single file (or uses existing_root when provided) and optionally uses signature_roots.
Sourcepub fn new(
source: &str,
main_path: Option<&Path>,
signature_roots: &[SyntaxNode],
existing_root: Option<SyntaxNode>,
sig_definition_locations: Option<HashMap<String, (PathBuf, u32)>>,
) -> DocumentAnalysis
pub fn new( source: &str, main_path: Option<&Path>, signature_roots: &[SyntaxNode], existing_root: Option<SyntaxNode>, sig_definition_locations: Option<HashMap<String, (PathBuf, u32)>>, ) -> DocumentAnalysis
Run parsing and analysis for the given source.
Convenience wrapper around Self::new_with_options. When main_path is Some and
build_include_tree succeeds, uses the include tree; otherwise parses a single file (or uses
existing_root when provided, e.g. from incremental reparse).
Sourcepub fn symbol_at_offset(&self, byte_offset: u32) -> Option<ResolvedSymbol>
pub fn symbol_at_offset(&self, byte_offset: u32) -> Option<ResolvedSymbol>
Resolve the symbol at the given byte offset (e.g. variable, function, class, global).
Returns None if there is no root, no token at offset, or the identifier does not resolve.
Sourcepub fn type_at_offset(&self, byte_offset: u32) -> Option<Type>
pub fn type_at_offset(&self, byte_offset: u32) -> Option<Type>
Type at the given byte offset. Looks up the node at offset in the type map, then walks ancestors until a type is found.
Sourcepub fn definition_span_for(
&self,
name: &str,
kind: RootSymbolKind,
) -> Option<(PathBuf, u32, u32)>
pub fn definition_span_for( &self, name: &str, kind: RootSymbolKind, ) -> Option<(PathBuf, u32, u32)>
Definition span for a root-level symbol: (path, start_byte, end_byte).
Returns None if the name/kind is not in the definition map.
Sourcepub fn minimal(source: String) -> DocumentAnalysis
pub fn minimal(source: String) -> DocumentAnalysis
Build minimal document state with only source and line index (no parse/analysis).
Used by the LSP to update the document buffer immediately on did_change so that
subsequent changes are applied to the correct base; analysis overwrites this when it completes.
Sourcepub fn minimal_with_root(source: String, root: SyntaxNode) -> DocumentAnalysis
pub fn minimal_with_root(source: String, root: SyntaxNode) -> DocumentAnalysis
Like Self::minimal but keeps the given root so the next incremental reparse can reuse it.
Use when reparse succeeded and analysis will run async; keeps the tree available for the next edit.
Sourcepub fn from_parse_only(source: &str) -> DocumentAnalysis
pub fn from_parse_only(source: &str) -> DocumentAnalysis
Build document state from source using parse only (no semantic analysis). Use when full analysis panics so the LSP can still provide syntax highlighting and basic features.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DocumentAnalysis
impl RefUnwindSafe for DocumentAnalysis
impl Send for DocumentAnalysis
impl Sync for DocumentAnalysis
impl Unpin for DocumentAnalysis
impl UnsafeUnpin for DocumentAnalysis
impl UnwindSafe for DocumentAnalysis
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more