|
19 | 19 | ├── lib.rs # Backend struct, state, constructors |
20 | 20 | ├── main.rs # Entry point (stdin/stdout LSP transport) |
21 | 21 | ├── server.rs # LSP protocol handlers (initialize, didOpen, completion, …) |
22 | | -├── types.rs # Data structures (ClassInfo, MethodInfo, PropertyInfo, …) |
| 22 | +├── types.rs # Data structures (ClassInfo, MethodInfo, SubjectExpr, ResolvedCallableTarget, …) |
23 | 23 | ├── composer.rs # composer.json / PSR-4 autoload parsing |
24 | 24 | ├── stubs.rs # Embedded phpstorm-stubs (build-time generated index) |
25 | 25 | ├── resolution.rs # Multi-phase class/function lookup and name resolution |
|
48 | 48 | │ ├── mod.rs # Submodule declarations |
49 | 49 | │ ├── handler.rs # Top-level completion request orchestration |
50 | 50 | │ ├── target.rs # Extract what the user is completing (subject + access kind) |
51 | | -│ ├── resolver.rs # Resolve subject → ClassInfo (type resolution engine) |
52 | | -│ ├── text_resolution.rs # Text-based type resolution (assignment scanning, call chains) |
| 51 | +│ ├── resolver.rs # Resolve subject → ClassInfo (type resolution engine), shared resolve_callable_target |
| 52 | +│ ├── source_helpers.rs # Source-text scanning helpers (closure/callable return types, new-expression parsing, array access) |
53 | 53 | │ ├── builder.rs # Build LSP CompletionItems from resolved ClassInfo |
54 | 54 | │ ├── class_completion.rs # Class name, constant, and function completions |
55 | 55 | │ ├── variable_completion.rs # Variable name completions and scope collection |
@@ -129,21 +129,19 @@ A value of `0` means "not available" (stubs parsed before offsets were stored, s |
129 | 129 |
|
130 | 130 | ### Tier 3: Text-Based Fallback (deprecated) |
131 | 131 |
|
132 | | -The original line-by-line text scanners (`extract_word_at_position`, `find_member_position_in_range` text search, `line_defines_variable`, `find_definition_position`, `find_function_position`) are retained as fallbacks for: |
| 132 | +The remaining line-by-line text scanners (`extract_word_at_position`, `find_member_position_in_range` text search, `find_definition_position`, `find_function_position`) are retained as fallbacks for: |
133 | 133 |
|
134 | | -- Stubs and synthetic members where `name_offset == 0` |
| 134 | +- Stubs and synthetic members where `name_offset == 0` or `keyword_offset == 0` |
135 | 135 | - Files where the parser panicked (malformed PHP) and no symbol map exists |
136 | | -- The go-to-implementation subsystem (not yet migrated to the symbol map) |
137 | 136 |
|
138 | | -These functions are marked `#[deprecated]` with phase notes. They will be removed once the AST-based paths have been stable for a release cycle. |
| 137 | +These functions are marked `#[deprecated]` with phase notes. They will be removed once stubs and synthetic members store valid byte offsets during parsing. |
139 | 138 |
|
140 | 139 | ### Variable Definition Resolution |
141 | 140 |
|
142 | | -Variable go-to-definition (`$var` → jump to definition) uses three layers: |
| 141 | +Variable go-to-definition (`$var` → jump to definition) uses two layers: |
143 | 142 |
|
144 | 143 | 1. **Symbol map** (`var_defs`): the primary path. Finds the most recent `VarDefSite` before the cursor within the enclosing scope. When the cursor is physically on a definition token (parameter, foreach binding, catch variable), it returns `None` so the caller can fall through to type-hint resolution. |
145 | | -2. **AST-based search** (`resolve_variable_definition_ast`): parses the file and walks the enclosing scope to find the definition site. Handles destructuring (`[$a, $b] = ...`, `list($a, $b) = ...`) and nested scopes correctly. Used as a fallback when the symbol map doesn't have a match. |
146 | | -3. **Text-based search** (`resolve_variable_definition_text`): the original heuristic line scanner. Only activated when the AST parse fails. |
| 144 | +2. **AST-based search** (`resolve_variable_definition_ast`): parses the file and walks the enclosing scope to find the definition site. Handles destructuring (`[$a, $b] = ...`, `list($a, $b) = ...`) and nested scopes correctly. Used as a fallback when the symbol map doesn't have a match. Returns `None` when the AST parse fails. |
147 | 145 |
|
148 | 146 | ## Signature Help Architecture |
149 | 147 |
|
|
0 commit comments