nystudio107/craft-autocomplete

PHPStorm still not picking up hints despite a correct-looking setup

Closed this issue · 7 comments

Question

I'm not sure what my PHPStorm install is getting wrong about my app, but it cannot resolve the hinted properties on the craft variable. I am using a Lando (Docker) local setup, and can confirm that PHPStorm has bound read/write access to the entire storage directory, including the compiled_classes directory.

Additional context

AutocompleteVariable.php
Screenshot 2021-08-23 at 13 01 03

craft variable is correctly showing as an instance of the AutocompleteVariable class
Screenshot 2021-08-23 at 13 00 13

But I cannot auto-complete imagerx, as an example
Screenshot 2021-08-23 at 13 01 32

I have cleared Craft's caches and temp files and regenerated the auto-complete classes.
I have tried marking the complied_classes folder as a 'Source Root' in PHPStorm.
I have not configured the Symfony plugin for this project beyond the defaults - does it need configuring?
I have also tried clearing the Index in the Symfony plugin, invalidating all PHPStorm caches and rebooting.

Is autocompletion working for {{ craft.globals }} or {{ craft.blitz }}?

@bencroker So.. it's working now, oddly.

The only thing I changed since my last post was unmarking compiled_classes as a 'Source Root', but I doubt that's anything to do with it (?).

As grateful as I am that it's now working, it's annoying I can't pinpoint what the fix was, as none of my steps outlined in the first post offered an immediate, re-testable resolution and I'm not sure what might cause it to resurface.

Anyhow, thanks for your time!

If I had to guess, it'd be because the index wasn't completed yet

@khalwat I thought that, but I checked each time and waited for PHPStorm's background processes to finish before re-testing. But, yeah, it would seem that it just sorted itself out.

My IDE isn't picking up hints if the files are .gitignore'd. If I add exceptions for the generated classes everything works...

!/storage/runtime/compiled_classes/AutocompleteVariable.php
!/storage/runtime/compiled_classes/AutocompleteTwigExtension.php

That's pretty odd @jaydensmith -- I have them .gitignored without incident.

Sounds like it might be an IDE configuration setting?