Usage Case:
- a snippet contains multiple placeholders, one of which is
$SELECTION - in the event that no text is selected when the snippet is executed, the
$SELECTIONplaceholder should display an alternate value which: - provides information as to its purpose
- acts as a visual indicator so that the value is not accidentally left blank
Implementation:
- returns
$SELECTIONif it exists - otherwise, returns
__PLACEHOLDER__

This mostly works:
<snippet>
<tabTrigger>test_Selection_PlaceHolder</tabTrigger>
<description>test_Selection_PlaceHolder</description>
<content><![CDATA[
Selection_Or_PlaceHolder = "${1:$SELECTION}${1/(.+)|(^(?![\S\s]))/(?1)(?2__PLACEHOLDER__)/}"
]]></content>
</snippet>
The only issue is that __PLACEHOLDER__ is not inserted as a ( selected ) tab stop.
I also tried:
Selection_Or_PlaceHolder = "${1:$SELECTION}${1/(.+)|(^(?![\S\s]))/(?1)(?2${1:__PLACEHOLDER__})/}"
but it just returns the literal string: ${1__PLACEHOLDER__}
( which is missing the : after 1 )
It seems like it might be tricky to nest a placeholder within the substitution, since both of them reserve $ as a special character.
As a [ side note | feature request ]:
It would be pretty useful if we could just use something like:
${1:$SELECTION/__PLACEHOLDER__}

