I'm a big fan of CodeRush and their philosophy around templates. At my current job, we'll be doing a large amount of pairing and the consensus is a preference for ReSharper (v6), which pretty much puts me in a place where I MUST use it.
I'm not looking to start a CodeRush/Resharper war here. There are plenty of things to like about Resharper, but there's one thing I'm having a hard time getting past in ReSharper.
ReSharper's Live template mechanism, wile good, doesn't have built-in notions for typing the way CodeRush does (at least not as I can tell). A simple example is as follows. To gen the following code:
public String MyStringProperty { get; set; }
In CodeRush...I could type "as" ('a' for AutoProperty and 's' for string), then simply change the name of the property.
In ReSharper, I need to type "prop" (for Property), then set the type and and name.
There does not seem to be a similar notion for type awareness or type shortcuts in ReSharper's Live Templates. As such, there doesn't appear to be anything akin to the numerous two and three character templates to get you pre-typed variables, properties, methods, etc...
So, finally the question after all that background. Is there any way to replicate this notion of "typed templates" in ReSharper without creating a new live template for every template/type combination?
Currently, ReSharper does not support the usage pattern you're referring to. However, there are two options I can think of to make this possible.
Note that whichever option you select, you won't get an ability to expand templates by pressing Space — this is simply not possible in ReSharper right now.
Please let me know if you have further questions.
Dmitri
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With