Reputation: 528
WebStorm IDE has a very useful shortcut for selecting text by combination Ctrl + W;
It easy to put cursor for example to one of the arguments in function and press combination twice for select all arguments, first press will select one argument, second - all. And then if you press again, IDE will select all function.
function foo(a, b, c) {}
Summarise, selection increases depending on number of presses shortcut.
VS Code has shortcut Ctrl+D which can select only one argument.
Does anyone know how to add smart selection like in WebStorm to VS Code?
Upvotes: 17
Views: 9176
Reputation: 321
As a comment suggested I tried out https://marketplace.visualstudio.com/items?itemName=k--kato.intellij-idea-keybindings
However, the only real bind that I wanted was the grow and shrink selection commands. That extension will overwrite a lot of the default VScode keybinds. To get just the grow and shrink selections, edit your keybindings.json
file adding the following lines:
{
"key": "ctrl+w",
"command": "editor.action.smartSelect.grow",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+w",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
}
*edit: Using version 1.26.1
Upvotes: 22
Reputation: 16089
This is possible without an extension with the command "Expand select", editor.action.smartSelect.grow
, which by default is "ctrl+shift+cmd+right"
Upvotes: 24
Reputation: 7906
This is not supported natively but is possible via extensions.
For example the Hot Commands extension
Edit.IncreaseSelection
Expands the current text selection by one level (ie. next largest code block level) Ctrl+{, Ctrl+}
Edit.DecreaseSelection
Shrinks the current text selection by one level (ie. next smallest code block level) Ctrl+{, Ctrl+{
More suggestions in this previously answered question
Upvotes: -2