You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IDE error occurs when perform "Run isort" with "Optimize imports before sort" enabled.
PyCharm 2021.1.1 (Professional Edition)
Build #PY-211.7142.13, built on April 21, 2021
Runtime version: 11.0.9.1+11-b1145.63 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Non-Bundled Plugins: ..., com.github.urm8.isortconnect (0.0.12), ...
Unhandled exception in [CoroutineId(6172), "coroutine#6172":StandaloneCoroutine{Cancelling}@76f659e8, Dispatchers.IO]
com.intellij.util.IncorrectOperationException: Must not change PSI outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor
at com.intellij.pom.core.impl.PomModelImpl.startTransaction(PomModelImpl.java:270)
at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:96)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:218)
at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:142)
at com.intellij.psi.impl.source.tree.CompositeElement.removeChildrenInner(CompositeElement.java:833)
at com.intellij.psi.impl.source.tree.CompositeElement.removeRange(CompositeElement.java:611)
at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.removeChildren(CodeEditUtil.java:132)
at com.intellij.psi.impl.source.PsiFileImpl.deleteChildRange(PsiFileImpl.java:844)
at com.intellij.extapi.psi.ASTDelegatePsiElement.deleteElementFromParent(ASTDelegatePsiElement.java:342)
at com.intellij.extapi.psi.ASTDelegatePsiElement.delete(ASTDelegatePsiElement.java:327)
at com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesVisitor.optimizeImports(PyUnresolvedReferencesVisitor.java:570)
at com.jetbrains.python.codeInsight.imports.PyImportOptimizer.lambda$processFile$0(PyImportOptimizer.java:79)
at com.github.urm8.isortconnect.service.SorterService$optimizeImports$1.run(SorterService.kt:126)
at com.intellij.openapi.application.WriteAction.lambda$runAndWait$2(WriteAction.java:134)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:947)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:973)
at com.intellij.openapi.application.WriteAction.compute(WriteAction.java:115)
at com.intellij.openapi.application.WriteAction.lambda$computeAndWait$3(WriteAction.java:164)
at com.intellij.openapi.application.WriteThread.lambda$submit$0(WriteThread.java:27)
at com.intellij.openapi.application.WriteThread.lambda$submit$1(WriteThread.java:44)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:218)
at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:200)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLaterOnWriteThread$10(ApplicationImpl.java:770)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Suppressed: java.lang.RuntimeException
at com.intellij.openapi.application.WriteAction.computeAndWait(WriteAction.java:173)
at com.intellij.openapi.application.WriteAction.runAndWait(WriteAction.java:133)
at com.github.urm8.isortconnect.service.SorterService.optimizeImports(SorterService.kt:124)
at com.github.urm8.isortconnect.service.SorterService.access$optimizeImports(SorterService.kt:32)
at com.github.urm8.isortconnect.service.SorterService$sortImports$1.invokeSuspend(SorterService.kt:74)
at com.github.urm8.isortconnect.service.SorterService$sortImports$1.invoke(SorterService.kt)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$4.invokeSuspend(IntrinsicsJvm.kt:205)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
The text was updated successfully, but these errors were encountered:
wow, thats weird, will try to resolve asap :(
for some reason, only reproducable in stable build, wrapped the code that invokes optimizes imports in try/catch for now, will investigate it later
TL;DR
This issue can be solved by mounting project files into containers if you are deploying isortd using docker.
This issue occurs when I run isortd in docker, and the isortd reports isort.exceptions.FileSkipSetting errors.
If isortd is running directly in the host shell, everything works fine.
I find that the FileSkipSetting error is caused by the removal of disregard_skip flag,
and the error disappears after I add the disregard_skip flag back, but the sorting result is not correct.
Then I realize that the entire project tree might be needed to be accessible by isortd. After mounting my entire home into the container, the IsortConnect is working and the result is correct.
Maybe the README of isortd should be updated to document this issue. 😄
IDE error occurs when perform "Run isort" with "Optimize imports before sort" enabled.
The text was updated successfully, but these errors were encountered: