Refactor extract method Expressions Selection

Is there a way to create a keymap or anything to select an expression and not just keyword or having to use expand selection a 100 times. 

For instance when I do extract routine and my cursor is on “cast”, this pops up. When you use arrow keys up and down the selection changes. This is incredibly useful, BUT as soon as it closes, the selection is lost. 

Can we either get “select expression” keymap without the dropdown that selects the first item on the list or a pop up like this, but selecting it just highlights it. 


Hi Amalishkin  

You can use the extended selection CTRL + W which should extend the highlighting portion one after another and it won't prompt you with a drop-down so you can keep your focus on the code fragment you're working with.


Not the same thing. CTRL+W selects words after words.. The above example selects full expressions. 

Take for an example this statement. 

select cast(CreationDate as datetimeoffset) at time zone 'UTC' at time zone 'Mountain Standard Time' as TestDate

I have my cursor on CreationDate, and i want to select the entire expression without “as” . Yes i can manually highlight and count parentheses, etc, but selecting expressions it's easier. 

So I'm pressing ctrl+w and pasting the results here

1. CreationDate

2. CreationDate as datetimeoffset

3. (CreationDate as datetimeoffset)

4. cast(CreationDate as datetimeoffset)

5. cast(CreationDate as datetimeoffset) at time zone 'UTC'

6. cast(CreationDate as datetimeoffset) at time zone 'UTC' at time zone 'Mountain Standard Time'

So it took 6 times, more if i had the cursor on a parentheses 

With expression selection, I get the following choices:

I press #3 and that's it. 2 keys, not 6-9 

This is a simple statement too. If CTRL+W would select expressions, that'd even be more ideal since there doesn't need to be a dropdown. 



Please sign in to leave a comment.