Nested templates (within templates)

Answered

Hi, I've been trying to work this out, but I can't! Is there a way to refer to another template inside of another template, with ReSharper Ultimate 2016.1?

Example, Act/Arrange/Assert should be in all tests:

template keyword: aaa

// Act

// Arrange

// Assert

 

template keyword: test

[Test]

public void $TestName$()

{

    <use template aaa as the contents>

}

 

This would be useful as I have more than one test template, and it's unmaintainable to have to update each of them manually when I change something about my Arrange/Act/Assert, such as to make a default assertion or set up test variables I always use.

4 comments
Comment actions Permalink
Official comment

Hello George,

It is not possible in ReSharper, feel free to vote for https://youtrack.jetbrains.com/issue/RSRP-329028 ticket.

Thanks! 

Comment actions Permalink

Thanks Alex. Doesn't look like a popular idea! Never mind, I'll manage.

Meanwhile, it would be a lot less frustrating to edit all those templates if Visual Studio 2015 didn't keep crashing a minute or two after I start editing templates, and restarting. Do you know if there's a solution for that? I use the extension VSVim, which I suspect might be messing with it somehow.

0
Comment actions Permalink

Hello George,

Please try collecting a WinDBG stacktraces of the crash as described here https://resharper-support.jetbrains.com/hc/en-us/articles/206230464-How-to-collect-WinDBG-dump-for-VS-ReSharper-crash-.

Thanks! 

0
Comment actions Permalink

Ok I'll try that next time, thank you.

0

Please sign in to leave a comment.