Describe the bug
This exception gets thrown repeatedly:
Got unexpected exception during formatting <redacted>
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid range specified: (423, 422);
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.checkStop(AbstractLayoutCodeProcessor.java:487)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.performFileProcessing(AbstractLayoutCodeProcessor.java:481)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$iteration$3(AbstractLayoutCodeProcessor.java:437)
at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.kt:277)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.iteration(AbstractLayoutCodeProcessor.java:437)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$process$10(AbstractLayoutCodeProcessor.java:524)
at com.intellij.codeInsight.actions.FileRecursiveIterator.lambda$processAll$4(FileRecursiveIterator.java:69)
at com.intellij.openapi.roots.impl.FileIndexBase.lambda$toContentIteratorEx$1(FileIndexBase.java:48)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl$processContentFilesRecursively$visitor$1.visitFileEx(WorkspaceFileIndexImpl.kt:142)
at com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively(VfsUtilCore.java:296)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.processContentFilesRecursively(WorkspaceFileIndexImpl.kt:151)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.processContentFilesRecursively(WorkspaceFileIndexImpl.kt:115)
at com.intellij.openapi.roots.impl.FileIndexBase.iterateContentUnderDirectory(FileIndexBase.java:41)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.iterateContentUnderDirectory(ProjectFileIndexImpl.java:31)
at com.intellij.openapi.roots.impl.FileIndexBase.iterateContentUnderDirectory(FileIndexBase.java:72)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.iterateContentUnderDirectory(ProjectFileIndexImpl.java:31)
at com.intellij.codeInsight.actions.FileRecursiveIterator.processAll(FileRecursiveIterator.java:64)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.process(AbstractLayoutCodeProcessor.java:522)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.processFilesUnderProgress(AbstractLayoutCodeProcessor.java:373)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.lambda$runProcessFiles$1(AbstractLayoutCodeProcessor.java:328)
at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:252)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:428)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:115)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:512)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:87)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:251)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:71)
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:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:71)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:251)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:465)
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: java.lang.IllegalArgumentException: Invalid range specified: (423, 422);
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:235)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:230)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:226)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:43)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:32)
at com.koxudaxi.ruff.RuffPostFormatProcessor.diffRange(RuffPostFormatProcessor.kt:51)
at com.koxudaxi.ruff.RuffPostFormatProcessor.processText(RuffPostFormatProcessor.kt:24)
at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessRange(CoreCodeStyleUtil.java:147)
at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessEnabledRanges(CoreCodeStyleUtil.java:138)
at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessText(CoreCodeStyleUtil.java:126)
at com.intellij.formatting.service.CoreFormattingService.lambda$formatRanges$0(CoreFormattingService.java:64)
at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessRanges(CoreCodeStyleUtil.java:114)
at com.intellij.formatting.service.CoreFormattingService.formatRanges(CoreFormattingService.java:64)
at com.intellij.formatting.service.FormattingServiceUtil.formatRanges(FormattingServiceUtil.java:93)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:147)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:112)
at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$doReformat$6(ReformatCodeProcessor.java:201)
at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:196)
at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$doReformat$7(ReformatCodeProcessor.java:185)
at com.intellij.openapi.editor.ex.util.EditorScrollingPositionKeeper.perform(EditorScrollingPositionKeeper.java:101)
at com.intellij.codeInsight.actions.ReformatCodeProcessor.doReformat(ReformatCodeProcessor.java:185)
at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$prepareTask$2(ReformatCodeProcessor.java:133)
at com.intellij.application.options.CodeStyle.doWithTemporarySettings(CodeStyle.java:367)
at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$prepareTask$3(ReformatCodeProcessor.java:129)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$performFileProcessing$7(AbstractLayoutCodeProcessor.java:478)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:149)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:992)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:147)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:156)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:123)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$performFileProcessing$8(AbstractLayoutCodeProcessor.java:478)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:100)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.kt:721)
at com.intellij.openapi.progress.util.ProgressWindow.lambda$startBlocking$4(ProgressWindow.java:217)
at com.intellij.openapi.application.impl.ApplicationImpl.runUnlockingIntendedWrite(ApplicationImpl.java:887)
at com.intellij.openapi.progress.util.ProgressWindow.lambda$startBlocking$5(ProgressWindow.java:212)
at com.intellij.openapi.progress.util.ProgressWindow.executeInModalContext(ProgressWindow.java:193)
at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:210)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$execFromEDT$7(ProgressRunner.java:317)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:757)
at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:735)
at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2182)
at com.intellij.openapi.progress.impl.ProgressRunner.execFromEDT(ProgressRunner.java:314)
at com.intellij.openapi.progress.impl.ProgressRunner.submit(ProgressRunner.java:254)
at com.intellij.openapi.progress.impl.ProgressRunner.submitAndGet(ProgressRunner.java:195)
at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:445)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:523)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:86)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:248)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.runProcessFiles(AbstractLayoutCodeProcessor.java:326)
at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.run(AbstractLayoutCodeProcessor.java:229)
at com.intellij.codeInsight.actions.onSave.FormatOnSaveAction.processFiles(FormatOnSaveAction.java:99)
at com.intellij.codeInsight.actions.onSave.FormatOnSaveAction.processDocuments(FormatOnSaveAction.java:62)
at com.intellij.ide.actionsOnSave.impl.ActionsOnSaveFileDocumentManagerListener.processSavedDocuments(ActionsOnSaveFileDocumentManagerListener.kt:130)
at com.intellij.ide.actionsOnSave.impl.ActionsOnSaveFileDocumentManagerListener.access$processSavedDocuments(ActionsOnSaveFileDocumentManagerListener.kt:31)
at com.intellij.ide.actionsOnSave.impl.ActionsOnSaveFileDocumentManagerListener$processSavedDocuments$1.invokeSuspend(ActionsOnSaveFileDocumentManagerListener.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:43)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
To Reproduce
Don't know how to reproduce, but I suspect the problem is obvious from the error message. If not, I can try to repro!
Expected behavior
No exceptions.
Environments (please complete the following information):
@adampauls
Thank you for creating the issue.
I released the fixed version v0.0.23.
If you happen to have the same issue after you upgrade the plugin, please reopen it here.
Describe the bug This exception gets thrown repeatedly:
To Reproduce Don't know how to reproduce, but I suspect the problem is obvious from the error message. If not, I can try to repro!
Expected behavior No exceptions.
Environments (please complete the following information):