Skip to content

feat(completion): complete morph aliases in array arguments - #496

Open
shuvroroy wants to merge 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-morph-alias-array-completion
Open

shuvroroy wants to merge 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-morph-alias-array-completion

Conversation

@shuvroroy

Copy link
Copy Markdown
Contributor

Registered morph aliases now complete in morph-map array keys and the types passed to polymorphic relationship queries such as whereHasMorph(). Config keys also complete in array writes.

The shared lexical scan identifies the argument and array position, including named arguments and unfinished source. Tests cover short and long arrays, prefix edits, comments, and positions that must not receive these suggestions. Laravel playground examples and runtime assertions demonstrate the feature.

Validation

Validated with Rust 1.99:

  • cargo +1.99 test — full suite passed.
  • cargo +1.99 clippy --fix --allow-dirty -- -D warnings
  • cargo +1.99 clippy --all-targets -- -D warnings
  • cargo +1.99 fmt and cargo +1.99 fmt --check
  • PHP playground syntax checks and runtime assertions passed.
  • Laravel demo syntax check and all 288 runtime assertions passed.
  • Laravel project analysis reported exactly the three intentional demo errors.

Checklist

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, examples/)
  • I have updated the config schema (config-schema.json) — not applicable
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does, how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with 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.

@codecov-commenter

codecov-commenter commented Oct 12, 2026 •

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!

Offer registered aliases in morph-map keys and polymorphic query type
arrays, including named arguments and long array syntax. Also complete
config keys in array writes.

Reuse the shared lexical scan to distinguish keys, values and argument
positions without scanning the file again. Exclude arrow-function bodies
and unrelated parameters while preserving existing resource completion.

Add unit regressions for unfinished arrays, comments, Unicode identifiers
and existing string contexts.
Exercise morph-map keys and all polymorphic query methods through the
completion handler, including named arguments and imported aliases.
Verify prefix filtering, text edits and rejection of unrelated positions.

Cover config writes with both array syntaxes and ensure config values and
later arguments do not receive key suggestions.
Add playground examples for morph-map keys, polymorphic query types and
config array keys. Verify map registration and query alias behavior with
Laravel runtime assertions.

Describe the feature in the changelog and remove the completed backlog
entry from both todo documents.
@shuvroroy
shuvroroy force-pushed the feat/laravel-morph-alias-array-completion branch from 2bc09a6 to 894d76a Compare October 12, 2026 04:37
@shuvroroy
shuvroroy marked this pull request as ready for review October 12, 2026 04:40

This branch has not been deployed

No deployments
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.

2 participants