Search code examples
macrosresharperlive-templates

Resharper live template macros, removing characters etc


Okay i'm hoping this is a simple one. I've created a simple template for rapidly creating view models and am going to work on another one for the matching views.

I just need to get two variables working correctly from the macros.

First is the class name, this is the same as the file name so as an example.

MyPageViewModel

I can get this working fine.

I have a second variable called PageName in my view model. This is pretty much the same as the file name, only with ViewModel also trimmed off the end.

Is there any way to do this in the resharper live template? Or any alternate way I could achieve the same thing?


Solution

  • Had a similar need and found these extra macros: ReSharperMacros which you install via Resharper>extension manager then search for ReSharperMacros

    Then in your template you can add Value of another variable with suffix removed macro and set the suffix.