Slater.app CMS

How to Prevent Collapsed Sections from Expanding After Saving Due to Auto Formatting

When saving code, collapsed sections may automatically expand if JavaScript formatting is enabled. Disabling the Auto Format Code feature in the settings can prevent this behavior and help maintain your preferred code view.

You may notice that after saving code, any sections previously collapsed in the editor automatically expand. This happens because JavaScript formatting is enabled by default, and when the code is automatically formatted upon saving, the editor refreshes and expands all collapsed sections.

Why Does This Happen?

How to Turn Off Auto Format Code

To keep collapsed sections closed after saving, disable the auto formatting feature:

  1. Go to Settings in your editor.
  2. Navigate to Code Editor Settings.
  3. Locate the option for Auto format code.
  4. Toggle Auto format code off.

This will prevent automatic reformatting and help maintain collapsed sections as you left them.