Skip to content

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

Description

@shiruten

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions