Failed to generate a preview for 'Xyz.flow-meta.xml'

Issue #2483 resolved
Phil W created an issue

I’ve installed the latest Mermaid plugin and tried opening several of our flow metadata files. Some render, but others do not, instead showing the error:

Failed to generate a preview for ‘Xyz.flow-meta.xml’: Argument for @NotNull parameter ‘value’ of com/illuminatedcloud/intellij/mermaid/FlowToMermaidConverter.getValueText must not be null

I’ve attached an example of one that fails.

Note that I have also found that the preview for a large and complex flow is too small to read, and zooming in/out does not function.

Comments (10)

  1. Scott Wells repo owner

    The next build should address the NPE and also addresses the zooming issue…kind of. The zooming issue seems to be with the native browser and how it’s embedded for preview of Mermaid diagrams. I saw a property that might help allow better zooming of large diagrams directly in the preview window and will be investigating it, but in the interim, I’ve also added an “Export Diagram as PNG” action that retains the full diagram fidelity. For example, I’ve attached the PNG for this diagram here.

    I may release this build tomorrow. If not, it will be released next week once my kids are back in school after the break.

  2. Phil W reporter

    I like the export to SVG that’s already there though the PNG option is handy for when an SVG viewer isn’t available. On a different note, it’s a shame Mermaid creates diagrams with such messy layout. Any way you could leverage the x/y positioning from the XML to help align the layouts? (I guess there could be issues because Salesforce provides stub links when lines would have to cross and this may cause problems with Mermaid being unable to draw the lines without going behind other element boxes. I guess the other problem is that you are putting a lot more detail in the boxes compared with the Salesforce Flow Builder.).

  3. Scott Wells repo owner

    The good news is that I’ve figured out to work around the issues with zoom in/out in the diagram itself for the most part. I actually have to mess with the resulting CSS dynamically, but it works. The only down-side is that right now it also scales the horizontal and vertical scrollbars. I may be able to constrain that using CSS as well…we’ll see.

    As for Export to SVG action, I've actually disabled that in favor of the Export to PNG action in the next build. The SVG action is just fundamentally broken due to vertical truncation. I've provided some feedback on how to fix it to the Mermaid plugin maintainers, but until they fix it, it's probably better to have one export-to-image action that actually works instead of two where one is broken.

    As for the Mermaid diagram layout, there's not much opportunity to tune it. You can see the syntax and options here. I tried to use the new experimental elk renderer but don't see any difference. My guess is that either the Mermaid plugin is not using Mermaid 9.4+, or is not allowing elk to be used for whatever reason.

    Note that you can toggle node details off from the toolbar if you just want to see the general flow. It's pretty much an all-or-nothing proposition right now with regard to details. Based on feedback, I may allow more selective enabling/disabling of node details in the future so that users can dial in the desired level of detail.

  4. Phil W reporter

    An IDE and “project-level” definition of presets for the detail to show would be ideal. We would define one for our project and include it in git with things like the code style etc. and set it as the default preset. If you would, pretty please, include this 😃.

  5. Scott Wells repo owner

    Okay, I figured out how to use the newer experimental elk renderer, and it does show promise in terms of more compact layouts. I've attached a sample image here. There seem to be two notable issues, though, that would prevent me from cutting over to it at present. First, as evidenced in the attached image, it has some issues with node text truncation. Second, it doesn't respect the specified theme at all and only really works with a light theme.

    If/when I add more configuration options -- which ties into your request for more fine-grained specification of which details should be shown per-node type -- I'll likely include an option to use elk as the renderer for those who want to give it a go.

  6. Phil W reporter

    I can say I do prefer the elk presentation over the original format (curved lines look messy).

  7. Scott Wells repo owner

    After playing with these options for a bit, it really depends on the diagram. For more complex diagrams like the one you provided, I agree completely; for simpler diagrams – even those with loops, branching logic, etc. – I think curved connectors do look better. And therein lies the whole subjective nature of such a discussion. As a result, I’m going to get all of the current enhancements and fixes out in a build tomorrow morning, but here’s what I’ve also included in that build’s release notes regarding where I’m taking this in the short term:

    Other things I'm either actively working on or at least considering for this feature:

    • Navigation to the original Flow XML elements when the corresponding diagram nodes are clicked, but there are numerous layers of indirection with Mermaid executing in an embedded browser executing in the IDE's UI framework, and conveying the click event back to the IC2 plugin is proving to be a bit elusive right now. I'm sure it's possible, though, and I hope to have it figured out in short order.
    • Adding more extensive user-configurable options for Flow diagram rendering including:

      • Which specific details of each node type are included instead of the current binary show/hide details toggle.
      • Node connector curve style; I've experimented with each of the available styles and some do seem to produce slightly cleaner diagrams, but this is obviously a purely subjective type of thing and therefore lends itself well to being configurable.
      • Node type colors for light and dark themes.
      • Enabling Mermaid's new, experimental elk flowchart renderer; again, I've experimented with it a bit and it does produce (subjectively) more compact and clean diagrams, but since it's still in an experimental state right now, it also seems to have some issues to be addressed before switching over wholesale, e.g., it doesn't respect dark themes, and it doesn't seem to respect the specified graph direction completely.

    The latter section describes pretty extensive configurability options that should hopefully allow each user to tune the resulting diagrams as desired.

  8. Phil W reporter

    As always, I’m loving how you’re dealing with this, and really appreciate the time and effort you’re putting in. I look forward to each and every improvement!

  9. Log in to comment