codingyu / laravel-goto-view

vscode extension
MIT License
45 stars 28 forks source link

Support for anonymous component paths. #68

Open Waghabond opened 1 year ago

Waghabond commented 1 year ago

The extension should look in service providers' boot() methods for Blade::anonymousComponentPath() calls and highlight component tags accordingly

// app/Providers/AppServiceProvider.php
public function boot()
{
    Blade::anonymousComponentPath(resource_path('views/layouts'), 'layouts');
}
{{-- resources/views/layouts/app.blade.php --}}
<html>
    <head></head>
    <body>{{ $slot }}</body>
</html>

The following should now be clickable:

{{-- resources/views/home.blade.php --}}
<x-layouts::app>
    {{-- content --}}
</x-layouts::app>
codingyu commented 1 year ago

This may require some configuration, because this extension does not run php to find the view path.

Waghabond commented 1 year ago

A setting that can map anonymous component paths in the extension's configuration would be perfectly sufficient! (at least for my use case. If it could happen "automagically" that would of course be even better)