KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.83k stars 153 forks source link

Syntax highlighting is still broken frequently after upgrade plugin to 11.9.1 #1882

Closed odk211 closed 3 years ago

odk211 commented 3 years ago

https://github.com/KronicDeth/intellij-elixir/issues/1874 is not fixed in my environment.

Version

11.9.1

What I was doing

Do https://github.com/KronicDeth/intellij-elixir/issues/1874 's how to reproduce

Exceptions

Exception 0

Stacktrace

java.lang.Throwable: No decompiled source function with name (with_cte)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:143)
    at org.elixir_lang.beam.psi.impl.ModuleImpl.setMirror(ModuleImpl.kt:68)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirror(ModuleElementImpl.java:55)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:46)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:37)
    at org.elixir_lang.beam.psi.BeamFileImpl.setMirror(BeamFileImpl.java:634)
    at org.elixir_lang.beam.psi.BeamFileImpl$1.run(BeamFileImpl.java:607)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:192)
    at org.elixir_lang.beam.psi.BeamFileImpl.getMirror(BeamFileImpl.java:605)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.getMirror(ModuleElementImpl.java:125)
    at org.elixir_lang.beam.psi.impl.ModuleImpl.getNavigationElement(ModuleImpl.kt:105)
    at org.elixir_lang.psi.scope.module.Variants.projectNameElements(Variants.kt:126)
    at org.elixir_lang.psi.scope.module.Variants.access$projectNameElements(Variants.kt:23)
    at org.elixir_lang.psi.scope.module.Variants$Companion.lookupElementList(Variants.kt:153)
    at org.elixir_lang.reference.Module.getVariants(Module.kt:16)
    at org.elixir_lang.reference.Module.getVariants(Module.kt:13)
    at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:255)
    at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(CompletionVariant.java:125)
    at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:67)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.lambda$completeReference$0(LegacyCompletionContributor.java:71)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReference(LegacyCompletionContributor.java:125)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:108)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:69)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:52)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:76)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:154)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:146)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:88)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:32)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:76)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:59)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:132)
    at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:41)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$10(CompletionProgressIndicator.java:854)
    at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:149)
    at com.intellij.util.indexing.FileBasedIndexImpl.ignoreDumbMode(FileBasedIndexImpl.java:653)
    at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:148)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:850)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:838)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:352)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
    at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:344)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:95)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:268)
    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.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)
joshuataylor commented 3 years ago

2020.1:

I get no error, but I see half my document with highlighting and half not now: image

edit: Got it to error with a new dummy file: image

I also cannot type on this one until I reopen the file. I feel like this is a different bug.

java.lang.Throwable: No decompiled source function with name (__get_attribute__)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:146)
    at org.elixir_lang.beam.psi.impl.ModuleImpl.setMirror(ModuleImpl.kt:68)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirror(ModuleElementImpl.java:55)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:46)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.setMirrors(ModuleElementImpl.java:37)
    at org.elixir_lang.beam.psi.BeamFileImpl.setMirror(BeamFileImpl.java:634)
    at org.elixir_lang.beam.psi.BeamFileImpl$1.run(BeamFileImpl.java:607)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:188)
    at org.elixir_lang.beam.psi.BeamFileImpl.getMirror(BeamFileImpl.java:605)
    at org.elixir_lang.beam.psi.impl.ModuleElementImpl.getMirror(ModuleElementImpl.java:125)
    at org.elixir_lang.beam.psi.impl.ModuleImpl.getNavigationElement(ModuleImpl.kt:105)
    at org.elixir_lang.psi.scope.module.Variants.projectNameElements(Variants.kt:126)
    at org.elixir_lang.psi.scope.module.Variants.access$projectNameElements(Variants.kt:23)
    at org.elixir_lang.psi.scope.module.Variants$Companion.lookupElementList(Variants.kt:153)
    at org.elixir_lang.reference.Module.getVariants(Module.kt:16)
    at org.elixir_lang.reference.Module.getVariants(Module.kt:13)
    at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:257)
    at com.intellij.codeInsight.completion.CompletionVariant.addReferenceCompletions(CompletionVariant.java:119)
    at com.intellij.codeInsight.completion.CompletionData.completeReference(CompletionData.java:66)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.lambda$completeReference$0(LegacyCompletionContributor.java:71)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReference(LegacyCompletionContributor.java:125)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:108)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:69)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:52)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:76)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:154)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:146)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:86)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:26)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:154)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:76)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:59)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:132)
    at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.kt:30)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:834)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:819)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$null$6(CodeCompletionHandlerBase.java:332)
    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$7(CodeCompletionHandlerBase.java:324)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:95)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
    at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
    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)
KronicDeth commented 3 years ago

That error should just be a logging error, not a real exception, kill the decompiler error, so I'm surprised it is causing the highlighting to stop, but is definitely much clearer than the old mirror error. It's hard to tell because the error logger always includes an exception, but my understanding is exception is just generated to make a stacktrace since you can't ask for a stack trace otherwise in Java. It's too bad the generic parameter means I couldn't include the module name. with_cte would seem to be related to Ecto though. You got Ecto as a dependency @odk211?

tsedge commented 3 years ago

I'm getting a similar problem all over my code, only fixed by closing the source file and reopening it again. This is the same behaviour I had before the attempted bug fix. My errors vary but they are also of the form "No decompiled source function". Although the source file text greys out the check mark / error display seems to still work correctly and respond to changes. I'm not using ecto and cannot easily post any source code - just letting you know others are seeing this too. (Forgot to say: this wasn't a problem before 11.9, has been broken for me in 11.9 and 11.9.1).

odk211 commented 3 years ago

Thanks for check it.

You got Ecto as a dependency

Yes, I use.

KronicDeth commented 3 years ago

with_cte is the same root cause as #1886 - """ in the doc string is making the docstring itself stop early. The fix for #1886 fixed this too as I was able to open up Ecto.Query.beam and see the fix chose ''' as the terminator/promoter because """ appears in

defmodule Ecto.Query do
@doc ~S'''
...
It's also possible to pass a raw SQL fragment:

      @raw_sql_category_tree """
      SELECT * FROM categories WHERE c.parent_id IS NULL
      UNION ALL
      SELECT * FROM categories AS c, category_tree AS ct WHERE ct.id = c.parent_id
      """

      Product
      |> recursive_ctes(true)
      |> with_cte("category_tree", as: fragment(@raw_sql_category_tree))
      |> join(:inner, [p], c in "category_tree", on: c.id == p.category_id)
...
'''
defmacro with_cte(query, name, list) do
  ...
end
end
KronicDeth commented 3 years ago

@joshuataylor __get_attribute__ is from Module, it is #1886 precisely.

KronicDeth commented 3 years ago

Test build for #1887. I'll be testing it myself today for normal work. I'll merge #1887 and release 11.9.2 with the fix tonight/tomorrow if I don't hit another bug. Anyone that can, please test it too.

intellij-elixir-11.9.2-pre+20210119174940.zip

odk211 commented 3 years ago

I still get this problem with intellij-elixir-11.9.2-pre+20210119174940 and IntelliJ IDEA 2020.2.4 (Ultimate Edition) ...

  1. Type Map.put(%{}, :a, 1).
  2. Syntax highlighting is broken at end after typing :a
  3. Some typing completion do not work(when I type %{ , corresponding } is not put).

There are no errors.

https://user-images.githubusercontent.com/1321120/105134544-f365eb00-5b31-11eb-8221-e9700d4fa7fc.mov

odk211 commented 3 years ago

I'll create another issue. but thanks for your quick work ! Created https://github.com/KronicDeth/intellij-elixir/issues/1889