Visual Studio代码快捷方式,等同于Webstorm/IntelliJ扩展选择

Nik*_*Nik 7 intellij-idea webstorm visual-studio-code

我已经习惯了Webstorm的" 扩展选择 "快捷方式,它将选择范围扩大到下一个特殊角色.

示例(如果光标位于"someObjectProperty"中的某个位置并且快捷方式已激活):

var foo = someObject.someObjectProperty.subProperty;
                     <-- selection 1 -->
          <------ selection 2 --------->
          <-------------- selection 3 ------------>
Run Code Online (Sandbox Code Playgroud)

现在我已经切换到Visual Studio Code,最接近我找到的那种类型的快捷方式是' editor.action.smartSelect.grow '快捷方式

然而,虽然它是相似的,但它并不相同.使用相同的示例(如果光标位于"someObjectProperty"中的某个位置并且快捷方式已激活):

var foo = someObject.someObjectProperty.subProperty;
       <---------------- selection 1 -------------->
<------------------- selection 2 ------------------>
Run Code Online (Sandbox Code Playgroud)

如上所述,VS Code中是否有与WebStorm中的Extend Selection类似的内容?

Nik*_*Nik 6

虽然VS Code没有这样的快捷方式/命令,但可以轻松安装第三方扩展:

ext install expand-region
Run Code Online (Sandbox Code Playgroud)

有关expand-region命令的更多信息:

https://marketplace.visualstudio.com/items?itemName=letrieu.expand-region


Lav*_*iet -1

您正在寻找的功能称为收缩扩展选择。

它的工作原理是使用:

ALT+ SHIFT+选择下一部分

ALT+ SHIFT+选择前面的部分

对于您的示例,其工作原理如下(想象光标位于 someObjectProperty 的 j 上):

var foo = someObject.someObjectProperty.subProperty;
                         <-S1-> (This section exists because of camelCase)
                     <-    S2        ->
          <-               S3        ->
          <-               S4                    ->
<-                         S5                     ->
Run Code Online (Sandbox Code Playgroud)

供参考: https ://code.visualstudio.com/docs/getstarted/tips-and-tricks#_shrink-expand-selection