Skip to main content

Crate php_lsp

Crate php_lsp 

Source
Expand description

§php-lsp — domain vocabulary

The terms below have one canonical meaning across the crate. Use them consistently; do not introduce synonyms.

§Core nouns

  • ParsedDoc — a fully parsed source file: AST program + source text + line table, backed by a bumpalo arena. The unit a user has open.
  • FileIndex — the compact (~2 KB) serializable per-file declaration summary used for background-indexed (unopened) files.
  • WorkspaceIndex (WorkspaceIndexData) — the aggregated cross-file index over every FileIndex, with name→location reverse maps.
  • Workspace — the salsa input representing the project root / file set. (There is intentionally no “Codebase” type — it would be a synonym.)
  • SymbolMap / SymbolEntry — per-file precomputed name→declarations table for open files; richer than FileIndex.
  • Declaration (resolve::Declaration) — the AST node where a symbol is introduced. Shared by both the goto_definition and goto_declaration LSP requests (which stay distinct — see navigation/).
  • Docblock — a PHPDoc /** … */ comment and the data parsed from it.

§Naming conventions

  • verb indexingest: ingesting a file into the store is ingest*; the noun index (FileIndex, the file_index query) is always a data structure, never an action.
  • doc as a value/variable means a ParsedDoc. Docblock-derived data uses the Doc type prefix (DocMethod, DocProperty) or a field named docblock. Never name a docblock field doc.
  • Type suffixes: -Def = an owned declaration record stored in an index (FunctionDef, ClassDef); -Entry = a row returned from a name-keyed map (SymbolEntry); -Ref = an internal back-pointer/handle into an index (ClassRef, DeclRef) — not an LSP reference. The spelled-out word Reference/refs is reserved for a symbol usage in code (see navigation/references.rs, walk.rs).
  • sv is the established local idiom for a borrowed SourceView.

Re-exports§

pub use analysis::semantic_diagnostics;
pub use editing::rename;
pub use navigation::call_hierarchy;
pub use navigation::definition;
pub use navigation::implementation;
pub use navigation::references;
pub use navigation::symbols;

Modules§

actions
analysis
ast
Core AST infrastructure: arena-backed ParsedDoc, span utilities, and TypeHint formatting.
backend
completion
config
db
Salsa-based incremental computation layer.
document_store
editing
file_index
hover
navigation
symbol_map
Per-file memoized symbol table.
type_map

Macros§

impl_arc_update
Implement the salsa::Update trait for Arc-wrapped types using pointer equality. This reduces boilerplate for types that wrap a single Arc field and should only invalidate when the pointer changes (not the contents).