Skip to main content

Crate phpantom_lsp

Crate phpantom_lsp 

Source
Expand description

PHPantom — a lightweight PHP language server.

This crate is organised into the following modules:

  • types — Data structures for extracted PHP information (classes, methods, functions, etc.)
  • parser — PHP parsing and AST extraction using mago_syntax
  • completion — Completion logic (target extraction, type resolution, item building, and the top-level completion request handler)
  • composer — Composer autoload (PSR-4, classmap) parsing and class-to-file resolution
  • server — The LSP LanguageServer trait implementation (thin wrapper that delegates to feature-specific modules)
  • util — Utility helpers (position conversion, class lookup, logging)
  • hover — Hover support (textDocument/hover). Resolves the symbol under the cursor and returns type information, method signatures, and docblock descriptions
  • signature_help — Signature help (textDocument/signatureHelp). Shows parameter hints while typing function/method arguments, with active-parameter tracking
  • definition — Go-to-definition support for classes, members, and functions
  • inheritance — Base class inheritance resolution. Merges members from parent classes and traits into a unified ClassInfo
  • virtual_members — Virtual member provider abstraction. Defines the VirtualMemberProvider trait and merge logic for members synthesized from @method/@property tags, @mixin classes, and framework-specific patterns (e.g. Laravel)
  • resolution — Class and function lookup / name resolution (multi-phase: class_index → ast_map → classmap → PSR-4 → stubs)
  • subject_extraction — Shared helpers for extracting the left-hand side of ->, ?->, and :: access operators (used by both completion and definition)
  • docblock — PHPDoc block parsing, split into submodules:
    • docblock::tags — tag extraction (@return, @var, @property, @method, @mixin, @deprecated, @phpstan-assert, docblock text retrieval)
    • docblock::conditional — PHPStan conditional return type parsing
    • docblock::types — type cleaning utilities (clean_type, strip_nullable, is_scalar, split_type_token), PHPStan array shape parsing (parse_array_shape, extract_array_shape_value_type), and object shape parsing (parse_object_shape, extract_object_shape_property_type, is_object_shape)

Re-exports§

pub use types::AccessKind;
pub use types::ArrayShapeEntry;
pub use types::AssertionKind;
pub use types::ClassInfo;
pub use types::CompletionTarget;
pub use types::ConstantInfo;
pub use types::FunctionInfo;
pub use types::MethodInfo;
pub use types::ParameterInfo;
pub use types::PropertyInfo;
pub use types::TypeAssertion;
pub use types::Visibility;

Modules§

completion
composer
docblock
PHPDoc block parsing.
stubs
types
Data types used throughout the PHPantom server.

Structs§

Backend
The main LSP backend that holds all server state.