3
votes

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.

1
What error are you getting with symfony plugin disabled? - Dmitrii
When I disable the symfony plugin I don't get an error - which is because the settings page is only visible because of the symfony plugin. Like I said after reinstalling the settings page is broken again. - Jay-Way
Hm, try to disable ALL custom plugins first. That should help in 99% of cases. Otherwise try to purge your .PhpStorm2018.3 directory, see jetbrains.com/help/phpstorm/tuning-the-ide.html#default-dirs - Dmitrii
I have the same issue. I tried to disable ALL custom plugins, but it didn't help. I have non-standard directory structure though - 2 Symfony projecst in "projects/A" and "projects/B" directories. - Tomas Votruba
@TomášVotruba thanks for commenting, I did not solve the problem in the meantime. Let me know if you do! What I did not try yet is a complete reinstall, I want to avoid that.. - Jay-Way

1 Answers

2
votes

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!