You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugIssue identified by VS Code Team member as probable bugeditor-autoindentEditor auto indentation issuesinsiders-releasedPatch has been released in VS Code InsidersjavascriptJavaScript support issuestypescriptTypescript support issuesverifiedVerification succeeded
Does this issue occur when all extensions are disabled?: Yes
VS Code Version: 1.88.0
OS Version: Ubuntu 22.04
Steps to Reproduce:
if(true)<enter>{<enter>}
This seems to happen on for and while as well. In other languages auto-indentation doesn't happen after the first <enter> in the example. While it could be good as a feature, it would be great if on typing the opening bracket, it would automatically un-indent. Also, it seems like the kind of thing that needs a toggle, because it can backfire in multiple ways.
Another thing that I noticed was that the auto-indentation happens even if the if line is commented out.
// if (true)<enter>|<cursorendsuphere>
This was not a problem in the previous version.
Reacted by Andy Stovell - HotRise, Russell Speke, Jimmy Thomsen, FlowIT-JIT, Stephen Sigwart, Richard Davey, ZLam, Adam Nickle and Jardel
+1 to also having this issue. Can confirm, If, Else If, For, While, and Arrow Functions affected. Functions & Switches are fine.
Have tried commenting out settings.json, and issue persists.
I wonder why this bug report does not have a billion upvotes. I have the same problem, and it makes it a pain to write code. I constantly have to fix it manually. I tried disabling all my extensions and clear both User settings (JSON) and Workspace settings (JSON), but to no eval.
This is what I experience in JS files:
Pressing ENTER after control flows such as if or for indents the cursor like shown above, where it previously placed the cursor right below the if part.
In the example below I pressed ENTER after the function() declaration on line 5 which caused incorrect indentation in the opposite direction:
Previously it placed the cursor right below the [] part.
Things seems to work fine for PHP files.
Tested with VSCode 1.89.0 (commit b58957e) on macOS 12.7.2.
Probably a duplicate of #209805
Although I'm not sure this covers the issue with the forEach(..) construct.
The problems mentioned by Jimmy Thomsen (@Jemt) also applies to TypeScript. This is completely unacceptable.
For those that don't like the new behavior, I created the ssigwart.javascript-typescript-language-configuration extension that will remove the auto-indenting after if, for, and while in JavaScript and Typescript.
Hi everyone thank you for expressing your concern. This change has come in as a result of the following issue with 43 upvotes (#43244) which precisely asked for indentation to be added after a braceless if/for/while statement. I will explore the idea of adding indentation by default, and then removing it when { is typed.
So happy to see this fixed. How do we easily track when it enters a live release version? As I'm pinned to v1.87 and don't want to turn automatic updates on again until I know this has landed.
The update that has been merged today will be in tomorrow's Insiders release and in next month's stable release :). Next month's stable release should come out around beginning of July
bugIssue identified by VS Code Team member as probable bugeditor-autoindentEditor auto indentation issuesinsiders-releasedPatch has been released in VS Code InsidersjavascriptJavaScript support issuestypescriptTypescript support issuesverifiedVerification succeeded
Activity
StevenJohnston commentedon Apr 11, 2024
I too have this issue
AndrewStovell commentedon Apr 14, 2024
+1 to also having this issue. Can confirm, If, Else If, For, While, and Arrow Functions affected. Functions & Switches are fine.
Have tried commenting out settings.json, and issue persists.
Version: 1.88.1 (user setup)
Commit: e170252
Date: 2024-04-10T17:41:02.734Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631
TheWyo commentedon Apr 22, 2024
Seems to be a re-occurrence of #30933 from quite some time ago.
1564047446 commentedon Apr 30, 2024
yeah, the latest version must auto error. emmmm, how long fix the bug
Jemt commentedon May 5, 2024
I wonder why this bug report does not have a billion upvotes. I have the same problem, and it makes it a pain to write code. I constantly have to fix it manually. I tried disabling all my extensions and clear both User settings (JSON) and Workspace settings (JSON), but to no eval.
This is what I experience in JS files:
Pressing ENTER after control flows such as
iforforindents the cursor like shown above, where it previously placed the cursor right below theifpart.In the example below I pressed ENTER after the
function()declaration on line 5 which caused incorrect indentation in the opposite direction:Previously it placed the cursor right below the
[]part.Things seems to work fine for PHP files.
Tested with VSCode 1.89.0 (commit b58957e) on macOS 12.7.2.
"About Visual Studio Code":
Version: 1.89.0
Commit: b58957e
Date: 2024-05-01T02:10:10.196Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin x64 21.6.0
FlowIT-JIT commentedon May 6, 2024
Probably a duplicate of #209805
Although I'm not sure this covers the issue with the forEach(..) construct.
The problems mentioned by Jimmy Thomsen (@Jemt) also applies to TypeScript. This is completely unacceptable.
FlowIT-JIT commentedon May 6, 2024
Switching
Auto indentto "advanced" makes VSCode usable again:But it's beyond me that 1.88 even shipped with these changes. Completely destroyed the editing experience.
FlowIT-JIT commentedon May 6, 2024
This is the behaviour with "Auto indent" set to Full:
I constantly have to fix the code.
ssigwart commentedon May 11, 2024
For those that don't like the new behavior, I created the
ssigwart.javascript-typescript-language-configurationextension that will remove the auto-indenting afterif,for, andwhilein JavaScript and Typescript.aiday-mar commentedon May 13, 2024
Hi everyone thank you for expressing your concern. This change has come in as a result of the following issue with 43 upvotes (#43244) which precisely asked for indentation to be added after a braceless if/for/while statement. I will explore the idea of adding indentation by default, and then removing it when { is typed.
12 remaining items
photonstorm commentedon Jun 20, 2024
So happy to see this fixed. How do we easily track when it enters a live release version? As I'm pinned to v1.87 and don't want to turn automatic updates on again until I know this has landed.
aiday-mar commentedon Jun 20, 2024
The update that has been merged today will be in tomorrow's Insiders release and in next month's stable release :). Next month's stable release should come out around beginning of July
aiday-mar commentedon Jun 24, 2024
To verify:
if(<some code>)in the fileEnter, verify the next line is indented{, verify a second closing curly brace is added and we have:Enterfrom within the curly braces, verify we have:Here the dots represent the spaces.
FlowIT-JIT commentedon Jun 24, 2024
Aiday Marlen Kyzy (@aiday-mar) That will be a TAB if VSCode is configured to use those instead, right ?
aiday-mar commentedon Jun 24, 2024
Hi FlowIT-JIT yes these should be tabs if you configured tabs for the file
rzvc commentedon Jul 23, 2024
Aiday Marlen Kyzy (@aiday-mar), thank you. It works when typing, but still presents the issue when pasting.
I have created a new issue for that scenario: #223308.