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

No Autocomplete Suggestions for Variables in blade.php files #50

Open
AlexJames-Dev opened this issue May 31, 2021 · 4 comments
Open

No Autocomplete Suggestions for Variables in blade.php files #50

AlexJames-Dev opened this issue May 31, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@AlexJames-Dev
Copy link

Hello,

I'm not sure if this is a bug or this is not a feature of this extension, but in my blade files, when I write a variable that I have used before in the blade file, I do not get auto suggest completion for the variable. For example:

@foreach($bookings as $booking)
                <td>{{ $booking}}</td>
@endforeach

In this block of code, in an IDE like PHPStorm i would get the autocomplete in the curly braces for the $booking variable. If this is not a feature of this extension, do you know of any that provides this functionality?

Many thanks

@amir9480 amir9480 added enhancement New feature or request help wanted Extra attention is needed labels Jun 1, 2021
@amir9480
Copy link
Owner

amir9480 commented Jun 1, 2021

@AlexJames-Dev
Hello there

No, this extension does not support this feature as no code parser used.
Currently, you may provide autocomplete manually using this configuration

"LaravelExtraIntellisense.modelVariables": {
    "booking": "App\\Models\\YourModel"
}

@kluvi
Copy link

kluvi commented Apr 15, 2022

I am using type-hinting directly in blade templates (it worked correctly in PhpStorm), something like this:

<?php /** @var \App\Models\IpAddress $item */ ?>
<?php /** @var \App\Models\Range $range */ ?>
<div class="name">{{ $item->name }}</div>

It would be much better than defining types in configuration. And it can be parsed only with regex.

@devsquad-eduardo-barijan

@amir9480 That would work the same as it does in PHPStorm and would be really nice. I will try using the json config provided, but I will help showing some code we are used to see in blade components. The idea like @kluvi said is to parse the PHPDoc declaration. Thanks for your time!

@php
    /** @var \App\Models\Project $project */
@endphp

@forelse ($projects as $project)
    <x-table.tr>
        <x-table.td>{{ $project->name }}</x-table.td>

@vgaldikas
Copy link

I am using type-hinting directly in blade templates (it worked correctly in PhpStorm), something like this:

<?php /** @var \App\Models\IpAddress $item */ ?>
<?php /** @var \App\Models\Range $range */ ?>
<div class="name">{{ $item->name }}</div>

It would be much better than defining types in configuration. And it can be parsed only with regex.

Did you install some extension to make this work? Cause I have annotations in the blade files for all variables, but neither 'jump to' nor autocomplete works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants