localizely / flutter-intl-intellij

This Android Studio & IntelliJ plugin generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
129 stars 4 forks source link

TextMateFile cannot be cast to class YAMLFile #93

Closed JiangHongTiao closed 1 year ago

JiangHongTiao commented 1 year ago

Hi guys, I'm getting following error when I enable the plugin:

java.lang.ClassCastException: class org.jetbrains.plugins.textmate.psi.TextMateFile cannot be cast to class org.jetbrains.yaml.psi.YAMLFile (org.jetbrains.plugins.textmate.psi.TextMateFile is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @72be4cee; org.jetbrains.yaml.psi.YAMLFile is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @37568df8)
    at com.localizely.flutter.intl.utils.PluginUtils.isPluginEnabledForProject(PluginUtils.java:79)
    at com.localizely.flutter.intl.actions.ExtractStringKeyAction.isAvailable(ExtractStringKeyAction.java:319)
    at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.availableFor(ShowIntentionActionsHandler.java:166)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.lambda$getActionsToShow$3(ShowIntentionsPass.java:334)
    at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseBetweenHostAndInjected(ShowIntentionActionsHandler.java:203)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:333)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:233)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:379)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1086)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:371)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:589)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:664)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:620)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:588)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:370)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:346)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:173)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:344)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Here is my env. info: IU-223.7571.182, JRE 17.0.5+1-b653.14x64 JetBrains s.r.o., OS Mac OS X(aarch64) v13.1, screens 3024.0x1964.0, 3440.0x1440.0; Retina

My plugin version is: 1.18.1-2022.2

I have tried to turn on/off YAML/Ansible Support plugin, but with no effect. I didn't do deeper investigation. If you would need some more details, please let me know, I will try to provide. Thanks, Juraj

lzoran commented 1 year ago

Hi @JiangHongTiao,

Thanks for reporting this!

Indeed, there is some incompatibility with the IntelliJ 2022.3+. We'll do our best to fix it soon.

When it comes to YAML/Ansible support, I noticed that this plugin updates IDE file types settings after installation, which consequently creates a problem with the Flutter Intl plugin. Could you check if reverting file types settings help?

IntelliJ-file-types-settings

JiangHongTiao commented 1 year ago

Hi @lzoran , thank you for your response. I have tried to revert those settings, I've manually reassigned *.yaml into YAML and removed it from YAML/Ansible and there was no error message. Also synchronization seems to be working. I think this can be closed if you don't need to track it.