Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ mimalloc = ["dep:mimalloc", "dep:libmimalloc-sys", "dep:libc"]
# installs a counting global allocator that adds two atomics to every
# allocation, so it must never be enabled in a shipped build.
mem-audit = []
# Owned semantic records for non-LSP consumers. Kept out of default builds so
# the public surface and its code have zero cost for editor users.
semantic-export = []
# Prevent the build script from downloading phpstorm-stubs. Existing local
# stubs are still embedded; a build without them gets an empty stub index.
offline-stubs = []

# Download size is what matters in the browser, so the wasm module is built for
# size rather than speed. A separate profile keeps this away from the native
Expand Down
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ fn main() {
println!("cargo:rerun-if-changed=.");
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=stubs.lock");
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_OFFLINE_STUBS");
// Re-run when HEAD moves (commit, checkout, tag) so the embedded
// version string stays current.
println!("cargo:rerun-if-changed=.git/HEAD");
Expand Down Expand Up @@ -154,6 +155,15 @@ fn main() {
}
}

if needs_fetch && env::var_os("CARGO_FEATURE_OFFLINE_STUBS").is_some() {
eprintln!(
"cargo:warning=Stubs are unavailable or stale; building without them because the offline-stubs feature is enabled."
);
println!("cargo:rustc-env=PHPANTOM_STUBS_VERSION=none");
write_empty_stubs();
return;
}

if needs_fetch {
let stubs_path = stubs_root.join(STUBS_DIR_REL);
if stubs_path.exists() {
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- **Call hierarchy.** Editors can now ask who calls a function or method and what it calls in turn, walking the tree outward one level at a time. Incoming calls group every call site under the function or method containing it, so a method reached from twenty places in one class lists that class once with twenty ranges rather than twenty separate entries. Outgoing calls resolve each callee through the same engine go-to-definition uses, including the constructor a `new` expression runs, so a call that crosses into another file lands on the declaration there. Naming a callable without invoking it, a read of a same-named property or a `@see` tag pointing at the method, is not a call and stays out of both directions. Contributed by @sidux.
- **Headless consumers can export owned semantic records without starting an LSP transport.** The optional `semantic-export` feature accepts caller-supplied PHP documents, resolves them together, and returns deterministic declarations, occurrences, calls, byte ranges, and document diagnostics through batch or streaming APIs. An independent `offline-stubs` feature guarantees that missing stubs do not trigger a build-time download. Contributed by @aaaaaandrew.
- **`analyze` takes more than one path.** `phpantom_lsp analyze app/ lib/Helper.php tests/` scans the union of everything named, mixing directories and single files freely, so a pre-commit hook or a CI step can hand it exactly the paths that changed instead of running the whole project or invoking the binary once per path. Overlapping arguments are reported once, and a path that does not exist still stops the run with exit code 2. Naming no path scans the entire project, as before.
- **Indexing excludes and extra PHP extensions.** `.phpantom.toml` now supports `[indexing] exclude`, gitignore-style patterns relative to the workspace root that background discovery skips (generated code, test fixtures, upload directories), and `[indexing] extensions`, extra file extensions treated as PHP source (e.g. `["module", "inc", "theme"]` for Drupal), with matching file watchers so edits to those files refresh the index. Excludes apply to every workspace scanner, including the Drupal web-root scan and the directories `analyze` walks. A file you open in the editor, or name outright on the `analyze` command line, is always served regardless. Contributed by @syntlyx.

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ pub(crate) mod scope_collector;
mod selection_range;
#[cfg(not(target_arch = "wasm32"))]
pub mod self_update;
#[cfg(feature = "semantic-export")]
pub mod semantic_export;
mod semantic_tokens;
mod server;
mod signature_help;
Expand Down
Loading
Loading