Skip to main content

Module workspace_index

Module workspace_index 

Source
Expand description

workspace_index salsa query — aggregates every file’s FileIndex into a single structure with pre-built reverse maps.

Before Phase J, cross-file queries (workspace_symbols, prepare_type_hierarchy, supertypes_of, subtypes_of, find_implementations) called DocumentStore::all_indexes() on every request. all_indexes() takes the host mutex once per file via get_index_salsasnapshot_query, so a workspace with 1600 files paid 1600 lock acquisitions per lookup.

This query runs once per workspace revision and returns:

  • files: the flat (Url, Arc<FileIndex>) list every handler used to rebuild by hand,
  • classes_by_name: name → [ClassRef] for constant-time prepare / supertype resolution,
  • subtypes_of: name → [ClassRef] for constant-time subtype / implementation lookups.

All lookups on the aggregate run in memory against an already-materialised Arc; edits invalidate the aggregate through file_index dependency tracking as usual.

Structs§

ClassRef
Back-pointer into WorkspaceIndexData.files: (file_idx, class_idx) where class_idx indexes into files[file_idx].1.classes.
WorkspaceIndexArc
Arc wrapper with the same Arc::ptr_eq-based Update impl used throughout src/db/. The inner WorkspaceIndexData never compares structurally.
WorkspaceIndexData
Aggregated workspace-level index. Constructed once per salsa revision by workspace_index and held behind an Arc for cheap cross-request sharing.

Functions§

workspace_index
Build the aggregate workspace index.