Skip to content

Analyzer: library API, incremental per-file index, ranged diagnostics #453

Open

Description

@blacktrs

Why

Analysis is reachable only through the CLI: Manticore perform_analysis (Main.php) depends on the global CompileArgs files, parses everything, loads the prelude on every run, builds Index for the whole set and prints. Index::build is batch-only and Diagnostic has a single point. An editor needs per-document updates and ranges.

Scope

  • Workspace-style API: open/update/close a document, diagnostics for a URI. No globals, no echo, no exit codes; AnalyzeCommand becomes a thin caller.
  • Index::replaceFile / removeFile plus a reverse-dependency map (extends, implements, uses, traits) for invalidation. Prelude and stdlib signatures loaded once per process.
  • Diagnostic gains end line/col, optional related locations and tags; Report::json stays backward compatible.
  • Position queries: nodeAt, enclosing scope, type at position, definition of a name, all references.
  • Rules tolerate error nodes; closed-world undefined-symbol rules are suppressed in files with parse errors.

Depends on

Parser tolerant mode, end positions, name occurrences.

Acceptance

  • Library result equals analyze --json on the corpus; CLI output unchanged apart from added fields.
  • Warm single-file update within a budget measured on a mid-size project.

Design: docs/superpowers/specs/2026-10-25-lsp-foundation-design.md (Phase 2).

Activity

  1. added
    enhancement
    needs-design
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-design

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions