Comment continuation (copy `//` to next line on enter) in VS Code?

This used to be part of rust-analyzer, but it was causing problems. When rust-analyzer crashed or was slow, any enter press would be delayed for several seconds or never happen at all:

https://github.com/rust-analyzer/rust-analyzer/issues/4052

If you want you can add a keybinding:

"Preferences: Open Keyboard Shortcuts (JSON)"

[{
    "command": "rust-analyzer.onEnter",
    "key": "enter",
    "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
}]
4 Likes