Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Code Jump to Blade View with @includeWhen Directive in Laravel #75

Open
shiruten opened this issue Nov 29, 2024 · 0 comments · May be fixed by wilsenhc/laravel-goto-view#1
Open

Comments

@shiruten
Copy link

shiruten commented Nov 29, 2024

In my Blade template, I define an include with @includeWhen()

@includeWhen($condition, 'components.sidebar')

When I attempt to Cmd+Click on "components.sidebar", it does not jump to the corresponding Blade view file. Instead, it only positions the cursor within the current file.

Temporary Fix for Laravel View Navigation with Updated Regex Pattern

I found a workaround by modifying the laravel_goto_view.regex value to the following:

(?<=view\(['"]|markdown\(['"]|assertViewIs\(['"]|\(view:.['"]|View::make\(['"]|@include.*\(.*['"]|@extends\(['"]|@component\(['"]|Inertia::(?:render|modal)\(['"]|\(component:.['"]|<)(?:x-|livewire:|[^'"\s/>]+(?:\/[^'"\s/>]+)*)

This modification allows view navigation to work with various directives, including @includeWhen() and other complex view inclusion methods. While this serves as a temporary fix, I would greatly appreciate if this could be implemented as the default behavior in the extension.

Would it be possible to make this the default regex pattern for view navigation in the Laravel extension?

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 a pull request may close this issue.

1 participant