The subword-select extension selects the subword the cursor is currently located in.
There are extensions for both Visual Studio and Visual Studio Code that deal with subwords, such as moving between subwords and selecting them, but I've found nothing that allows selecting the subword the cursor is currently located in.
For example, the cursor is located in the variable name
The extension scans for a large variety of special characters. The test cases are shown below.
This extension adds the subword-select command. I've mapped this command to Ctrl+Alt Space for a combination that's easy to get to: all the keys are on the bottom row and on the left side. An even better solution, although I'm not sure if it's technically possible, is to activate this command on the mouse click with a button held down, like Alt or Ctrl. It's something I'm researching. (Appears not: issue #3130, requesting it more than two years ago, is still open.)
However, it should be noted that the coding approach dictates the results in certain cases. For example, activating the command with the cursor in the first subword in
selects the entire variable, except for the dashes. This is because the code scans to the left of the selection point for a special character and finds
Possible Future Enhancements
0.0.1 (April 10, 2018)
Initial release of subword-select.