code completion for plugin that uses javascript does not work in IDEA 12 Follow
Hi,
I developed a plugin for code completion and syntax highlighting for a language that has html and javascript support. Javascript is in between custom tags( <% %>)
I used template language mechanism for HTML part and ILazyParseableElementType for javascript for javascript blocks inside <% %>.
Plugin worked fine for IDEA 11 but in IDEA 12 when I try to get code completion(CTRL + SPACE) for javascript I get the following exception.
[ 45443] ERROR - on.CompletionProgressIndicator - null
java.lang.NullPointerException
at com.intellij.lang.javascript.psi.JSRecursiveElementVisitor.visitElement(JSRecursiveElementVisitor.java:15)
at com.intellij.lang.javascript.psi.resolve.VariantsProcessor.addReferencesUsedInCurrentScope(VariantsProcessor.java:349)
at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.calcDefaultVariants(JSReferenceExpressionImpl.java:514)
at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.getVariants(JSReferenceExpressionImpl.java:438)
at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:313)
at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(CompletionVariant.java:181)
at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:112)
at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(LegacyCompletionContributor.java:69)
at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(LegacyCompletionContributor.java:65)
at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:117)
at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:103)
at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:65)
at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:48)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
at com.intellij.lang.javascript.completion.JSCompletionContributor.fillCompletionVariants(JSCompletionContributor.java:89)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:115)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:739)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$900(CompletionProgressIndicator.java:86)
at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:721)
at com.intellij.codeInsight.completion.AsyncCompletion$1$1$1.run(CompletionThreading.java:93)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:935)
at com.intellij.codeInsight.completion.AsyncCompletion$1$1.run(CompletionThreading.java:88)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:191)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:232)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181)
at com.intellij.codeInsight.completion.AsyncCompletion$1.run(CompletionThreading.java:84)
at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:465)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)
[ 45443] ERROR - on.CompletionProgressIndicator - IntelliJ IDEA 12.0 Build #IU-123.72
[ 45444] ERROR - on.CompletionProgressIndicator - JDK: 1.6.0_32
[ 45444] ERROR - on.CompletionProgressIndicator - VM: Java HotSpot(TM) 64-Bit Server VM
[ 45444] ERROR - on.CompletionProgressIndicator - Vendor: Sun Microsystems Inc.
[ 45444] ERROR - on.CompletionProgressIndicator - OS: Linux
[ 45444] ERROR - on.CompletionProgressIndicator - Last Action: CodeCompletion
Any help is highly appreciated to get the plugin worked in IDEA 12..
Thanks ..!!
Please sign in to leave a comment.
Hi Amila,
Looks like there's no JSFile or JSEmbeddedContent instance at the top level of your JavaScript fragment. I would use PsiViewer dialog to compare my PSI structure with the structure built from the same fragment put in separate .js file.
Kirill
Hi,
Thank you for the quick reply. Can you please clarify what these JSFile or JSEmbeddedContent instances are. All what I do is extract only the js content
from lexer and return as ILazyParseableElementType. There I set the language type as Javascript. And also I get the following warning which I missed to mention in the above post.
[ 10789] WARN - gins.intelliLang.Configuration - com.intellij.jsf: META-INF/languageInjections.xml was not found
Thanks ..!!
This is a top-level element of a PSI subtree that corresponds to whole fragment (PSI viewer dialog will show you PSI tree for JavaScript).
You can safely ignore this warning.
Hi,
Thanks a lot for the explanation. I changed the template language as javascript instead of returning as ILazyParseableElementType.
Plugin seems to be working fine in IDEA 12 then.
Thanks ..!!