donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
290 stars 57 forks source link

PyCharm Plugin error at startup #580

Closed BTWS2 closed 6 months ago

BTWS2 commented 6 months ago

What I did

I opened the new version of PyCharm.

What happened

image

java.lang.IllegalStateException: Should not be called
    at com.intellij.openapi.fileEditor.AsyncFileEditorProvider.createEditorAsync(AsyncFileEditorProvider.kt:20)
    at io.github.donkirkby.livepycharm.SplitFileEditorProvider.getBuilderFromEditorProvider(SplitFileEditorProvider.java:294)
    at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditorAsync(SplitFileEditorProvider.java:75)
    at com.intellij.openapi.fileEditor.AsyncFileEditorProvider$createEditorBuilder$2.invoke(AsyncFileEditorProvider.kt:25)
    at com.intellij.openapi.fileEditor.AsyncFileEditorProvider$createEditorBuilder$2.invoke(AsyncFileEditorProvider.kt:25)
    at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:108)
    at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:16)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:95)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:94)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke$lambda$1$lambda$0(cancellableReadAction.kt:38)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1075)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke$lambda$1(cancellableReadAction.kt:36)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:73)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke(cancellableReadAction.kt:34)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContextInner(coroutines.kt:321)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:310)
    at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:31)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:94)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:78)
    at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:65)
    at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:16)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invokeSuspend(InternalReadAction.kt:44)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
    at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:40)
    at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:38)
    at com.intellij.openapi.application.ReadWriteActionSupport.executeReadAction$default(ReadWriteActionSupport.kt:15)
    at com.intellij.openapi.application.CoroutinesKt.constrainedReadAction(coroutines.kt:58)
    at com.intellij.openapi.application.CoroutinesKt.readAction(coroutines.kt:25)
    at com.intellij.openapi.fileEditor.AsyncFileEditorProvider.createEditorBuilder$suspendImpl(AsyncFileEditorProvider.kt:25)
    at com.intellij.openapi.fileEditor.AsyncFileEditorProvider.createEditorBuilder(AsyncFileEditorProvider.kt)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImplKt$createBuilders$2$1$1.invokeSuspend(FileEditorManagerImpl.kt:2403)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

My environment

Describe the versions of everything you were using:

donkirkby commented 6 months ago

Thanks for the quick bug report. It looks like the ascii doctor and mjml plugins already fixed the same problem related to creating a split view editor.

donkirkby commented 6 months ago

I uploaded a patched version, and they're usually approved within a day or two.

BTWS2 commented 6 months ago

Thank you! 🙏

RTSRLLC commented 6 months ago

Similar if not exact. PyCharm Pro won't allow me to open a .py file at all. I must disable the plugin to code. Is your patch a fix for this issue as well? Thanks.

Unhandled exception in [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelling}@404aeb2d, Dispatchers.Default]

java.lang.IllegalStateException: Should not be called at com.intellij.openapi.fileEditor.AsyncFileEditorProvider.createEditorAsync(AsyncFileEditorProvider.kt:20) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.getBuilderFromEditorProvider(SplitFileEditorProvider.java:294) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditorAsync(SplitFileEditorProvider.java:75) at io.github.donkirkby.livepycharm.SplitFileEditorProvider.createEditor(SplitFileEditorProvider.java:51) at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl$dumbModeFinished$2.invokeSuspend(FileEditorManagerImpl.kt:451) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:43) at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209) at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22) at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843) at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463) at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75) at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67) at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1430) at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82) at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124) at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44) 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:695) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589) at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391) 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) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelled}@404aeb2d, Dispatchers.Default]

donkirkby commented 6 months ago

Looks the same to me, so it should be fixed when the patch release gets approved.

donkirkby commented 6 months ago

Good news, my plugin seems to work again with the patch version PyCharm 2023.3.1. I haven't gotten any response to my questions about how to properly fix this problem, but at least it's not an emergency now. I'd appreciate it if you could all vote up my question to improve my chances of getting a response.

RTSRLLC commented 6 months ago

Upvoted complete

RTSRLLC commented 6 months ago

Still didn't work. FYI.

donkirkby commented 6 months ago

Looks like I mixed up which version I was testing. @RTSRLLC is right, it still doesn't work with PyCharm 2023.3.1. I'll try uploading a new patch version, since I never got a response to my question.

donkirkby commented 6 months ago

OK, I finally got a patch release approved. This bug should be fixed with Live Coding in Python 4.11.3.

The fix was pretty messy, so let me know if there's some scenario where it still breaks.