There’s no existing way. There’s however a way and it involves parsing the json and creating the xml needed.
You can use the schema reference link to see json <-> xml, snippet, equivalent.
In other words, make it yourself. Should be fairly easy given that all the details are already documented by Microsoft.
Next day edit:
Take a look at this gif I made
. It replicates partially replicates the vscode snippet inside visual studio.
Also, the snippet xml code:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>varsetget</Title>
<Shortcut>varsetget</Shortcut>
<Description>Code snippet testing</Description>
<Author>Dorian</Author>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>the var type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>VARNM</ID>
<ToolTip>the var name</ToolTip>
<Default>VARNM</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
$selected$$type$$end$ $VARNM$;
$type$ $VARNM$(){return $VARNM$;}
void $VARNM$($type$ val){$VARNM$ = val;}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
To be able to use it, create a *.snippet
file wherever you want on your machine with the code above, then:




Navigate and open the *.snippet
file you created



You can now test out the snippet
NOTE: In Visual Studio 2019 the default of inserting a code snippet or moving to the next Declaration
Literal
is pressing Tab
twice as opposed to Visual Studio Code, where only one Tab
is needed.
Everything I wrote is from the msdocs or deducted from the examples there.
My last edit:
It looks like you're not out of luck. But I do not have the time to investigate/test further, sadly. https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.package.expansionfunction?view=visualstudiosdk-2019
Also, according to this SO post you basically would have to create your own language, which I personally doubt.
PS: How come the guys at MS q&a didn't suggest this I do not understand...