Add Laravel named-resource and storage-disk intelligence - #368
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
12k lines is a lot for a single PR, it's also tackling several things at once, macOS specific path alias, how Laravel strings are handled in general, storage names, and existing string handeling. This makes it really hard for me to evaluate and understand what's happening. |
Yeah agree. I am thinking to use stacked pull requests feature for this PR. Already asked AI to do this for me. Will ping you once it's ready. |
|
Looks like GitHub’s native stacked PR feature requires every branch to be in the same repository; cross-fork stacks are explicitly unsupported 😅 |
|
You can just open multiple PRs, set them to draft and add a comment in the description Then I can rebase once the next is ready. |
|
The split is ready. I replaced this oversized draft with focused dependent PRs:
#371 and #372 are drafts so each branch can be rebased as the layer below it lands. Their descriptions call out the exact scope, verification, coverage, and deferred follow-up work. I’m closing #368 as superseded so review can continue on the smaller PRs. Thanks for the direction. |
Summary
Laravel frequently addresses configured services through strings, but those strings previously had uneven editor support. Some contexts only completed generic config keys, while others had no completion, navigation, references, hover, or validation.
This PR makes Laravel’s named resources first-class indexed symbols across the language server.
What changed
Storage disks
Storage disk names now receive full editor support in:
Storage::disk()Storage::fake()Storage::persistentFake()Storage::forgetDisk()Storage::forgetDisk()#[Storage]contextual attributeNames complete from
filesystems.disks.*, navigate to their exact config declaration, provide family-specific hover information, and participate in find-references.The implementation follows Laravel’s runtime semantics:
disk()requires a configured disk and diagnoses unknown names.fake()andpersistentFake()may introduce ad-hoc test disks, so they do not produce false unknown-disk diagnostics.forgetDisk()accepts optional scalar or array names.Config-backed named resources
The same support now covers eight resource families:
auth.guards.*cache.stores.*logging.channels.*filesystems.disks.*database.connections.*queue.connections.*mail.mailers.*broadcasting.connections.*Supported contexts include:
auth('admin')Auth::guard(),Cache::store(),DB::connection(), andMail::mailer()Log::stack(['daily', 'stderr'])auth:*andthrottle:*middleware parametersconnection()receiversonConnection()andonQueue()calls$connectionproperties, including promoted propertiesSource-defined names
This PR also indexes names that do not come from configuration:
RateLimiter::for()onQueue()callsRate limiter names complete, navigate to their registration, and are validated in middleware and
RateLimitedconstructors.Queue names remain deliberately open-ended. Known literals are offered as completion candidates and references, but unseen names are not diagnosed because Laravel does not require queues to be declared centrally.
Editor behavior
Every supported resource family now provides:
For example, references to
Cache::store('memory')are linked with direct access toconfig('cache.stores.memory').Correctness
Resource extraction resolves semantic names instead of matching raw text. This supports facade aliases and fully qualified names while rejecting unrelated classes that happen to use names such as
Cache,Route, orDB.Named arguments, reordered arguments, modern and legacy arrays, nullable receivers, union types, inherited queue traits, and indirect model inheritance are covered.
Config and source indexes remain correct across:
Config::set()registrationsPerformance and refactoring
The implementation was designed to keep completion and diagnostics hot paths inexpensive:
Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,examples/)config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.
🤖 Generated with OpenAI Codex (5.6 Sol)