Make the cursor move down one line when adding a single-line comment in VS Code
In PhpStorm, when you add a single-line comment, the cursor moves down one line. In VS Code, it stays where it is instead of moving down. Because I was used to
In PhpStorm, when you add a single-line comment, the cursor moves down one line. In VS Code, it stays where it is instead of moving down. Because I was used to
In PhpStorm, when you add a single-line comment, the cursor moves down one line.
In VS Code, it stays where it is instead of moving down.
Because I was used to the editor I had been using, this issue was slowing me down, so I'm sharing how to make VS Code handle this the same way as PhpStorm.
Select > Open Default Keyboard Shortcuts (JSON).
{
"key": "ctrl+/",
"command": "extension.multiCommand.execute",
"args": { "command": "commentAndMoveDown" },
"when": "editorTextFocus && !editorReadonly && !editorHasSelection"
},
Add the above. (This needs to be added because IntelliJ IDE is installed.)
https://marketplace.visualstudio.com/items?itemName=ryuta46.multi-command
Install the multi-command extension.
In settings.json,
"multiCommand.commands": [
{
"command": "commentAndMoveDown",
"sequence": [
"editor.action.commentLine",
"cursorDown"
]
}Configure it like this.
Then, when adding a single-line comment, the cursor will move down one line. When commenting multiple lines or commenting with a selection, the cursor will stay in its current position.