pub struct DocumentStore { /* private fields */ }Implementations§
Source§impl DocumentStore
impl DocumentStore
pub fn new() -> Self
Sourcepub fn psr4_arc(&self) -> Arc<RwLock<Psr4Map>> ⓘ
pub fn psr4_arc(&self) -> Arc<RwLock<Psr4Map>> ⓘ
Return the Arc<RwLock<Psr4Map>> so callers can share it.
Backend clones this arc at construction time so writes to the lock
(e.g. loading composer.json on initialized) are immediately visible
to lazy_load_psr4_imports without extra plumbing.
Sourcepub fn mirror_text(&self, uri: &Url, text: &str) -> SourceFile
pub fn mirror_text(&self, uri: &Url, text: &str) -> SourceFile
Mirror a file’s current text into the salsa layer. Creates the
SourceFile input on first sight, otherwise updates text on the
existing input (bumping the salsa revision so downstream queries
invalidate). Returns the SourceFile handle for this uri.
B4a: called from every text-changing mutation site. Reads still come
from the legacy map — this mirror is not yet observed by production
code paths.
Sourcepub fn source_file(&self, uri: &Url) -> Option<SourceFile>
pub fn source_file(&self, uri: &Url) -> Option<SourceFile>
Return the salsa SourceFile handle for a URL, if one exists.
Sourcepub fn seed_cached_slice(&self, uri: &Url, slice: Arc<StubSlice>) -> bool
pub fn seed_cached_slice(&self, uri: &Url, slice: Arc<StubSlice>) -> bool
Phase K2: pre-seed a StubSlice loaded from the on-disk cache
onto the SourceFile input for uri. The next file_definitions
call for that file returns the cached slice directly, skipping
parse + DefinitionCollector.
Must be called before any file_definitions(db, sf) call for
this file — otherwise salsa has already memoized the fresh-parse
result and setting cached_slice now would only bump the revision
without actually using the cache. In practice the workspace-scan
path seeds immediately after mirror_text and before any query
runs.
Returns false when uri was not mirrored (caller should mirror
first); returns true on success.
Sourcepub fn with_host<R>(&self, f: impl FnOnce(&AnalysisHost) -> R) -> R
pub fn with_host<R>(&self, f: impl FnOnce(&AnalysisHost) -> R) -> R
Run f with a borrow of the AnalysisHost. Used by tests and by the
upcoming *_salsa accessors to query the salsa layer.
Sourcepub fn evict_token_cache(&self, uri: &Url)
pub fn evict_token_cache(&self, uri: &Url)
Evict the semantic-tokens cache for uri. Called by Backend when a
file is closed; diff-based tokens computed against the old revision
are no longer meaningful.
Sourcepub fn index(&self, uri: Url, text: &str)
pub fn index(&self, uri: Url, text: &str)
Register a file in the salsa layer without marking it open.
Salsa’s parsed_doc query parses lazily on first read; diagnostics
are populated by did_open when the editor actually opens the file.
Sourcepub fn index_from_doc(
&self,
uri: Url,
doc: &ParsedDoc,
_diagnostics: Vec<Diagnostic>,
)
pub fn index_from_doc( &self, uri: Url, doc: &ParsedDoc, _diagnostics: Vec<Diagnostic>, )
Index a file using an already-parsed ParsedDoc, avoiding a second parse.
Prefer this over [index] when the caller already has a ParsedDoc (e.g.
after running DefinitionCollector during workspace scan).
_diagnostics is accepted for call-site compatibility; parse
diagnostics for background-indexed files are never consulted
(callers gate on get_doc_salsa returning Some).
pub fn remove(&self, uri: &Url)
Sourcepub fn get_doc_salsa(&self, uri: &Url) -> Option<Arc<ParsedDoc>>
pub fn get_doc_salsa(&self, uri: &Url) -> Option<Arc<ParsedDoc>>
Salsa-backed parsed document.
Salsa-backed parsed document for any mirrored file (open or
background-indexed). Returns None only when the file is not known
to the store. Callers that want “only if open” should gate on
Backend::open_files at the call site (see Backend::get_doc).
Sourcepub fn get_index_salsa(&self, uri: &Url) -> Option<Arc<FileIndex>>
pub fn get_index_salsa(&self, uri: &Url) -> Option<Arc<FileIndex>>
Salsa-backed compact symbol index.
Sourcepub fn sync_workspace_files(&self)
pub fn sync_workspace_files(&self)
Refresh workspace.files to mirror the current source_files set.
Called by get_codebase_salsa. Skips the setter when the file list
hasn’t changed — salsa’s set_field unconditionally bumps revision,
which would invalidate every downstream query (codebase, file_refs).
Dedup is essential for memoization across LSP requests.
Sourcepub fn set_php_version(&self, version: PhpVersion)
pub fn set_php_version(&self, version: PhpVersion)
Update the PHP version tracked by the workspace. Salsa will invalidate
all semantic_issues queries so diagnostics are re-evaluated.
Skips the setter when the version hasn’t changed to avoid spurious
query invalidation.
Sourcepub fn get_codebase_salsa(&self) -> Arc<Codebase> ⓘ
pub fn get_codebase_salsa(&self) -> Arc<Codebase> ⓘ
Salsa-backed finalized Codebase. Aggregates every known file’s
StubSlice via codebase_from_parts, memoized by salsa.
Phase C step 3: this runs in parallel with Backend’s imperative
Arc<Codebase>. Comparison tests validate parity; readers migrate in
a follow-up.
Sourcepub fn get_symbol_refs_salsa(&self, key: &str) -> Vec<(Arc<str>, u32, u16, u16)>
pub fn get_symbol_refs_salsa(&self, key: &str) -> Vec<(Arc<str>, u32, u16, u16)>
Salsa-backed reference lookup — drop-in replacement for
Codebase::get_reference_locations. First call per key runs
file_refs over every workspace file; subsequent calls hit the
symbol_refs memo.
Sourcepub fn get_workspace_index_salsa(&self) -> Arc<WorkspaceIndexData> ⓘ
pub fn get_workspace_index_salsa(&self) -> Arc<WorkspaceIndexData> ⓘ
Phase J: salsa-memoized aggregate workspace index.
Returns the shared Arc<WorkspaceIndexData> with flat
(Url, Arc<FileIndex>) list plus pre-built classes_by_name and
subtypes_of reverse maps. Used by workspace_symbols,
prepare_type_hierarchy, supertypes_of, subtypes_of, and
find_implementations so they don’t each rebuild the aggregate per
request. Invalidates automatically when any file’s file_index
changes.
Sourcepub fn warm_reference_index(&self)
pub fn warm_reference_index(&self)
Phase L: force file_refs to run for every workspace file so that
subsequent textDocument/references / prepare_rename / call-hierarchy
lookups hit the memo instead of paying first-call latency.
Uses parallel warming (warm_file_refs_parallel) so all file_refs
complete concurrently; symbol_refs then only aggregates memos.
Sourcepub fn slice_for(&self, uri: &Url) -> Option<Arc<StubSlice>>
pub fn slice_for(&self, uri: &Url) -> Option<Arc<StubSlice>>
Phase K2b: run file_definitions for uri and return the
resulting StubSlice. Used by the workspace-scan write path to
persist slices to disk after a cache miss.
Sourcepub fn get_method_returns_salsa(
&self,
uri: &Url,
) -> Option<Arc<MethodReturnsMap>>
pub fn get_method_returns_salsa( &self, uri: &Url, ) -> Option<Arc<MethodReturnsMap>>
Salsa-backed per-file method-return-type map.
Sourcepub fn store_token_cache(
&self,
uri: &Url,
result_id: String,
tokens: Vec<SemanticToken>,
)
pub fn store_token_cache( &self, uri: &Url, result_id: String, tokens: Vec<SemanticToken>, )
Cache the semantic tokens computed for a delta response.
result_id is an opaque string (a hash of the token data) returned to the client.
Sourcepub fn get_token_cache(
&self,
uri: &Url,
result_id: &str,
) -> Option<Vec<SemanticToken>>
pub fn get_token_cache( &self, uri: &Url, result_id: &str, ) -> Option<Vec<SemanticToken>>
Return the cached tokens if result_id matches the stored one.
Sourcepub fn get_semantic_issues_salsa(&self, uri: &Url) -> Option<Arc<[Issue]>>
pub fn get_semantic_issues_salsa(&self, uri: &Url) -> Option<Arc<[Issue]>>
Phase I: salsa-memoized raw semantic issues for a file. Callers apply
their own DiagnosticsConfig filter via
crate::semantic_diagnostics::issues_to_diagnostics — keeping the
filter outside the query preserves memoization across config toggles.
Sourcepub fn docs_for(&self, open_urls: &[Url]) -> Vec<(Url, Arc<ParsedDoc>)>
pub fn docs_for(&self, open_urls: &[Url]) -> Vec<(Url, Arc<ParsedDoc>)>
Returns (uri, doc) for files currently open in the editor.
Resolve open_urls (from Backend::open_urls()) to parsed docs.
Files not mirrored in the salsa layer are filtered out silently.
Sourcepub fn doc_with_others(
&self,
uri: &Url,
doc: Arc<ParsedDoc>,
open_urls: &[Url],
) -> Vec<(Url, Arc<ParsedDoc>)>
pub fn doc_with_others( &self, uri: &Url, doc: Arc<ParsedDoc>, open_urls: &[Url], ) -> Vec<(Url, Arc<ParsedDoc>)>
(primary, doc) first, then every other open file’s parsed doc.
The open_urls slice should include uri — this helper filters it out.
Sourcepub fn other_docs(
&self,
uri: &Url,
open_urls: &[Url],
) -> Vec<(Url, Arc<ParsedDoc>)>
pub fn other_docs( &self, uri: &Url, open_urls: &[Url], ) -> Vec<(Url, Arc<ParsedDoc>)>
Parsed docs for every entry in open_urls except uri.
Sourcepub fn other_docs_with_returns(
&self,
uri: &Url,
open_urls: &[Url],
) -> Vec<(Url, Arc<ParsedDoc>, Arc<MethodReturnsMap>)>
pub fn other_docs_with_returns( &self, uri: &Url, open_urls: &[Url], ) -> Vec<(Url, Arc<ParsedDoc>, Arc<MethodReturnsMap>)>
Batched salsa fetch for every entry in open_urls except uri:
returns each (uri, ParsedDoc, MethodReturnsMap) triple in a single
snapshot_query so cancellation retries don’t run N times.
Sourcepub fn all_indexes(&self) -> Vec<(Url, Arc<FileIndex>)>
pub fn all_indexes(&self) -> Vec<(Url, Arc<FileIndex>)>
Compact symbol index for every mirrored file.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DocumentStore
impl !RefUnwindSafe for DocumentStore
impl Send for DocumentStore
impl Sync for DocumentStore
impl Unpin for DocumentStore
impl UnsafeUnpin for DocumentStore
impl !UnwindSafe for DocumentStore
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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