nbadal / ktlint-intellij-plugin

Ktlint plugin for IntelliJ IDEA + Android Studio
MIT License
166 stars 24 forks source link

Issue on project open / create kotlin class #303

Closed rbleuse closed 1 year ago

rbleuse commented 1 year ago

Hi, most of the time I'm facing an issue when I open a new project / start intellij / create a new class, here it is :

com.intellij.diagnostic.PluginException: annotator: com.nbadal.ktlint.KtlintAnnotator@5645777 (class com.nbadal.ktlint.KtlintAnnotator) [Plugin: com.nbadal.ktlint]
    at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
    at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:83)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.processError(ExternalToolPass.java:263)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doApply(ExternalToolPass.java:229)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doApply(ExternalToolPass.java:218)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:185)
    at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:59)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:898)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:68)
    at com.intellij.openapi.application.ReadAction.run(ReadAction.java:58)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$1(ExternalToolPass.java:182)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:366)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:344)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:180)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:334)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:324)
    at com.intellij.util.ui.update.MergingUpdateQueue.doExecute(MergingUpdateQueue.java:281)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:264)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:238)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:241)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:377)
    at com.intellij.util.Alarm$Request.run(Alarm.java:366)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:272)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:243)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:216)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:205)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: com.intellij.diagnostic.PluginException: Range must be inside element being annotated: (0,752); but got: (743,757) [Plugin: com.nbadal.ktlint]
    at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
    at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:83)
    at com.intellij.codeInsight.daemon.impl.B.range(B.java:169)
    at com.nbadal.ktlint.KtlintAnnotator.apply(KtlintAnnotator.kt:37)
    at com.nbadal.ktlint.KtlintAnnotator.apply(KtlintAnnotator.kt:14)
    at com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl.applyExternalAnnotatorWithContext(AnnotationHolderImpl.java:247)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doApply(ExternalToolPass.java:226)
    ... 40 more

I'm using 2022.3.3

Screenshot 2023-04-20 at 7 36 00
nbadal commented 1 year ago

Interesting! Thank you for reporting this, I will try to reproduce this issue locally asap.