codingyu / laravel-goto-view

vscode extension
MIT License
45 stars 28 forks source link

Does not work for `@includeWhen` #57

Closed ianjamieson closed 2 years ago

ianjamieson commented 2 years ago

Out of the box, the regex does not work for @includeWhen directives.

Original regex:

(?<=view\(['"]|View::make\(['"]|@include\(['"]|@extends\(['"]|@component\(['"]|Inertia::render\(['"]|\<)(\<x-|\<livewire:|[^'" \/>]+)
ianjamieson commented 2 years ago

To fix, update the laravel_goto_view.regex setting to:

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

Notice the addition of includeWhen

theChaosCoder commented 1 year ago

@includeWhen\([^'"]*['"] would only catch this @includeWhen(true, 'test') but not this @includeWhen(myfunction('abc'), 'test')