code completion for plugin that uses javascript does not work in IDEA 12


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
 at com.intellij.lang.javascript.psi.JSRecursiveElementVisitor.visitElement(
 at com.intellij.lang.javascript.psi.resolve.VariantsProcessor.addReferencesUsedInCurrentScope(
 at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.calcDefaultVariants(
 at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.getVariants(
 at com.intellij.codeInsight.completion.CompletionData.completeReference(
 at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(
 at com.intellij.codeInsight.completion.CompletionData.completeReference(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(
 at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(
 at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(
 at com.intellij.lang.javascript.completion.JSCompletionContributor.fillCompletionVariants(
 at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(
 at com.intellij.codeInsight.completion.CompletionService.performCompletion(
 at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(
 at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$900(
 at com.intellij.codeInsight.completion.CompletionProgressIndicator$
 at com.intellij.codeInsight.completion.AsyncCompletion$1$1$
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(
 at com.intellij.codeInsight.completion.AsyncCompletion$1$
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(
 at com.intellij.codeInsight.completion.AsyncCompletion$
 at com.intellij.openapi.application.impl.ApplicationImpl$
 at java.util.concurrent.Executors$
 at java.util.concurrent.FutureTask$Sync.innerRun(
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
 at java.util.concurrent.ThreadPoolExecutor$
 at com.intellij.openapi.application.impl.ApplicationImpl$1$
[  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 ..!!

Comment actions Permalink

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.


Comment actions Permalink


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 ..!!
Comment actions Permalink

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.

Comment actions Permalink


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 ..!!


Please sign in to leave a comment.