Skip to main content

php_lsp/db/
index.rs

1//! `file_index` salsa query — derives a compact `FileIndex` from a parsed
2//! document. Depends on `parsed_doc`, so editing a file reparses once and the
3//! index re-extracts from the new AST.
4
5use std::sync::Arc;
6
7use crate::index::file_index::FileIndex;
8
9/// Arc wrapper for `FileIndex`. Uses structural equality on the inner
10/// `FileIndex` so salsa can short-circuit downstream queries (e.g.
11/// `workspace_index`) when a body-only edit produces an identical index.
12#[derive(Clone, PartialEq, Debug)]
13pub struct IndexArc(pub Arc<FileIndex>);
14
15impl IndexArc {
16    pub fn get(&self) -> &FileIndex {
17        &self.0
18    }
19}