tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
485 stars 38 forks source link

Exception on in-html Code Completion #93

Closed vkalinichev closed 4 years ago

vkalinichev commented 4 years ago

Hi! Thanks for great plugin!

I got an exception when I try to use Javascript Code Completion inside regular html code.

Steps to reproduce:

  1. Open html file with <script> tag
  2. Type win and emit Code Completion (control + space by default)

Expected:

Actual:

java.lang.IllegalStateException: file.virtualFile must not be null
    at dev.blachut.svelte.lang.codeInsight.SvelteNSInfoProvider.overrideNamespaceFromDocType(SvelteNSInfoProvider.kt:13)
    at com.intellij.xml.util.XmlUtil.getDefaultNamespaces(XmlUtil.java:589)
    at com.intellij.xml.XmlExtension.getNamespacesFromDocument(XmlExtension.java:94)
    at com.intellij.xml.HtmlXmlExtension.getNamespacesFromDocument(HtmlXmlExtension.java:24)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.computeNamespaceMap(XmlTagImpl.java:899)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.lambda$getNamespaceMap$12(XmlTagImpl.java:867)
    at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:148)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValueFromExHolder(CachedValuesManagerImpl.java:72)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:45)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:147)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:129)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespaceMap(XmlTagImpl.java:866)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespaceByPrefix(XmlTagImpl.java:785)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespaceByPrefix(XmlTagImpl.java:791)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespaceByPrefix(XmlTagImpl.java:791)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespaceByPrefix(XmlTagImpl.java:791)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.lambda$getNamespace$10(XmlTagImpl.java:768)
    at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:148)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValueFromExHolder(CachedValuesManagerImpl.java:72)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:45)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:147)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:129)
    at com.intellij.psi.impl.source.xml.XmlTagImpl.getNamespace(XmlTagImpl.java:767)
    at com.intellij.psi.impl.source.html.HtmlTagImpl.getNamespace(HtmlTagImpl.java:98)
    at com.intellij.patterns.XmlTagPattern.getNamespace(XmlTagPattern.java:53)
    at com.intellij.patterns.XmlTagPattern$Capture.getNamespace(XmlTagPattern.java:116)
    at com.intellij.patterns.XmlNamedElementPattern$2.processValues(XmlNamedElementPattern.java:70)
    at com.intellij.patterns.XmlNamedElementPattern$2.processValues(XmlNamedElementPattern.java:65)
    at com.intellij.patterns.PatternConditionPlus.accepts(PatternConditionPlus.java:42)
    at com.intellij.patterns.ObjectPattern.accepts(ObjectPattern.java:68)
    at com.intellij.patterns.compiler.PatternCompilerImpl$LazyPresentablePattern.accepts(PatternCompilerImpl.java:574)
    at org.intellij.plugins.intelliLang.inject.config.BaseInjection.acceptsPsiElement(BaseInjection.java:173)
    at org.intellij.plugins.intelliLang.inject.config.AbstractTagInjection.acceptsPsiElement(AbstractTagInjection.java:76)
    at org.intellij.plugins.intelliLang.inject.xml.XmlLanguageInjector.getInjectedLanguage(XmlLanguageInjector.java:111)
    at org.intellij.plugins.intelliLang.inject.xml.XmlLanguageInjector.getLanguagesToInject(XmlLanguageInjector.java:82)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.processInPlaceInjectorsFor(InjectedLanguageManagerImpl.java:421)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.probeElementsUp(InjectedLanguageUtil.java:348)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.enumerate(InjectedLanguageUtil.java:173)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.findInside(InjectedLanguageUtil.java:490)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.tryOffset(InjectedLanguageUtil.java:469)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.findInjectedElementNoCommit(InjectedLanguageUtil.java:449)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.findInjectedElementAt(InjectedLanguageManagerImpl.java:286)
    at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.findInjectedPsiNoCommit(InjectedLanguageUtil.java:303)
    at com.intellij.codeInsight.completion.OffsetsInFile.toInjectedIfAny(OffsetsInFile.kt:42)
    at com.intellij.codeInsight.completion.CompletionInitializationUtil.toInjectedIfAny(CompletionInitializationUtil.java:132)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$null$5(CodeCompletionHandlerBase.java:318)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
    at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:317)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:95)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
tomblachut commented 4 years ago

This was already fixed in master but it's yet to be released in 0.12.0.

Sorry for your inconvenience.