Custom Patterns removing comments and whitespace

I've added a pattern to ReSharper:

try
{
    $code$
}
catch (Exception $exception$)
{
    Logger.Log(new LogItem(this, $exception$));
    throw $exception$;
}

I've used a replace of '$code$' (to remove redundant logging calls) which works great for removing the try / catch and logging, but it also removes any comments and blank lines within the code.

Can this be controlled by a setting? Is there another way to write the pattern to allow for blank lines and comments? Perhaps we need a new type, 'code block', so these things can be captured.

3 comments
Comment actions Permalink

Hello Matt
     Which version of ReSharper are you using? Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0
Comment actions Permalink

Hello Matt
     This is actually a known problem and you're welcome to vote for this request: http://youtrack.jetbrains.net/issue/RSRP-274520. Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0

Please sign in to leave a comment.