Steps to Reproduce:
As of the 1.14 update, typing JS code has really annoying indentation behavior. I can't figure out why it changed and I can't find any relevant settings to try to change.
To reproduce, type this:
if (cnd) <enter> {
Expected result (pre-1.14):
if (cnd)
{
Observed result (1.14):
if (cnd)
{
This is the worst indentation style!
@mjbvz do you think our indentNextLinePattern is a little bit unnecessary for TypeScript/JavaScript ? It seams that this pattern is bothering ppl instead of helping them out most of the time as writing brackets around blocks is more common.
Related issues https://github.com/Microsoft/vscode/issues/31027
I think enough libraries and developers do write single statement ifs that removing indentNextLinePattern entirely will be more annoying. Can we modify the regex to work around this?
@mjbvz I'm thinking about taking one step back on indentOnType. Usually the only time that indentOnType kicks in and helps you out is when the content matches decreaseIndentPattern. Maybe a workaround here is only adjust the indentation when it matches decreaseIndentPattern otherwise users decide what the indent level they want.
Right now I don't know how to make the regex aware of context in this case.
Yes I think the expected behavior here would be to indent the next line only if there is no other content after the cursor. Would we be able to achieve that without indentNextLinePattern?
Expected behaviour should be same as pre 1.14, please.
I am having this exact same issue, but i can't find the indentNextLinePattern setting. Also its only happening if I have a project open, opening JavaScript files outside of a project it works fine.
Does anyone know what feature addition/change caused this to occur? I'm interested in understanding why this change came in as it impacts me every time I write control flow code (if, for, while, etc.). This has been a _constant_ source of frustration with TS/JS files since the 1.14 release (am currently on 1.14.2).
A temporary work-around is to downgrade to version 1.13.
OK, I'm back - I don't have any setting with indentNextLinePattern - I'm now on 1.14.2
@rebornix Why can't the _feature_ that was added in 1.14 be removed - this is really annoying
@mjbvz you marked this as duplicate with #31272 and closed it, then you went and close #31272 and marked it as duplicate with this.
Most issues are pointing to this one as the real one.
@davidstlyoui This issue hasn't actually been closed. I think Github is just displaying the duplicate message incorrectly for this issue.
indentNextLinePattern is an internal configuration name. There is no user setting to change it
@rebornix Have you had a chance to take another look into this issue?
@simonl65 It looks like he closed it as part of this commit. It looks like typing "Fixes [Issue #]" into the commit message will also _close_ that issue as part of the workflow. See this help page.
@simonl65 I closed this issue with a change that should resolve the problem. Please try it out in the next VS Code insiders builds
I just learned something! Thanks - I'll give that a try when vscode next updates.
Hmm, so I couldn't wait - I downloaded the insiders build (1.15.0-insider)!
Sorry to say - it's worse! I now get the following:
if(x)
{
...that's four spaces before the { (1.14 only gave 2 spaces)
If it helps, my non-default settings are:
{
"editor.insertSpaces": false,
"editor.tabSize": 2,
"workbench.sideBar.location": "left",
"editor.wordWrapColumn": 82,
"editor.renderIndentGuides": true,
"editor.rulers": [
82,
120
],
"window.zoomLevel": 0,
"workbench.iconTheme": "vscode-great-icons",
"workbench.colorTheme": "Visual Studio Dark",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}
This is a clean install of 1.15.0-insider - no extensions added.
What have I missed?
Question: Why can't the auto-indent stuff just revert to how things were in 1.13 - that worked fine?
@simonl65 This change just went in and is not yet in any build. You need to wait for the next nightly insiders build to pick up this change
@mjbvz Oops - over eager! Will try it tmz. Thanks for your efforts 👍
@mjbvz Sorry to say: it's not changed - still indenting the {.
BTW: Correct behavior in PHP - this affects JS & TS.
This is a real PITA
@simonl65 Please record a gif of exactly what you are seeing. Here's what I see:

@mjbvz Not sure how to ad a gif, so here are the steps:
if(1)enteri of if{enterif(1)
{
|
}
Expected result:
if(1)
{
|
}
@mattbierner This is on the insiders build (1.16.0), I believe it's the same issue.

The original issue still reproduces in 1.15. It is not fixed!

watch me shift these lines down. ^. it expected that these lines _do not_ get indented on shift.
doh! is this the correct place for this report, @mjbvz, or shall i add my GIF elsewhere?
thx :)
@Rxswyers Yes. That is exactly the issue. It is truly frustrating.
@cdaringe I'm not sure that's the same issue - I guess you're using ALT + downArrow?
I don't get that in a javascript file either - which language mode are you in?
Can someone re-open this issue since it is not fixed? Otherwise I will probably file it again. It's really annoying.
@simonl65
ALT + downArrow?
yep!
I don't get that in a javascript file either
javascript language setting.
The original reported issue was fixed. I've opened #32653 to track to track the other case discussed in the comments
@mjbvz But that isn't the case at all. Here's what the original reported issue read as:
To reproduce, type this:
if (cnd)<enter>{Expected result (pre-1.14):
if (cnd) {Observed result (1.14):
if (cnd) {
As explained in many subsequent comments, this is still an issue.
You happened to fix a related bug, just not the one described in this issue. Your fix gif shows that you type if (1) {} and then go back and hit enter between the if-condition and the braces. That is _not_ the flow that the bug describes.
@mjbvz - the original issue I reported does still reproduce for me in 1.15 following the same steps. It's not fixed.
It's fixed in the insider release. Be patient for it to get to the stable build. @AshleyScirra
Yay - that fixed it! @mjbvz Thank you.
@mjbvz its still not fixed, just grabbed the latest version on a different fresh installed cmputer and this is still here. This is ridiculous.
@azarus I don't think the fix has made it to the release version yet. I'm guessing you're on version 1.15.x, but the fix is in 1.16.0-insider - which you can download from https://code.visualstudio.com/insiders
Awesome.
On 28 Aug 2017 21:21, "simonl65" notifications@github.com wrote:
@azarus https://github.com/azarus I don't think the fix has made it to
the release version yet. I'm guessing you're on version 1.15.x, but the fix
is in 1.16.0-insider - which you can download from
https://code.visualstudio.com/insiders—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/30933#issuecomment-325366937,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFlNcxMxLu9wF6vlKh-juUNjNSuRPji6ks5scszrgaJpZM4ObYuY
.
Most helpful comment
@mjbvz But that isn't the case at all. Here's what the original reported issue read as:
As explained in many subsequent comments, this is still an issue.
You happened to fix a related bug, just not the one described in this issue. Your fix gif shows that you type
if (1) {}and then go back and hit enter between the if-condition and the braces. That is _not_ the flow that the bug describes.