Skip to content

Latest commit

 

History

History
64 lines (40 loc) · 1.57 KB

File metadata and controls

64 lines (40 loc) · 1.57 KB

Building & Development

Quick Start

cargo build --release   # build the binary

Prerequisites

  • Rust (stable toolchain)

Build

The build.rs script automatically fetches the latest JetBrains phpstorm-stubs from GitHub and embeds them directly into the binary. This gives the LSP full knowledge of built-in PHP classes, functions, and constants with no runtime dependencies.

The stubs are downloaded on first build and cached in stubs/. To update to the latest stubs, delete the stubs/ directory and rebuild.

For details on how symbol resolution and stub loading work, see ARCHITECTURE.md.

Testing

Run the full test suite:

cargo test

CI Checks

Before submitting changes, run exactly what CI runs:

cargo test
cargo clippy -- -D warnings
cargo clippy --tests -- -D warnings
cargo fmt --check
php -l example.php
php -d zend.assertions=1 example.php

All six must pass with zero warnings and zero failures.

Manual LSP Testing

The included test_lsp.sh script sends JSON-RPC messages to the server over stdin/stdout, exercising the full LSP protocol flow (initialize, open file, hover, completion, shutdown):

./test_lsp.sh

This is useful for verifying end-to-end behavior outside of an editor.

Debugging

Enable logging by setting the RUST_LOG environment variable:

RUST_LOG=debug cargo run 2>phpantom.log

Logs are written to stderr, so redirect as needed.

For editor setup instructions, see SETUP.md.