feat(laravel): support custom Eloquent builders and improve LSP responsiveness#118
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 86.71% 86.80% +0.09%
==========================================
Files 170 170
Lines 108396 108888 +492
==========================================
+ Hits 93996 94524 +528
+ Misses 14400 14364 -36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Implement support for #[UseEloquentBuilder] and HasBuilder trait. - Support inherited custom builder attributes by walking the Model parent chain. - Fix Go-to-Definition and Completion for forwarded methods on inherited custom builders. - Fix 'Find References' for forwarded builder methods by bridging Model/Builder hierarchies. - Improve reference accuracy by scoping hierarchy 'walk-down' to classes defining the member. - Relax is_static check for Laravel-related member references. - Optimize LSP responsiveness with background parsing and completion caching. - Add comprehensive integration tests for Laravel custom builder resolution and references.
- Fix formatting across multiple files using 'cargo fmt'. - Collapse nested 'if let' statements into single chains with 'and_then' or 'let_chains'. - Remove redundant closures. - Fix unused variable warning in 'src/references/mod.rs'.
24045c8 to
8a49775
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces comprehensive support for Laravel custom Eloquent builders (#[UseEloquentBuilder], HasBuilder trait) and significantly enhances LSP
responsiveness through background processing and intelligent completion caching. Editor users will now see accurate type information and completion for
forwarded builder methods, even when using complex inheritance patterns in their models.
Changes
attribute or HasBuilder trait.
during heavy typing.
typing a member name.
in Eloquent projects.
accuracy of project-wide reference searches.
How It Works (Laravel Custom Builders)
ClassInfo.
custom builder and injects its instance methods as static "forwarded" methods on the Model.
method, the engine automatically includes the associated Builder in its search scope (and vice versa), ensuring that calls like User::active() resolve
correctly to UserBuilder::active().
Why Core Library Was Modified
relationship between a Laravel Model and its Builder is a framework-specific inheritance pattern that isn't captured by standard PHP class hierarchies.
concurrent interactive requests.
Tests
attributes and model-generic substitution.
associated Model.