Reputation: 3071
I installed code visualstudio 1.54.1 and having some line of code if cursor is located on string
$adImageItemImgProps = AdImage::readAdImageProps($adImageItem->ad_id, $adImageItem->image, true);
inside of readAdImageProps method name, but when no chars selected and clicking hot key all readAdImageProps method name is selected and next clicking hot key AdImage::readAdImageProps is selected. and so on...
In similar way in PhpStorm work hot keys Ctrl+W...
MODIFIED : I manually added proposed key lines in /home/username/.config/Code/User/keybindings.json and see in the file : https://prnt.sc/10lc240 I restarted code visualstudio and "ctrl+shift+alt+w" and this function works in not way I expect. Say I have in control php file with no test selected : https://prnt.sc/10lc53f
When I click "ctrl+shift+alt+w" - it works as I expect only for the first time : https://prnt.sc/10lc77h But not next time when I clcik trhis hot key : https://prnt.sc/10lc7w0 and https://prnt.sc/10lc8xr Is something wrong in my config ?
Thanks!
Upvotes: 0
Views: 92
Reputation: 28633
You can use the extension Select By
It is a 2 phase solution.
editor.action.addSelectionToNextFindMatch
to select the word under the cursorAd this to your keybindings.json
file
{
"key": "ctrl+shift+alt+w",
"when": "editorTextFocus && !editorHasSelection",
"command": "editor.action.addSelectionToNextFindMatch"
},
{
"key": "ctrl+shift+alt+w",
"when": "editorTextFocus && editorHasSelection",
"command": "selectby.regex",
"args": {
"backward": "[a-zA-Z0-9_]+::",
"backwardInclude": true
}
}
Edit
I removed the forward
search because it was taken care of by the no-selection
case.
Upvotes: 1