Problem: I'm looking for a way to create complex snippets. At our company we have larger functions which almost seem boilerplate-ish, and I feel can be made much easier.
Desired solution: I want to create something, similar to how snippets work, but suitable for more complex generation of code. For instance, see the following code, which is typical for what we generate:
private readonly DependencyOne dependencyOne;
private readonly DependencyTwo dependencyTwo;
public ClassName(DependencyOne dependencyOne, DependencyTwo dependencyTwo)
{
this.dependencyOne = dependencyOne;
this.dependencyTwo = dependencyTwo;
}
Basically I only want type the two classnames, and from that generate the constructor and the two associated fields. If possible I want to add these fields at the correct position in the code, pretty much like how IntelliSense's Quick Fix automatically finds the correct position in your code to place the fields.
The reason why I can't just generate it above the constructor, is because there are some methods which will be generated which aren't constructors and therefore don't reside on the top of the code.
How do I achieve this desired solution?