Is there a way to delete if clause keeping its body with a hotkey?

I have a code like

if (someCondition)
    doThat();
}

And want to remove if (someCondition), but leave doThat() invocation. I'd like to do it with a single hotkey when caret is on "if" keyword. I want to do the same trick with for, while etc. Is that possible, or should I file a issue request?

9 comments
Comment actions Permalink

Ctrl-Shift-Delete (called "Unwrap..." action)

0
Comment actions Permalink

Max Ishchenko wrote:

I have a code like

     doThat();
> }
> ]]>

And want to remove if (someCondition), but leave doThat() invocation. I'd like to do it with a single hotkey when caret is on "if" keyword. I want to do the same trick with for, while etc. Is that possible, or should I file a issue request?

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

Not as far as I know, and this is something I've wanted too for a long
time...
N.

0
Comment actions Permalink

control + shift + delete

Max Ishchenko wrote:

I have a code like

     doThat();
> }
> ]]>

And want to remove if (someCondition), but leave doThat() invocation. I'd like to do it with a single hotkey when caret is on "if" keyword. I want to do the same trick with for, while etc. Is that possible, or should I file a issue request?

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



--
Best regards,
   Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Yeeehaah! I knew that ) Thanks, guys

0
Comment actions Permalink

Taras Tielkes wrote:

Ctrl-Shift-Delete (called "Unwrap..." action)

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

Excellent!

0
Comment actions Permalink

I have been using IntelliJ for over 5 years and did not know about this shortcut! It would have saved me much pain over the years...

I will make good use of it for now on!

0
Comment actions Permalink

The same story for me.
Try looking through Help -> Productivity Guide and find some goodies you never used because never knew that it is possible. Though "Unwrap" intention is not listed there.

0
Comment actions Permalink

Indeed, it's a good candidate for the tips that show during compiles.

0
Comment actions Permalink

TarasT wrote:

Indeed, it's a good candidate for the tips that show during compiles.

And/or a "Tip of the Day".

0

Please sign in to leave a comment.