VS Code
if (1 == 1) // When I hit enter here, the cursor moves to the next line at pos (0)
|
else
return; // When I hit enter here, cursor moves to next line/ pos 4
| // why is the cursor here? why not pos 0?
Visual Studio (this is what I want to happen)
if (1 == 1) // When I hit enter here, the cursor moves to the next line at
| // pos 1 if I'm working with Tabs or pos 4 for spaces)
This is not a problem in VS Code if you use braces like this:
if (1 == 1){
return;
}
However, I don't like to use braces in those scenarios, and if I don't, VS Code naturally makes me end up writing this code which is also bad
if (1 == 1)
return;
I'm trying to get the same behaviour in VS Code. I can't seen to find a setting for this, or an extension. Please help. If I have to make an extension, or update the VS Code source and build it myself, I'm up for that, just please point me to the right direction. This is annoying.
You can create code snippet. F1 "usn" => choose language >>
"if": {
"prefix": "if",
"body": [
"if ($1)",
"\t$2",
"$3"
]
},
"ifelse": {
"prefix": "ifelse",
"body": [
"if ($1)",
"\t$2",
"else",
"\t$3",
"$4"
]
},
Just in case add this to settings.json
ctrl+,:
"editor.snippetSuggestions": "top",
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With