简体   繁体   中英

VS Code insert semicolon at the end of the line and create a new line

What do I want

It is just for comfort but I am searching for a feature in VSCode to insert a semicolon at the end of the current line, while the cursor is still in the middle of the statement. IntelliJ has that Feature. ( crtl + shift + enter )

What I have tried so far:

  • Installed and enabled IntelliJ IDEA Keybindings.
    • The problem I have is that crtl + shift + enter does only complete the statment if autocomplete has an suggestion. But there is no suggestion add semicolon at the end of the line.
    • shift+ crtl + enter does start a new line but there is still no semicolon at the end

If I you need more information please let me know...

Thanks to rioV8 for the help with Multi Command.

I added the following snippet to the settings.json:

"multiCommand.commands": [
        {
            "command": "multiCommand.addNewLine",
            "sequence": [
                "cursorEnd", 
                {"command": "type", "args": {"text": ";\n"}}

            ]
        }
    ]

Than I was able to bind a keybinding to that command in the keybindings.json.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM