Widen

I’m not sure what the W, means, but it has always been “Widen” for me.

It is ⌘-W on the Mac of course. All the JetBrains IDEs have the feature. First in Intellij in 2001, and PhpStorm, PyCharm, AppCode, RubyMine, WebStorm in the last few years.

If you place the cursor/caret in some code …

And press Control-W …

Every time you press Control-W it expands the selection scope to boundaries that make sense. In this case, it’s Java in a fluent style, and the scope widens to method boundaries. Pressing it again:

Widen …

Widen, widen, widen …

It’s a perfect compliment to refactoring, and it knows what boundaries in the source make sense for the each “widen” action.

If you do Control-Shift-W (⌘-Shift-W on the Mac) the selection context shrinks in the same way. Un-widen if you like.

I Wish…

This should be in all apps. On the Mac, ⌘-W is close window, but I wouldn’t mind losing that for ever in all apps, if what I got was “widen” to the same level of perfection as JetBrains have made it. A colleague showed me Sublime yesterday, and it has the same thing but it is not infallible like JetBrains’ implementation is.

I’d love it if JetBrains made a generic, fast-load text editor in the style of TextMate and Sublime. Hell, I’d love it if they made a MS-Word equivalent, just to get this feature. Of course they pioneered the building and concurrent maintenance of an Object Model representation of the code. Before that moment there was only Borland JBuilder, Symantec Visual Cafe, and Visual-Age for Java. None of them had object model representations of the source code (including uncompilable source). That was their stroke of genius, and it requires a larger memory footprint to maintain, but it’s so worth it. Even if ‘just’ for Control-W.



blog comments powered by Disqus

Published

February 7th, 2014
Reads: