Skip to content

feat: add declaration count hints and prototype navigation#283

Merged
calebdw merged 2 commits into
mainfrom
calebdw/push-utrswpmvunmu
Jul 25, 2026
Merged

feat: add declaration count hints and prototype navigation#283
calebdw merged 2 commits into
mainfrom
calebdw/push-utrswpmvunmu

Conversation

@calebdw

@calebdw calebdw commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This adds reference count inlay hints for PHP declarations so unused and widely-used symbols are visible directly in the editor without turning them into fake clickable code lenses.

The new hints cover classes, interfaces, traits, enums, methods, properties, and constants. Interfaces and abstract classes also include implementation counts. Counts are shown only after the workspace index is ready, so editors do not briefly display misleading zero-reference annotations during startup.

Code lenses remain for real navigation only. Override annotations now execute a PHPantom command that uses the standard LSP window/showDocument request, which makes them work in Neovim, Cursor, VSCodium, and other clients instead of relying on VS Code-specific commands.

The PR also improves declaration-site go-to-definition for overrides: methods, properties, constants, and child classes now jump to the nearest parent, trait, or interface prototype where PHPantom can resolve one.

Closes #140
Closes #236

@calebdw calebdw changed the title feat: add reference count inlay hints feat: add declaration count hints and prototype navigation Jul 25, 2026
calebdw added 2 commits July 24, 2026 20:50
When the cursor is on a method definition that overrides a parent or
implements an interface method, go-to-definition now navigates to the
prototype declaration. Previously it returned call-site references
(find_references), which sent the user to a seemingly random usage.

Similarly, go-to-definition on a class declaration name now jumps to
the parent class when one exists, instead of returning usages.

The reverse-implementation lookup (already used by
textDocument/implementation) is now reused by the definition handler
for MemberDeclaration symbols. Methods and classes that do not
override anything still fall through to the usages behavior.

Closes #236
Show reference counts for classes, enums, interfaces, traits, methods,
properties, and constants as inlay hints instead of non-actionable code
lenses. Interface and abstract class declarations also show implementation
counts. Code lenses remain reserved for actionable prototype navigation.

The hints omit private members, magic methods, and overridden members to
avoid noisy or misleading counts, while still showing zero-reference hints
so users can distinguish unused symbols from missing data.

Go-to-definition on overridden declarations now follows methods,
properties, and constants to the nearest parent, trait, or interface
prototype where applicable.

Use a single all-targets Clippy invocation in CI and let agent docs prefer
clippy --fix so automated changes apply safe lint suggestions before
formatting.

Closes #140
@calebdw
calebdw force-pushed the calebdw/push-utrswpmvunmu branch from ee62278 to 37969c0 Compare July 25, 2026 01:51
@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

❌ Patch coverage is 51.16697% with 272 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/inlay_hints.rs 47.36% 160 Missing ⚠️
src/definition/resolve.rs 49.32% 112 Missing ⚠️

📢 Thoughts on this report? Let us know!

@calebdw
calebdw merged commit 1928849 into main Jul 25, 2026
6 of 7 checks passed
@calebdw
calebdw deleted the calebdw/push-utrswpmvunmu branch July 25, 2026 02:00
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.

Error when clicking CodeLens in Cursor Support for references/implementations via code lens

2 participants