Blade Language Support in VS Code (part 2)

Author by Jakub Misek
4 minutes
Blade Language Support in VS Code (part 2)

In a previous blog post, we introduced the initial Blade editor support for Visual Studio Code. This support brought a seamless integration of PHP editor language features into Blade files. Users could enjoy enhanced productivity with features such as mouse tooltips, PHP code completion, inlay hints, refactorings, code actions, and intuitive navigation within their Blade templates. These features significantly improved the development experience for Laravel applications.

Now, we are excited to announce an expansion of these capabilities! The latest update adds even more powerful features, including improved Blade file formatting, enhanced completion and navigation for Laravel and Livewire components, and extended completions for routes, views, and file paths within Laravel-specific functions.

Components Completion

blade component completion

With this update, the editor performs a comprehensive scan of all .blade.php files within your workspace. It also resolves directories specified for views and view classes in your project configuration. As a result, developers now benefit from intelligent code completion and navigation for Blade components.

For instance, after typing a <x- tag, a <livewire: tag, or within view()-like functions, the editor will provide relevant suggestions and navigation to the corresponding components. This ensures faster development and reduces the likelihood of errors.

component attributes completion

Additionally, component attributes are seamlessly handled. Attributes defined as view class properties, @props directives in views, or parameters of Livewire's mount() method are intelligently suggested and navigable. This enhancement simplifies working with complex components and makes the development process more efficient.

Views Completion

blade view completion

The updated editor also improves suggestions for views using Laravel's kebab-case notation. Inside directives such as @include and similar constructs, as well as within view()-like functions, the editor provides precise suggestions for available views. This feature ensures that developers can quickly find and reference the desired view files, saving valuable time and minimizing errors in large projects.

Named Routes Completion

named route completion

For developers working with Laravel routes, this update brings significant enhancements to named route completions. When routes are defined with the ->name() method, the editor will suggest these named routes in the route() function. This addition streamlines the process of referencing routes, making it easier to build robust and maintainable applications.

See Also

With these updates, the Blade editor for Visual Studio Code becomes an even more indispensable tool for Laravel developers. These enhancements aim to further simplify the coding process, reduce errors, and increase productivity, ensuring a smoother development journey for your Laravel projects.