Description
Is your feature request related to a problem? Please describe.
For some relatively complex snippets, they're much more pleasant to insert with the snippet feature than update once they exist. This is also useful for snippets with choice
fields, especially if they're not single choice or if snippets are enhanced to support other, more complex fields.
Describe the solution you'd like
I would like to be able to highlight a snippet, click the snippet button, and - if the snippet supports editing in place - be able to view the snippet in the modal view again for editing.
I would like to be able to define a snippet similar to this (everything but the new editing key is from a real snippet):
I think there could be some performance considerations here, but:
- The sorts of snippets that this would most benefit from are ones that don't have extremely long blocks of text.
- The regex should always be iterating over highlighted text, not the whole file.
- Each check is likely very small.
Describe alternatives you've considered
I think it should be possible to define a script which analyzes the highlighted text against the defined snippets, break out the values, open the new snippet dialogue, prepopulate the fields with the values already defined, then replace the highlighted text when you insert. This is probably okay but it would be better to have some explicit support for this in the extension or a document describing how to accomplish this so people could self-implement.
Additional context
By way of example, I'd like to go from this markdown (snippet highlighted before either clicking the snippet button in wysiwyg or right clicking for context menu or using the command pallette):
<!-- broken across lines for readability -->
{{<
art src="https://cool.art/arachnid.png"
alt="An illustration of a spitting spider waving its forelegs menacingly."
class="foo bar"
content_warning="Spiders"
/>}}
To this UI: