Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Template setting page for Symfony/Twig missing after PhpStorm IDE Error

I just tried to configure my Twig settings for PhpStorm, to get autocomplete and quick jumping for template files. However it seems like I entered a wrong path which killed the settings page and generated an fatal error.

Here is the PhpStorm stacktrace:

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'path' of fr/adrienbrault/idea/symfony2plugin/templating/path/TwigPath.<init> must not be null
at fr.adrienbrault.idea.symfony2plugin.templating.path.TwigPath.$$$reportNull$$$0(TwigPath.java)
at fr.adrienbrault.idea.symfony2plugin.templating.path.TwigPath.<init>(TwigPath.java)
at fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil.getTwigNamespaces(TwigUtil.java:1337)
at fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil.getTemplateNamesForFile(TwigUtil.java:1242)
at fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil.getTemplatesExtendingFile(TwigUtil.java:2180)
at fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil.getTemplatesExtendingFile(TwigUtil.java:2168)
at fr.adrienbrault.idea.symfony2plugin.twig.loader.FileImplementsLazyLoader.getFiles(FileImplementsLazyLoader.java:35)
at fr.adrienbrault.idea.symfony2plugin.twig.utils.TwigBlockUtil.hasBlockImplementations(TwigBlockUtil.java:66)
at fr.adrienbrault.idea.symfony2plugin.templating.TwigLineMarkerProvider.attachBlockImplements(TwigLineMarkerProvider.java:197)
at fr.adrienbrault.idea.symfony2plugin.templating.TwigLineMarkerProvider.collectSlowLineMarkers(TwigLineMarkerProvider.java:80)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.a(LineMarkersPass.java:197)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.a(LineMarkersPass.java:96)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:80)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:91)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.e(PassExecutorService.java:423)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1161)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.d(PassExecutorService.java:416)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:415)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.b(PassExecutorService.java:391)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

And that's how the settings page looks:

empty settings page

How can I reset the settings page? I already uninstalled the Symfony plugin (which adds/remove the setting page) which had no effect, I still had the empty page on reinstall.

like image 986
Jay-Way Avatar asked Dec 21 '25 08:12

Jay-Way


1 Answers

This solution worked for me:

  • Open the project .idea directory in your OS file explorer
  • Locate the symfony2.xml file
  • Rename the file to something like symfony2_bkup.xml
  • Re-install the plugin
  • Restart PHPStorm
  • Allow the prompt to enable with auto configuration
  • Go to Settings > Languages & Frameworks > PHP > Symfony > Twig / Template
  • Should now work OK.
  • If you have previous settings, copy them from the backup xml file to the new one thats been generated.

UPDATE

After further debugging, it turns out if you have something like this in your xml file:

<option name="twigNamespaces">
  <list>
    <twig_namespace custom="true" namespace="MyCompany" namespaceType="ADD_PATH" />
  </list>
</option>

Then you need to add the path attribute like so:

<option name="twigNamespaces">
  <list>
    <twig_namespace custom="true" namespace="MyCompany" namespaceType="ADD_PATH" path="path/to/custom/views" />
  </list>
</option>

Once you save the xml file changes, be sure to restart PHPStorm!

like image 176
siguy85 Avatar answered Dec 23 '25 23:12

siguy85



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!