figma / code-snippet-editor-plugin

Translate component variants, properties, and more into dynamic code snippets for your design system.
https://www.figma.com/community/plugin/1311777988952403297/code-snippet-editor
MIT License
126 stars 11 forks source link

? and ! statements spread across multiple lines #13

Closed mikeysouthwell closed 5 months ago

mikeysouthwell commented 5 months ago

I'm trying to create a MAUI XAML block of code when clicking on a Frame.

So for example I would want the tag to be hidden if the node.type is NOT a frame.

I could put {{?node.type=frame}} before each line, but I also want it to hide all the code inside the code block.

Is there a way span the {{?node.type=frame}} statement across muliple lines to indicate when it starts and finishes?

Current approach:

{{?node.type=frame}} {{?node.type=frame}}{{?css.height}}HeightRequest="{{css.height}}" {{?node.type=frame}}

Ideal approach (just one of many examples):

{ {{?node.type=frame}} {{?css.height}}HeightRequest="{{css.height}}" }

{{?node.type=frame}} {{?css.height}}HeightRequest="{{css.height}}" {{?node.type=frame}}

jake-figma commented 5 months ago

See #14 For how I think you should handle this. Essentially, you should hardcode your frame template into your own version of this codebase if youre creating global templates like this and conditionally rendering on node.type.

Point taken though on the idea of blocks for the conditionals. I want to see how long I can go before implementing something that spans lines. One strength of the language is that each line is rendered in complete isolation which makes it a lot simpler to write and process.