pest-intellij icon indicating copy to clipboard operation
pest-intellij copied to clipboard

PhpStorm Autocomplete not working in closures

Open scheMeZa opened this issue 2 years ago • 10 comments

The biggest hurdle preventing me from using PEST everywhere is that PhpStorm doesn't seem to know what $this is inside pest test closures.

Is this an issue with my configuration?

Check: image

Because of the issue, I cannot autocomplete assertions on responses either. image

scheMeZa avatar Jun 08 '22 09:06 scheMeZa

Just want to add, I do have the plugin installed, and updated this morning:

image

scheMeZa avatar Jun 08 '22 09:06 scheMeZa

Thanks for reporting this. This is a feature we already support, could you share your folder structure or a demo project where I can reproduce?

olivernybroe avatar Jun 08 '22 11:06 olivernybroe

Here you go:

  1. I created a new laravel project to test this out: https://gitlab.com/jadonbrown/pest-test

  2. I installed Pest following the documentation on https://pestphp.com/docs/installation

  3. I created a command using php artisan make:test --pest ExamplePestTest. This created tests/Feature/ExamplePestTest.php.

  4. I've got the Pest plugin enabled. image

  5. I'm still not getting autocomplete features in the Pest test. image image

scheMeZa avatar Jun 08 '22 13:06 scheMeZa

Is there maybe a workaround for this issue?

scheMeZa avatar Jun 23 '22 19:06 scheMeZa

@scheMeZa thank you for providing an example. No idea if there is a workaround, I haven't looked into it yet.

olivernybroe avatar Jun 23 '22 19:06 olivernybroe

@scheMeZa I have cloned your repository and tried out locally and this is what happens for me. image

olivernybroe avatar Jun 30 '22 05:06 olivernybroe

So this means there is something in your setup interfering here 🤔

I can see you have a lot of plugins installed, a thing we could try is if you disable all the plugins installed from marketplace and only have pest plugin installed. Is it then working? 👀 (we will enable again, just need to figure out if we can isolate the issue)

olivernybroe avatar Jun 30 '22 06:06 olivernybroe

I noticed the same when using uses(class)->in(__DIR__).

uses(class)->in('./') fixed it for me.

ostark avatar Jul 26 '22 23:07 ostark

@ostark what version are you running? I am pretty sure we did add support for __dir__ already 🤔

olivernybroe avatar Jul 30 '22 23:07 olivernybroe

That worked for me, thank you :)

I had mine set to: uses(TestCase::class)->in('./Features'); uses(TestCase::class)->in('./Unit');

Switching to uses(TestCase::class)->in('./'); fixed IntelliSense for me.

scheMeZa avatar Jul 31 '22 08:07 scheMeZa

I am completely unable to reproduce this on v1.8.0.

Closing as it seems like you found a solution anyways.

olivernybroe avatar Aug 19 '22 06:08 olivernybroe