Skip to content

fix(diagnostics): update after function signature change and on save#196

Open
calebdw wants to merge 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-uqvsqztpwypy
Open

fix(diagnostics): update after function signature change and on save#196
calebdw wants to merge 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-uqvsqztpwypy

Conversation

@calebdw

@calebdw calebdw commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Root cause: update_ast only tracked class signature changes. When a standalone function's parameter type changed (e.g. bar(null $x) to bar(string $x)), update_ast returned false, so
schedule_diagnostics_for_open_files was never called and other open files kept showing stale diagnostics.

Changes:

  • Add FunctionInfo::signature_eq() for comparing function signatures
  • Track function signature changes in update_ast: snapshot old functions before re-parse, compare signatures, clean up stale entries, and return true when any function signature changed
  • Add did_save handler as a reliable diagnostic refresh point (critical for Neovim which relies on save events)
  • Register save notification capability in TextDocumentSyncOptions
  • Add 23 tests covering signature_eq and update_ast change detection

Closes #123

cc: @Disservin, @DarkGhostHunter if you want to test this out

Root cause: update_ast only tracked class signature changes. When a
standalone function's parameter type changed (e.g. bar(null $x) to
bar(string $x)), update_ast returned false, so
schedule_diagnostics_for_open_files was never called and other open
files kept showing stale diagnostics.

Changes:
- Add FunctionInfo::signature_eq() for comparing function signatures
- Track function signature changes in update_ast: snapshot old
  functions before re-parse, compare signatures, clean up stale
  entries, and return true when any function signature changed
- Add did_save handler as a reliable diagnostic refresh point
  (critical for Neovim which relies on save events)
- Register save notification capability in TextDocumentSyncOptions
- Add 23 tests covering signature_eq and update_ast change detection

Closes PHPantom-dev#123
@calebdw calebdw force-pushed the calebdw/push-uqvsqztpwypy branch from 42f2bf0 to 4b6003e Compare July 5, 2026 01:43
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diagnostics don't update

2 participants