When I type a closing curly brace on an indented line, the indentation of that line and the entire block it closes is reduced to zero.
The answer offered at How to stop vscode from removing indent when closing curly braces is to set 'auto indent' to 'keep' but I've tried all the 'autoindent' options with no luck.
Someone suggested installing 'PHP Intelliphense' plugin, this did not change the behaviour. I uninstalled it again.
Disabling the 'PHP' 'All-in-One PHP support' extension from DEVSENSE did not help.
Disabling the 'PHP Docblocker' extension did not help.
Disabling the 'PHP cs fixer' extension did not help.
At this point I have no PHP extensions enabled, still having the problem.
I read at https://github.com/microsoft/vscode/issues/40235 that c# developers had a similar problem, so I disabled the C# extension, also did not change the behaviour.
Similar behaviour with HTML in a PHP file, but in that case only the line where the closing > is typed is unindented, the entire block is not. HTML in a file considered html (with a .html extension, say) is not affected, so this still seems related to the PHP language features.
Since I've tried the different 'auto indent' options with no luck, what else can I try?
I'm using VS Code 1.82.2 on Fedora Linux 38.
I'm trying the suggestions from @starball (thanks!)
EDIT 2: It seems to have been the php cs fixer extension from junstyle. Disabling it does prompt for an editor restart, so I'm not sure why I missed this earlier. Enabling it does not prompt for a restart, but immediately brings in the indentation problem. I installed it to get PSR-12 formatting support, which does not seem well supported anywhere I've looked.



The behaviour was found to be caused by the
junstyle.php-cs-fixerextension. It's quite strange because according to the extension's docs, it just contributes a command... Anyhow, there are now issue tickets tracking the behaviour:I suggest that you give those issue tickets a thumbs up to show support for it. You can also subscribe to them to get notified about discussion and progress. Please avoid making noisy comments there like ones that just consist of "+1" / "bump".
When you encounter undesirable behaviours, it's often helpful to figure out if an extension is causing them. To do that, ask yourself the following: Does this happen when you reload VS Code with extensions disabled (use the
Developer: Reload With Extensions Disabledcommand in the command palette)? If not, then do an extension bisect to figure out what extension is causing it.