Vscode: indent back to line start after enter newline and press up

Created on 12 Dec 2017  路  16Comments  路  Source: microsoft/vscode

  • VSCode Version: Code 1.18.1 (929bacba01ef658b873545e26034d1a8067445e9, 2017-11-16T18:32:36.026Z)
  • OS Version: Windows_NT ia32 10.0.16299

Hi, I have a feature request related to intent,

I think Notepad++ and Visual Studio's indent after enter newline and press up works better and more intuitive, it'll remain the indent position, as in the gif:
vsindent gif

But VSCode's indent after enter newline and press up go back to line start, which I think is not so reasonable:
vscodeindent gif

Hope vscode can remain the indent position after enter newline and press up, thank you.

.


Reproduces without extensions: Yes

editor-autoindent under-discussion

Most helpful comment

As a partial workaround you can uncheck the setting "Editor: Trim Auto Whitespace". But it still leaves the problem after document being formatted.

All 16 comments

I desperately want this fixed. Reproduced on macOS with Code 1.24.1 as well.

This issue is extremely annoying. Version: 1.27.1 still have it.

1.28.2 here :(

I didn't had that problem until I formatted my PC, now I have that problem again.
I don't remember how I fixed that before...

Reproduced this with JavaScript code on 1.29.0 (Linux - KDE Neon)

As a partial workaround you can uncheck the setting "Editor: Trim Auto Whitespace". But it still leaves the problem after document being formatted.

Any updates on this issue?

45149 that is closed as a duplicate is very annoying. For example, when typing in JavaScript and going to the new line after the curly braces, the cursor is at the beginning of the new line instead of being properly indented.

Bumbing this one up as well.

It's been a few months now that about third of our team switched to VS Code for as3 and JavaScript coding, and this indent-ignoring in class level causes many false-positive conflicts and file change detections on our GIT, which is disturbing especially when merging... Thanks!

https://github.com/CodeCreator/vscode-indent-to-bracket This may serve as a work around IIUC.

@naresh0839 thanks for the link. This extension helps, but it doesn't take my indentation settings into account.
I have tabs set up in VS Code but it inserts spaces all over the place.

@rebornix was assigned to this well over 2 years ago. Why has there been no word from the team?

this is really annoying, there is any config to fix that? :(

@ramya-rao-a - Can you comment?

Go to File > Preferences > Settings.
Search for "Editor: Trim Auto Whitespace" and disable it. :)

@desromic well, I'd like to trim auto whitespace at the end of the line, so disabling this option is not suitable

I am using ubuntu and this issue is present in Visual Studio Code here too. I think i want it to be like CLion where indentation is always at the current indent level and not go into inline. Much useful. It must be fixed

Issue still there on Windows

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shanalikhan picture shanalikhan  路  3Comments

lukehoban picture lukehoban  路  3Comments

sirius1024 picture sirius1024  路  3Comments

ryan-wong picture ryan-wong  路  3Comments

borekb picture borekb  路  3Comments