Skip to content

Conversation

@mikebronner
Copy link
Contributor

@mikebronner mikebronner commented Dec 28, 2025

Laravel Extension

Hey Zed team! 👋

This PR adds Laravel support to Zed—something the Laravel community has been eager for as more developers discover Zed.

What it does

The extension provides go-to-definition and diagnostics for Laravel's conventions. Click on a view name, Blade component, route, config key, or translation—and jump straight to the file. Get inline warnings when something's missing or misconfigured.

Essentially, it makes Zed understand Laravel projects the way Laravel developers think about them.

Why it matters

Laravel is the most widely-used PHP framework, powering millions of applications. PHP developers evaluating Zed often ask "does it support Laravel?" before making the switch. This extension removes that barrier.

Many Laravel developers are currently tied to VS Code or PhpStorm specifically because of Laravel tooling. Giving them a native Zed option opens the door for a large, enthusiastic community to join the Zed ecosystem.

About the extension

  • Written in Rust with a custom LSP
  • Uses tree-sitter for fast, accurate parsing
  • Zero configuration—auto-discovers project structure
  • Cross-platform binaries included for all supported architectures

Links

Happy to address any feedback. Thanks for considering!

  Laravel development support for Zed with go-to-definition for views,
  Blade components, Livewire, routes, config, translations, and more.
  Includes real-time diagnostics for missing files and undefined references.
@cla-bot cla-bot bot added the cla-signed label Dec 28, 2025
@mikebronner mikebronner force-pushed the add-laravel-extension branch from 24c6282 to f61df4a Compare December 29, 2025 14:27
@mikebronner mikebronner force-pushed the add-laravel-extension branch from a7b6854 to b34f50b Compare January 2, 2026 21:59
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

A few questions:

  • Could you elaborate how this differs for the highlighting part from https://github.com/bajrangCoder/zed-laravel-blade? It seems that this already adds support for both highlighting as well as some LSPs.
  • Could you please remove the custom logic for the dev extension install? Would be best to verify that this works without the workaronds. You can already test a local langauge server by just adding lsp.your-lsp-name.binary.path to your settings.
  • Could you please remove the code within the extension source code that is effectively unused (because it is only used in tests)? I'd prefer for the extension to just contain the code that will actually run on users machinses, as this makes auditing easier for both us as well as users looking at the code.

Thanks!

@mikebronner
Copy link
Contributor Author

Hi @MrSubidubi

I actually started by integrating zed-laravel-blade, but it fell short in several areas in how it parsed Blade directives, syntax highlighting in edge cases, as well missing autocompletion entirely. As I worked around the limitations it became clear that it was easier to develop my own solution than trying to patch the other whenever I encountered problems trying to integrate it.

  • Could you please remove the custom logic for the dev extension install? Would be best to verify that this works without the workaronds. You can already test a local langauge server by just adding lsp.your-lsp-name.binary.path to your settings.

Will do!

  • Could you please remove the code within the extension source code that is effectively unused (because it is only used in tests)? I'd prefer for the extension to just contain the code that will actually run on users machinses, as this makes auditing easier for both us as well as users looking at the code.

You're referring to the test-project folder, etc? I think I should be able to exclude these during build. Will do!

Thanks :)

@mikebronner
Copy link
Contributor Author

mikebronner commented Jan 7, 2026

Blade Directive Resolution Comparison

zed-laravel-blade (bajrangCoder)

  • Only provides tree-sitter grammars for basic syntax highlighting
  • Delegates all language intelligence to generic PHP LSPs (Intelephense, Phpactor, etc.)
  • These PHP LSPs do not understand Blade directives - they treat @if, @foreach, etc. as plain text
  • does not parse blade directives within HTML attributes
  • I don't believe they treat blade directive parameters as native PHP

zed-laravel (this extension)

Dynamic directive discovery via three-stage system in laravel-lsp/src/main.rs:

Function Purpose
scan_laravel_blade_directives() Scans vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/.php for compile methods
scan_custom_blade_directives() Finds Blade::directive('name', ...) calls in app/Providers/ and common packages
get_all_blade_directives() Combines both sources, deduplicates, sorts

Key features:

  • Extracts directives from Laravel's actual source code (not hardcoded)
  • Detects closing tags (@if@endif) by finding compileEnd* methods
  • Detects if directives have parameters
  • Generates descriptions based on source trait (CompilesConditionals → "Conditional directive")
  • Discovers custom directives from:
    • app/Providers/*.php - app service providers
    • vendor/livewire/livewire - Livewire directives
    • vendor/laravel/pennant - Pennant directives
    • vendor/spatie/* - Spatie package directives
  • Falls back to hardcoded core directives if Laravel framework isn't found

Summary Table

Capability zed-laravel-blade zed-laravel
Blade syntax highlighting
Directive autocomplete ❌ (generic PHP only) ✅ Dynamic
Custom directive discovery
Directive closing tags ✅ Auto-detected
Laravel-specific intelligence ✅ Full LSP

@mikebronner mikebronner requested a review from MrSubidubi January 7, 2026 17:58
@mikebronner
Copy link
Contributor Author

@MrSubidubi could you take another look? I believe I addressed your concerns. Please let me know if there is anything else I can do. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants