小编Mar*_*vid的帖子

VS Code - 键绑定 - *type* 命令的光标位置

我使用的是 VS Code 版本:1.40.0。

为了加快我的开发速度,我需要设置自己的键绑定以在代码中输入特定文本(“ {|print_x} ”)。我设法做到了这一点,但如果我粘贴文本后类型光标立即跳到“ { ”之后,那就更好了。

所以:{ 这里输入光标 |print_x}

keybindings.json中的代码:

 { 
    "key": "shift+alt+y", 
    "command": "type",
    "args": { "text": "{|print_x}", },
    "when": "editorTextFocus" 
}
Run Code Online (Sandbox Code Playgroud)

我认为使用这样的数组可能会起作用,但不幸的是文本参数需要是字符串。

   "args": { "text": [ "{" , "|print_x}" ], }
Run Code Online (Sandbox Code Playgroud)

有办法做到吗?如果是这样,我将非常感激。

keymapping key-bindings cursor-position visual-studio-code vscode-snippets

1
推荐指数
1
解决办法
1109
查看次数