Skip to content

Commit 558e2f4

Browse files
committed
Add indexing roadmap
1 parent 513a0dd commit 558e2f4

4 files changed

Lines changed: 486 additions & 8 deletions

File tree

docs/ARCHITECTURE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ Both features follow the same principle for vendor code: the Composer classmap i
2323

2424
The two walkers differ in scope because GTI only needs class declarations (which live in PSR-4 roots), while Find References needs any usage of a symbol, which could be in a standalone script, config file, or `index.php` at the project root.
2525

26+
## Design Philosophy
27+
28+
PHPantom is built in layers. Each layer is independently useful and independently testable.
29+
30+
- **Layer 0: Stubs.** Embedded PHP standard library types. Available immediately, no project context needed.
31+
- **Layer 1: Single file.** Parse the open file, extract classes/functions/symbols. Completion, hover, and go-to-definition work within the file with no cross-file resolution at all.
32+
- **Layer 2: On-demand resolution.** When a symbol references a class in another file, resolve it through the classmap or PSR-4 and parse that file. Only the files actually needed are touched.
33+
- **Layer 3: Classmap.** A name-to-path index covering the whole project. Enables class name completion and O(1) cross-file lookup. Built from Composer's output or self-generated via a fast byte-level scan.
34+
- **Layer 4: Full index (opt-in).** Background-parse every file in the classmap. Enables workspace symbols, fast find-references, and rich completion item detail.
35+
36+
Each layer builds on the one below it. A bug in classmap generation doesn't break single-file completion. A slow full index doesn't block on-demand resolution. New features can be developed and tested against the lower layers without waiting for a full project scan. This is also why PHPantom starts fast: Layer 0-2 are ready in milliseconds, Layer 3 takes seconds, and Layer 4 (when enabled) fills in over the following minute.
37+
2638
## Module Layout
2739

2840
```

docs/todo.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ with each step.
2727
| [Bug Fixes](todo/bugs.md) | Incorrect behaviour that should be fixed regardless of feature priority |
2828
| [Configuration](todo/config.md) | Per-project `.phpantom.toml` file, PHP version override, diagnostic tool toggles, prompt-and-remember settings |
2929
| [Refactoring](todo/refactor.md) | Technical debt and cleanup tasks. Gate check between sprints: clear all items before starting the next sprint |
30+
| [Indexing](todo/indexing.md) | Self-generated classmap, staleness detection, parallel file processing, full background indexing, disk cache |
3031

3132
---
3233

@@ -37,7 +38,25 @@ diagnostics, unused-import dimming, and implement missing methods.
3738

3839
---
3940

40-
## Sprint 2 — Refactoring & references
41+
## Sprint 2 — Self-generated classmap (0.5.0)
42+
43+
PHPantom currently requires `composer dump-autoload -o` for cross-file
44+
resolution. When the classmap is missing or incomplete, the user gets
45+
no diagnostics, no cross-file completion, and no explanation why. The
46+
self-scan fallback builds a classmap ourselves so everything works out
47+
of the box. This also covers non-Composer projects.
48+
49+
| # | Item | Effort | Domain | Doc Link |
50+
|---|---|---|---|---|
51+
| 80 | Self-generated classmap fallback | Medium-High | Indexing | [indexing.md — Phase 1](todo/indexing.md#phase-1-self-generated-classmap) |
52+
53+
**After Sprint 2:** PHPantom works without any setup beyond opening a
54+
PHP project. The README can drop the `composer dump-autoload -o`
55+
requirement to a performance tip instead of a prerequisite.
56+
57+
---
58+
59+
## Sprint 3 — Refactoring
4160

4261
Extract Function is the remaining refactoring pillar. Inline Variable,
4362
Extract Variable, and Inline Function/Method round out the core
@@ -54,7 +73,7 @@ tracking infrastructure they depend on, and both are now complete.
5473

5574
---
5675

57-
## Sprint 3 — Close the LSP feature gap
76+
## Sprint 4 — Close the LSP feature gap
5877

5978
These items close the most commonly expected LSP feature surface gaps.
6079
Each one removes a reason someone might look elsewhere.
@@ -67,14 +86,15 @@ Each one removes a reason someone might look elsewhere.
6786
| 22 | Selection Ranges (`textDocument/selectionRange`) | Low | LSP Features | [lsp-features.md §13](todo/lsp-features.md#13-selection-ranges-textdocumentselectionrange) |
6887
| 23 | Type Definition (`textDocument/typeDefinition`) | Low | LSP Features | [lsp-features.md §14](todo/lsp-features.md#14-type-definition-textdocumenttypedefinition) |
6988
| 24 | PHPDoc block generation on `/**` | Medium | LSP Features | [lsp-features.md §3](todo/lsp-features.md#3-phpdoc-block-generation-on-) |
89+
| 81 | Work-done progress for GTI and Find References | Low | LSP Features | [lsp-features.md §18](todo/lsp-features.md#18-work-done-progress-for-gti-and-find-references) |
7090

71-
**After Sprint 3:** PHPantom covers every commonly expected LSP feature
91+
**After Sprint 4:** PHPantom covers every commonly expected LSP feature
7292
and surpasses the field on type intelligence, generics, Laravel, and
7393
performance. No feature gaps remain for typical day-to-day editing.
7494

7595
---
7696

77-
## Sprint 4 — Type intelligence depth & polish
97+
## Sprint 5 — Type intelligence depth & polish
7898

7999
Type intelligence depth is PHPantom's defining advantage. This sprint
80100
deepens that lead and rounds out the remaining feature surface.
@@ -96,14 +116,14 @@ deepens that lead and rounds out the remaining feature surface.
96116
| 39 | Simplify with null coalescing / null-safe operator (code action) | Medium | Code Actions | [actions.md §2](todo/actions.md#2-simplify-with-null-coalescing--null-safe-operator) |
97117
| 40 | Inlay hints (`textDocument/inlayHint`) | Medium | LSP Features | [lsp-features.md §9](todo/lsp-features.md#9-inlay-hints-textdocumentinlayhint) |
98118

99-
**After Sprint 5:** PHPantom has a complete, polished LSP feature set.
119+
**After Sprint 6:** PHPantom has a complete, polished LSP feature set.
100120
Users moving to Zed/Neovim/Helix lose nothing on the intelligence side
101121
and gain 1000× faster startup. The remaining gaps are Blade and
102122
formatting (not our domain).
103123

104124
---
105125

106-
## Sprint 5 — Deep type accuracy & Laravel excellence
126+
## Sprint 6 — Deep type accuracy & Laravel excellence
107127

108128
These items push type resolution accuracy beyond what any tool offers.
109129
They're the long tail that makes PHPantom the definitive choice for
@@ -137,7 +157,7 @@ complementary inbound direction.
137157

138158
---
139159

140-
## Sprint 6 — Blade support
160+
## Sprint 7 — Blade support
141161

142162
Blade is a multi-phase project tracked in [todo/blade.md](todo/blade.md).
143163
Shipping Blade support makes PHPantom the first open-source PHP language

0 commit comments

Comments
 (0)