Skip to content

L37 — Request input key completion from validation rules - #292

Merged
AJenbo merged 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/request-input-key-completion-from-validation-rules
Jul 28, 2026
Merged

L37 — Request input key completion from validation rules#292
AJenbo merged 7 commits into
PHPantom-dev:mainfrom
shuvroroy:feat/request-input-key-completion-from-validation-rules

Conversation

@shuvroroy

Copy link
Copy Markdown
Contributor

Inside $request->input('…') and its siblings, the acceptable field names are the keys of the rules array that validates the request. PHPantom now reads that array — from a FormRequest's rules() or a validate() / Validator::make() call earlier in the same method — and offers those keys as completion, with go-to-definition to the rule that declares them.

Two commits: a preparatory refactor that shares the open-quote scan between string detectors, then the feature. See the commit messages for the details.

Worth a reviewer's attention:

  • Dispatch order. Request-key completion runs after the Eloquent strategies, because has() is both a request accessor and a relation method. A builder subject resolves as a relation first; only a request-typed subject falls through.
  • Module placement. Rules extraction lives in virtual_members/laravel/validation_rules.rs, separate from the completion surface, so L38 (typed validated() array shapes) can reuse it. L38's backlog entry now points at it.
  • StringCallContext gained a call_open_paren field. It ships with the feature rather than the refactor commit because an unused pub(crate) field trips dead_code and would fail clippy -D warnings on its own.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, examples/)
  • I have updated the config schema (config-schema.json) — no new config options
  • I have added/updated tests to cover my changes

@codecov-commenter

codecov-commenter commented Jul 27, 2026

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 93.03079% with 43 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/virtual_members/laravel/validation_rules.rs 88.92% 39 Missing ⚠️
src/virtual_members/laravel/request_fields.rs 98.93% 2 Missing ⚠️
src/completion/laravel_request_keys.rs 97.22% 1 Missing ⚠️
src/completion/source/helpers.rs 96.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@shuvroroy

Copy link
Copy Markdown
Contributor Author

@AJenbo I think test are failing because of some permission issue. Can you please confirm that?

@AJenbo

AJenbo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

The benchmark fails for outsiders, hvaen't fully investigated if there is a solution, but it's not important for now.

@AJenbo
AJenbo force-pushed the feat/request-input-key-completion-from-validation-rules branch from f754470 to e8689d4 Compare July 28, 2026 17:05
@AJenbo
AJenbo merged commit 55dde0b into PHPantom-dev:main Jul 28, 2026
6 of 7 checks passed
@AJenbo

AJenbo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Thanks for working on this

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.

3 participants