Skip to content

feat(laravel): go-to-definition and find-references for config keys and env variables#93

Merged
AJenbo merged 7 commits intoAJenbo:mainfrom
MingJen:pr/laravel-nav-foundation
Apr 27, 2026
Merged

feat(laravel): go-to-definition and find-references for config keys and env variables#93
AJenbo merged 7 commits intoAJenbo:mainfrom
MingJen:pr/laravel-nav-foundation

Conversation

@MingJen
Copy link
Copy Markdown
Contributor

@MingJen MingJen commented Apr 26, 2026

Summary

  • Config key navigation: Ctrl-clicking config('app.name'),
    Config::get('app.name'), or Config::set('app.name') now jumps to
    the matching key declaration in config/app.php. Nested paths (e.g.
    config('api.keys.secret')) resolve into subdirectory config files.
  • Find References on config keys: from any usage site or declaration,
    "Find All References" lists every call site across the project plus the
    declaration in config/*.php. Uses pre-built SymbolKind::LaravelStringKey
    spans — no per-file re-parse.
  • Env variable navigation: Ctrl-clicking env('APP_KEY') jumps to the
    corresponding line in .env.
  • Generic PHP AST walker: extracts walk_all_php_expressions and
    extract_string_literal into laravel/helpers.rs to avoid boilerplate
    duplication in future Laravel-specific navigations.

How it works

Config key usages (config(), Config::get, Config::set) are indexed as
SymbolKind::LaravelStringKey during workspace scan. Cross-file reference
search iterates these pre-built spans identically to the existing
find_member_references pattern — O(symbols), not O(files × parse-cost).

Declaration lookup parses only the target config/*.php file on demand;
that file set is small (typically < 20) and each parse is cheap.

Env variable resolution is single-file only: it parses the current file to
locate the cursor's env('KEY') call, then does a text search in .env.

Test plan

  • cargo test — 395 passed
  • cargo clippy — clean
  • cargo fmt --check — clean
  • php -l example.php / assertions — pass
  • Integration tests: 7 new test cases covering config usage→declaration,
    nested keys, find-references from usage and declaration sites
  • integration test for env() go-to-definition

@AJenbo
Copy link
Copy Markdown
Owner

AJenbo commented Apr 27, 2026

Nice addition I clean up some minor things and added triggers for Config::string, Config::boolean etc.

@AJenbo AJenbo enabled auto-merge (squash) April 27, 2026 12:34
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.46473% with 228 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.32%. Comparing base (4724051) to head (1d7c9b0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/virtual_members/laravel/helpers.rs 24.78% 179 Missing ⚠️
src/virtual_members/laravel/config_keys.rs 86.90% 36 Missing ⚠️
src/symbol_map/extraction.rs 95.08% 3 Missing ⚠️
src/definition/resolve.rs 83.33% 2 Missing ⚠️
src/virtual_members/laravel/env_vars.rs 97.53% 2 Missing ⚠️
src/highlight/mod.rs 0.00% 1 Missing ⚠️
src/hover/mod.rs 0.00% 1 Missing ⚠️
src/references/mod.rs 93.75% 1 Missing ⚠️
src/rename/mod.rs 0.00% 1 Missing ⚠️
src/semantic_tokens.rs 0.00% 1 Missing ⚠️
... and 1 more

❌ Your patch status has failed because the patch coverage (68.46%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
- Coverage   86.42%   86.32%   -0.10%     
==========================================
  Files         162      164       +2     
  Lines      102869   103617     +748     
==========================================
+ Hits        88901    89445     +544     
- Misses      13968    14172     +204     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AJenbo AJenbo disabled auto-merge April 27, 2026 13:00
@AJenbo AJenbo merged commit bc2c573 into AJenbo:main Apr 27, 2026
7 checks passed
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