nystudio107 / craft-autocomplete

Provides Twig template IDE autocomplete of Craft CMS & plugin variables
MIT License
42 stars 4 forks source link

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

Closed roberttolton closed 3 years ago

roberttolton commented 3 years ago

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.

bencroker commented 3 years ago

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

roberttolton commented 3 years ago

@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!

khalwat commented 3 years ago

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

roberttolton commented 3 years ago

@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.

jaydensmith commented 3 years ago

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
khalwat commented 3 years ago

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

bencroker commented 3 years ago

Sounds like it might be an IDE configuration setting?