Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 300202

Summary: Add ctr+w - Select successively increasing code blocks - from intellij idea
Product: [Eclipse Project] JDT Reporter: cifroes <cifroes>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r, remy.suen, thatnitind
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description cifroes CLA 2010-01-20 10:43:14 EST
Build Identifier: 

One of the killer features in IDEA is the CTR+W shortcut that successively selects increasing code blocks in a very smart way.

Eclipse doesn't seem to support this so here is the feature request

"Ctrl+W/Ctrl+Shift+W When it comes to precisely selecting a value, expression, statement or any other block of code, these shortcuts are a real killer. Just try it to see how quicker it works than traditional Ctrl+Shift+NavKeys combo."

Reproducible: Always
Comment 1 Dani Megert CLA 2010-01-20 10:47:36 EST
Are you only suggesting to change the keybinding or is there more to it? If so, can you please explain in more detail how the functionality exactly differs (sorry we don't have IntelliJ at hand).
Comment 2 cifroes CLA 2010-01-20 11:27:04 EST
It's not a keybinding issue, it's a new feature (that I believe eclipse doesn't have).

It is a bit hard to explain but I will try :)
Imagine you have this code:
return new JavaScriptResolution(area.getLocationsList().subList(0, limit), Area.class, Point.class);

Set your cursor to getLocat<cursor>ionsList and press ctr+w, "getLocationsList" is selected.
Press again and selection is "getLocationsList()".
Again = "area.getLocationsList()";
again = "area.getLocationsList().subList"
again = "area.getLocationsList().subList(0, limit)"
again = "area.getLocationsList().subList(0, limit), Area.class, Point.class"
again = "new JavaScriptResolution(area.getLocationsList().subList(0, limit), Area.class, Point.class)"
again = "return new JavaScriptResolution(area.getLocationsList().subList(0, limit), Area.class, Point.class);"
again and it selects the if block this was in, then the method, etc...

It's a very smart way to go "up the tree" very easily and quickly. I think it's easy to see the added value and time saved instead of doing "manual selections".
Comment 3 Nitin Dahyabhai CLA 2010-01-20 11:29:55 EST
It sounds very similar to one of the options in the "Expand Selection To" menu, off the main "Edit" menu.
Comment 4 Dani Megert CLA 2010-01-20 11:36:31 EST
>It sounds very similar to one of the options in the "Expand Selection To" menu,
>off the main "Edit" menu.
I've read too fast over "Ctrl+Shift+NavKeys combo." and thought you refer to "Alt+Shift+NavKeys". Please try Alt+Shift+Up/Left/Right.
Comment 5 Markus Keller CLA 2010-01-21 05:27:29 EST
The 'Edit > Expand Selection To' commands are currently based on AST nodes, so we're missing a few of the intermediate steps in your list.

Closing this bug since the general feature is there. See bug 86835 for improvements to the step size.