当前位置:网站首页>Vscode automatically adds a semicolon and jumps to the next line

Vscode automatically adds a semicolon and jumps to the next line

2022-07-07 04:44:00 iesoxj

add to Macros plug-in unit

Add settings to settings.json

Ctrl+, Open Settings

Input : code action on save . And open settings.json

Insert the following code :

"macros": 
    {
        "end_semicolon": //  Add a semicolon at the end   Line break 
        [              
            "cursorEnd",
            {
                "command": "type",
                "args": {"text": ";\n"}
            },
            //{"command":"editor.action.insertLineAfter"},   // You can also use the command line feed 
        ],

        "end_colon":  //  Colon at the end   Line break 
        [
            "cursorEnd",
            { 
                "command": "type",
                "args": {"text": ":\n\t"}
            },
        ],
    }

Add user shortcuts  keybindings.json

stay C:\Users\Administrator\AppData\Roaming\Code\User Under the new  keybindings.json file

[
    {
        "key":"alt+;",
        "command":"macros.end_semicolon"
    },
    {      
        "key": "alt+shift+;",      
        "command": "macros.end_colon"
    }, 

]

原网站

版权声明
本文为[iesoxj]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130756086325.html