idea-php-symfony2-plugin: asset() autocompletion fails in PHPStorm 2017.3
I am using Symfony 3.4.1. In twig templates, it is not suggesting resources in public directory anymore whilst using {{ asset('abc.jpg') }}
. It says Missing asset...
yet it renders correctly when we display it on browsers.
This is my framework.yaml
:
framework:
secret: '%env(APP_SECRET)%'
default_locale: tr
translator:
fallbacks: ['tr']
#csrf_protection: ~
#http_method_override: true
# uncomment this entire section to enable sessions
session:
# With this config, PHP's native session handling is used
handler_id: ~
#esi: ~
#fragments: ~
php_errors:
log: true
templating:
engines: twig
form:
resources:
- 'App:Form'
This is my PHPStorm version:
PhpStorm 2017.3
Build #PS-173.3727.138, built on November 28, 2017
JRE: 1.8.0_152-release-1024-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.2
Any idea how to gain autocompletion back? Because we love it 💯 percent 😄
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 20 (5 by maintainers)
Commits related to this issue
- fix assets reading and provide explicit resolving for asset files instead of rescanning them to improve performance an drop massive `opendirectoryd` cpu time #809 #1118 — committed to Haehnchen/idea-php-symfony2-plugin by Haehnchen 7 years ago
- fix assets reading and provide explicit resolving for asset files instead of rescanning them to improve performance an drop massive `opendirectoryd` cpu time #809 #1118 — committed to Haehnchen/idea-php-symfony2-plugin by Haehnchen 7 years ago
- fix assets reading and provide explicit resolving for asset files instead of rescanning them to improve performance an drop massive `opendirectoryd` cpu time #809 #1118 — committed to Haehnchen/idea-php-symfony2-plugin by Haehnchen 7 years ago
- Merge pull request #1119 from Haehnchen/feature/1118-fix-optimize-assets fix assets reading and provide explicit resolving for asset files instead of rescanning them to improve performance an drop ma... — committed to Haehnchen/idea-php-symfony2-plugin by Haehnchen 7 years ago
If you are using Symfony 4.x the default directory for assets is ‘public’ instead of ‘web’, so the plugin can’t find the assets.
The solution is simply change the Web Directory config in the plugin’s settings to “public”.
What version of PHPStorm are you using?
Here is another screenshot may help you
As an extra note, neither clearing project’s cache nor Symfony plugin’s cache helps 😦
Symfony plugin 0.15.162
After everything above, this is what solve the problem for me: Ctrl + Alt + S > Languages & Frameworks > PHP > Annotations > Actions > SCHEDULE ANNOTATION REINDEX
Clicked that button, software indexed the project, and I got my sanity and autocomplete back.
@Haehnchen
This same (mis)behavior – report of
Missing asset...
but correct render – is again occurring withand
Plugins uninstall/reinstall seems to make no difference.
Assuming I’ve not missed something, not sure if you want to reopen here, or open as a new bug.
Seems nicely fixed with version 0.15.163. Thanks. 👍 It is one of the 🔑 plugins to develop Symfony with PhpStorm 😄
sry, … but back in the game also improved performance a lot 😉