Reputation: 1330
Instead of respecting the current block's indentation level, the cursor moves to the start of the new line when pressing the enter key.
{
"name": "foo",
|
}
The cursor should jump to the same level as the name
key.
This happens even with the empty curly brackets.
{|}
Hit enter
{
|}
There doesn't seem to be a setting that can be set so the cursor only jumps to the current indentation level.
Upvotes: 7
Views: 5165
Reputation: 85
It can also happen if you're using the yapf
extension for formatting. Make sure you have "editor.formatOnType": false
.
"[python]": {
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true,
"editor.defaultFormatter": "eeyore.yapf",
"editor.formatOnType": false
}
Upvotes: 1
Reputation: 21
I found that editor.language.brackets
was set to [] in Settings.json. Remove it, and should work as expected.
Upvotes: 2
Reputation: 171
This issue can also happen if you have "files.autoSave": "afterDelay"
. Saving the file moves your cursor at the beginning of the line, if line is empty.
Upvotes: 1
Reputation: 41
For me, the default value of Editor:auto.indent was "full", but I still experienced the issue.
To fix, I needed to re-save Settings (after changing the option twice) to make it work in C#.
Option illustration in VS Code
Upvotes: 4
Reputation: 1330
I kind of fixed this issue by setting the Editor:auto.indent to "full".
Upvotes: 2