Feature Request: Remove if, while, try statement

How about providing a "Remove if statement" refactoring option when cursor is under an 'if'? Also applies to 'try', 'catch', 'while' etc. Thanks!

0
4 comments

Hi,

ReSharper will provide an option to remove this kind of code only if it's redundant. I beleive removing a needed 'while' cycle can completely break down the logic and workflow of the code.

Thanks.

0
Avatar
Permanently deleted user

Thanks. What I mean is not a ReSharper suggestion to improve code, it's an action deliberately chosen by a coder when construcing code :). Just like I can select lines of code and perform "Surround with". I should be able to reverse that action anytime.

0
Avatar
Permanently deleted user

To reverse a Surround With... simply use Ctrl-W (expand selection) in
combination with copy/paste.

For a simple "if()" statement, put your cursor in the body, hit Ctrl-W until
the entire body of the if() is selected, hit Ctrl-C to copy, hit Ctrl-W
again to expand the selection to the entire if() statement, then hit ctrl-V
to paste.  The body replaces the if(), and you've just "Un-surrounded-with".


"CH Loh"  wrote in message
news:32650232.24061363051750868.JavaMail.devnet@confluence.jetbrains.net...

Thanks. What I mean is not a ReSharper suggestion to improve code, it's an
action deliberately chosen by a coder when construcing code
. Just
like I can select lines of code and perform "Surround with". I should be
able to reverse that action.

---
Original message URL: http://devnet.jetbrains.net/message/5481475#5481475

0
Avatar
Permanently deleted user

Thanks, a workaround if there's no such feature :).

0

Please sign in to leave a comment.