feat: Laravel string key completion, hover, and diagnostics#231
feat: Laravel string key completion, hover, and diagnostics#231calebdw wants to merge 2 commits into
Conversation
9bdf8d3 to
8701e88
Compare
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
8701e88 to
ce5e6cc
Compare
|
Fixed — trans diagnostics now skip entirely when no
Added in 268bce6. Both completion and diagnostics now scan
If there are no file-based translation files at all (PHP or JSON), trans diagnostics are skipped entirely (see point 1). If you have some file-based translations alongside a DB provider, keys only in the DB will be flagged. To handle that case, the diagnostic code is now
Keeping the warning — a default value is a safety net, not an indication the key is intentionally wrong. A typo like Also split the single
|
268bce6 to
017a134
Compare
Add autocompletion, hover, and invalid-key diagnostics for route names,
config keys, view names, and translation keys.
Completion:
- route('|') / to_route('|') -> route names from routes/*.php
- config('|') / Config::get('|') -> config keys from config/*.php
- view('|') / View::make('|') -> view templates from resources/views/
- __('|') / trans('|') / Lang::get('|') -> translation keys from lang/
- Route::resource() / apiResource() with ->only() / ->except()
- Route::group([], __DIR__ . '/sub.php') file includes with prefix
- Container attributes (#[Config], #[Database], #[Cache], #[Log],
#[Storage], #[Auth]) with FQN-verified imports
- Facade methods (Auth::guard(), DB::connection(), Cache::store(),
Log::channel(), Storage::disk()) and auth() helper
- TextEdit-based so dots don't break the completion popup
Hover:
- Shows key kind (Route/Config/View/Trans), the key value, and
the file where it's defined
Diagnostics:
- Warns on unknown route names, config keys, view names, and
translation keys (e.g. Unknown route: 'dashbaord')
- Only flags plain string literals, not dynamic/interpolated keys
Also adds to_route() to extraction spans for go-to-def/references.
…afety
- Add lang/en.json support for completion, diagnostics, and go-to-definition
(Laravel JSON translations are flat {"key": "value"} objects)
- Skip trans diagnostics when no lang files exist, avoiding false positives
in WordPress/GetText projects that also use __() / trans()
- Split diagnostic code into per-kind codes (invalid_laravel_route,
invalid_laravel_config, invalid_laravel_view, invalid_laravel_trans)
so users can selectively disable categories via config
017a134 to
99e375e
Compare
Add autocompletion, hover, and invalid-key diagnostics for route names, config keys, view names, and translation keys.
Completion
route('|')/to_route('|')→ route names fromroutes/*.phpconfig('|')/Config::get('|')→ config keys fromconfig/*.phpview('|')/View::make('|')→ view templates fromresources/views/__('|')/trans('|')/Lang::get('|')→ translation keys fromlang/Route::resource()/apiResource()with->only()/->except()Route::group([], __DIR__ . '/sub.php')file includes with prefix propagation#[Config],#[Database],#[Cache],#[Log],#[Storage],#[Auth]) with FQN-verified importsAuth::guard(),DB::connection(),Cache::store(),Log::channel(),Storage::disk()) andauth()helperHover
Diagnostics
Unknown route: 'dashbaord')Also
to_route()added to extraction spans for go-to-def and find-referencesRoute::group([], __DIR__ . '/sub.php')file includes with prefix propagationRoute::resource()/apiResource()routes