You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
### Simplification (`chore: Simplify extension`)
- **`providers.ts`**: Extracted `delegateLocationProvider()` helper
shared by `PHPXDefinitionProvider`, `PHPXTypeDefinitionProvider`, and
`PHPXImplementationProvider` — eliminated ~60 lines of triplicated
boilerplate. Simplified `mapLocationLinkToSource` using a single
`remapUri` variable instead of three mutable lets. Removed dead
`PHPXWorkspaceSymbolProvider` class (exported but never registered in
`extension.ts`).
- **`compiler.ts`**: Moved `stderrOverflow` declaration above its
handler (was declared one line after use). Added `stderrOverflow` to the
`close` handler's overflow branch — previously only `truncated` was
checked, leaving stderr-overflow kills to fall through to `code !== 0`
and attempt `JSON.parse` on a truncated buffer. Removed dead
`compilationErrors` map and `getCompilationError()` method (written but
never read externally). Fixed `err.message || err.stack` order in
`compileAndWrite` catch — stack now used for logging, message for
user-facing error.
- **`diagnostics.ts`**: Removed `shouldForwardDiagnostic()` stub (always
returned `true`) and its no-op `.filter()` call site.
- **`positionMapper.ts`**: Removed `/g` flag from module-level
`PHP_WORD_PATTERN` — `document.getWordRangeAtPosition()` throws if
passed a global regex (this was silently swallowing the error in all
three location providers). Fixed double-`statSync` on cache miss: stat
first, then read.
- **`languageClient.ts`**: Removed redundant `?? undefined` from
optional-chain expression.
- **`extension.ts`**: Deduplicated the three identical vendorWatcher
event handlers into a shared `clearCompilerCache` callback.
### Bug fix (`fix(positionMapper): use fresh regex in getWordAt for
matchAll compatibility`)
- `getWordAt` uses `String.matchAll()` which requires a global regex,
but `PHP_WORD_PATTERN` no longer has `/g`. Fixed by creating a fresh
`new RegExp(PHP_WORD_PATTERN.source, 'g')` at the call site — consistent
with the pattern already used in `getNthOccurrence` and
`findNthOccurrence`.
### Tests (`test(extension): fix false positives and strengthen
assertions`)
- **`extension.test.ts`**: Replaced circular `languageId` test (was
forcibly setting `language: 'phpx'` then asserting `languageId ===
'phpx'`) with a real auto-detection test that opens a temp `.phpx` file
by URI.
- **`grammar.test.ts`**: Removed `runGrammarTests()` — it looped over 12
test cases with `expectedScopes` arrays that were never read; every case
unconditionally incremented `passed`. Actual tokenization is covered by
`pnpm test:grammar` via `vscode-tmgrammar-test`. Strengthened
`validateGrammarStructure` to assert non-empty `patterns` and
`repository`.
- **`range-remap.test.ts`**: Fixed `executeCommand` mocks to capture and
assert the forwarded PHP URI and PHPX→PHP mapped column — the forward
position mapping was previously completely untested. Added end-position
assertions to all four tests (only start was previously checked). Added
`phpxTitleStart !== phpTitleStart` guard to guarantee the fixture
requires non-trivial column remapping.
## Test plan
- [x] TypeScript compilation passes (`pnpm compile` — no errors)
- [x] All 8 integration tests pass (`pnpm test`)
- [x] Grammar tests pass (`pnpm test:grammar`)
- [ ] Go-to-definition, type definition, and find implementation work in
`.phpx` files
- [ ] stderr overflow during compilation produces "Compilation output
exceeded size limit" instead of a JSON parse error
- [ ] No regression in diagnostics forwarding from PHP language server
to `.phpx` files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
0 commit comments