Unwrap/Remove code statements in JavaScript

Sometimes when you are editing JavaScript, you need to remove, say, an enclosing if or else statement without touching a current code block. This normally requires going back and forth and deleting something.

But in Web IDE you can just invoke Code -> Unwrap/Remove… action (Ctrl+Shift+Delete / ⌘⇧⌦), which allows to precisely select which construct to unwrap depending on where your caret is. Below is the example screenshots.

What if we unwrap the 1st ‘if…’ block from the above screenshot?

Voila! The edited code block is unwrapped and in place! That’s really fast.

BTW, this very useful action works in HTML/XHTML files as well, where it removes enclosing tags instantly.

Develop with pleasure!
-JetBrains Team

This blog is permanently closed.

For up-to-date information please follow to corresponding WebStorm blog or PhpStorm blog.

This entry was posted in Cool Feature, PhpStorm, WebStorm and tagged , , , , . Bookmark the permalink.

One Response to Unwrap/Remove code statements in JavaScript

  1. Zyava says:

    Great! Is it possible to add this feature for php code too?

Comments are closed.