I would like to find an shortcut that does something like this:
//-------------------------
// like above and beneath
//-------------------------
[ For VS Code: ]
Reworking the snippet from https://stackoverflow.com/a/63440555/836330, try this:
"Custom Comment": {
"prefix": ["cc2"],
"body": [
"//-${1/./-/g}--",
"// $1",
"//-${1/./-/g}--"
]
},
You can bind that to a shortcut too:
{
"key": "ctrl+alt+r",
"command": "editor.action.insertSnippet",
"args": {
"name": "Custom Comment"
},
"when": "editorTextFocus"
}
If you already have the comment line and then later would like to wrap it as you showed, select the comment line first and then use this snippet:
"Custom Comment": {
"prefix": ["cc2"],
"body": [
"//${TM_CURRENT_LINE/./-/g}",
"${TM_SELECTED_TEXT}",
"//${TM_CURRENT_LINE/./-/g}",
]
},