Open TonyBrookILSTU opened 1 year ago
This issue does not surface if you turn off auto-sync, or if you copy and paste correct code into the editor.
I concur, I also lost quite some time figuring this out... Looking up this error brought up this issue and I was able to "fix it" by:
M-Ret
(alt + enter)Yeah, running into this while writing sequence diagrams inline in markdown and using the vscode markdown preview.
Can confirm the same behaviour in IntelliJ Mermaid plugin - closing the diagram a reopening it after having the usage right fixes the issue.
I can confirm this issue also affects the Mermaid plugin in Notion
Description
This is a duplicate of https://github.com/mermaid-js/mermaid-live-editor/issues/1294 but I think the issue is in the core mermaid functionality, not in how the live site handles it.
With the new create/destroy directives for sequence diagrams, the syntax is extremely precise:
These requirements are not the clearest in the documentation, especially when it comes to the order of typing things. As a result, if you type
create participant T
before you typeA ->> T: example
then the code will error and sayError: The created participant T does not have an associated creating message after its declaration. Please check the sequence diagram.
Once this error has occurred, the error will persist in the cache until it is cleared.This presents a serious problem with the functionality of the Live site (and will likely also impact other live viewers like The VS Code extension when it is updated).
The Live site's "auto sync" mode refreshes the diagram after every keypress. In practice, this means that if you manually type in
create participant example
- then the code would detectcreate participant e
and then lock up with an error.I spent about 15 minutes trying to figure out why I kept getting the error for a name I had never used in my diagram, and had deleted all references to.
This issue does not surface if you turn off auto-sync, or if you copy and paste correct code into the editor.
Fundamentally, I believe this is an issue with how the creation / destroy directives are handled. The program should be able to gracefully handle directives that do not have an associated message yet (sort of like putting
participant
oractor
at the beginning of the diagram), and ideally it should handle having the create/destroy being placed anywhere in the diagram (which will be important for #4707 to be implemented properly).Steps to reproduce
(Alternatively, you can paste this code and then delete letters from "Cat" and then re-add them)
Screenshots
No response
Code Sample
No response
Setup
Suggested Solutions
No response
Additional Context
No response