VSCode 行尾添加分号并换行

RuioSuio

1. VSCode的扩展中安装macros

2. settings.json 内添加下列代码:

"macros": {
    "addSemicolonToLineEndAndThenWrap": [
        "cursorLineEnd",
        {
            "command": "type",
            "args": {
                "text": ";"
            }
        },
        "editor.action.insertLineAfter"
    ]
}

3. keybindings.json 内添加下列代码:

{
    "key": "shift+enter",
    "command": "macros.addSemicolonToLineEndAndThenWrap",
    "when": "editorTextFocus && !editorReadonly"
}

若要实现其他功能可自行修改。参考网址:
macros概述
VSCode键盘绑定

阅读 127
1 声望
0 粉丝
0 条评论
你知道吗?

1 声望
0 粉丝
宣传栏