HTML indentation in JSX
As I understand, HTML indentation is not configurable separately for JSX files, but where it comes from?
My current settings:
- “Settings | Editor | Code Style | HTML” – Tab size, Indent, Continuation indent: 2/2/2
- “Settings | Editor | Code Style | Javascript” – Tab size, Indent, Continuation indent: 2/2/2
- Support for EditorConfig disabled, there are no EditorConfig or Prettier files in the project
- Indents detection for project – tried both enabled and disabled – no effect
Despite all of the above, PHPStorm indents HTML blocks in .jsx files with 4 spaces on hitting Enter or reformatting with Cmd-Option-L. Indentation setting in bottom right corner of the window is shown as “4 spaces” as well.
Please sign in to leave a comment.
Apparently something got broken while working on the project, because IDE stopped respecting Code Style settings completely. Restarting PHPStorm solved these issues, including indentations. 🤷🏻♂️
The issue looks similar to https://youtrack.jetbrains.com/issue/IDEA-327617/Indents-settings-do-not-work-for-typescript-js-files. Unfortunately the problem is intermittent, and we have been unable to reproduce it on our end. We have introduced some additional diagnostics in 2023.3 EAP. Please could you download it and, if the issue persists, enable the debug logging there? Here are steps:
1 Open Help | Diagnostic Tools | Debug Log Settings...
2 Add the
#com.intellij.application.options.codeStyle.cache.CodeStyleCachedValueProvider
key there3 Restart the IDE, reproduce the problem.
4 Choose Help | Collect Logs and Diagnostic Data... from the main menu
5 Share the created .zip file.
This would help us a lot in tracking down and fixing the bug
Interesting, the problem kept happening, until I started to suspect plugins to be a culprit and disabled React Buddy. The problem did not repeat since then yet.
I'll keep an eye on it and will submit diagnostics as soon as the issue occurs again.