Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better scratch file support #90

Closed
michael-pratt opened this issue Oct 30, 2022 · 5 comments
Closed

Better scratch file support #90

michael-pratt opened this issue Oct 30, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@michael-pratt
Copy link
Contributor

Currently, the default file type for Excalidraw on the scratch menu is a JSON type, which causes the IDE to open a new JSON editor instead of a diagram editor. As an enhancement, it would be nice if the scratch file menu instead opened a diagram editor so users could go straight to the Excalidraw UI.

@michael-pratt
Copy link
Contributor Author

I have a proposed solution for this, will open a PR after a bit more testing.

@bric3
Copy link
Owner

bric3 commented Dec 8, 2022

Possibly fixed by #91

@xuanswe
Copy link

xuanswe commented Feb 27, 2023

Possibly fixed by #91

Not sure if that's the fix for the error I have now.

When open scratch file

java.lang.Throwable: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
	at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:219)
	at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:305)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:717)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:717)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:722)
	at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:304)
	at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:351)

When close scratch file

Unhandled exception in [StandaloneCoroutine{Cancelling}@4a92e9d9, Dispatchers.Default]

java.lang.AssertionError: Not alive: Lifetime `Anonymous` [Terminating, executing=0, resources=4]
	at com.jetbrains.rd.util.lifetime.RLifetimeKt.assertAlive(RLifetime.kt:524)
	at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController.runJS(ExcalidrawWebViewController.kt:349)
	at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController.saveAsCoroutines(ExcalidrawWebViewController.kt:333)
	at com.github.bric3.excalidraw.editor.ExcalidrawEditor$saveCoroutines$1.invokeSuspend(ExcalidrawEditor.kt:210)
	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:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelled}@4a92e9d9, Dispatchers.Default]
IntelliJ IDEA 2022.3.2 (Ultimate Edition)
Build #IU-223.8617.56, built on January 26, 2023
Runtime version: 17.0.5+1-b653.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 32
Registry:
    editor.minimap.enabled=true

Non-Bundled Plugins:
    com.github.bric3.excalidraw (0.3.2)

Kotlin: 223-1.8.0-release-345-IJ8617.56

@bric3
Copy link
Owner

bric3 commented Feb 28, 2023

@xuan-nguyen-swe These errors are unrelated to scratch file support.

The not alive error is one of the error I don't quite know how to tackle. I believe you can dismiss it.

However the first one is an error from the excalidraw embedded app.

Uncaught SyntaxError: Unexpected end of JSON input

The message suggests the file is possibly invalid, or that it cannot be read by the embedded excalidraw for some reasons.

@bric3 bric3 added the enhancement New feature or request label May 9, 2023
@bric3 bric3 mentioned this issue Jan 9, 2024
9 tasks
@bric3 bric3 added this to the 0.4.0 milestone Jan 9, 2024
@bric3 bric3 closed this as completed in d89c2c1 Jan 9, 2024
@bric3
Copy link
Owner

bric3 commented Jan 9, 2024

@xuan-nguyen-swe @michael-pratt Scratch file creation is now fixed. It'll be in 0.4.0. Still quite a few things to do.

2024-01-09 01:00:04,421 [ 757800] SEVERE - #com.github.bric3.excalidraw.editor.ExcalidrawWebViewController - scratch.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
java.lang.Throwable: scratch.excalidraw: [LOGSEVERITY_ERROR][https://excalidraw-jetbrains-plugin/index.html:1]:
Uncaught SyntaxError: Unexpected end of JSON input
    	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:370)
    	at com.github.bric3.excalidraw.editor.ExcalidrawWebViewController$initJcefPanel$5.onConsoleMessage(ExcalidrawWebViewController.kt:202)
	at com.intellij.ui.jcef.JBCefClient$3.lambda$onConsoleMessage$4(JBCefClient.java:305)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.lambda$handle$0(JBCefClient.java:719)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handle(JBCefClient.java:719)
	at com.intellij.ui.jcef.JBCefClient$HandlerSupport.handleBoolean(JBCefClient.java:724)
	at com.intellij.ui.jcef.JBCefClient$3.onConsoleMessage(JBCefClient.java:304)
	at jcef/org.cef.CefClient.onConsoleMessage(CefClient.java:354)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants