The scripting suite Admin Script Editor (ASE) includes a Script Formatter feature that can be problematic at times. Well intentioned, the feature aims to automatically clean up code, doing things such as:

  • automatically indenting
  • automatically inserting spaces
  • automatically formatting completed function blocks
  • deleting trailing whitespace
  • automatically formatting completed statements on enter

When you are typing code the feature is normally quite welcome, but when pasting code its attempt to run so many rules against what is being pasted can result in unwanted spaces and that can be frustrating. To address this, the latest version of ASE now ships with the option to formate code when pasted disabled. However, settings are not overwritten if a previous version of ASE is present. If you have an existing installation and run into this problem, it is easy to adjust this feature yourself:

From Tools > Options, choose "Script Code" under the Formatting options. 

Here you can quickly disable the feature entirely by deselecting, "Enable script code formatting". However, this is a cool feature you probably don't want to drop alltogether, so I recommend clicking the "Launch Script Formatter" button and for each language you care about, deselect the "Adjust indention on paste" option (General).

If you'd like to really dig into this powerful feature, check out the indentation, spacing and wrapping options for each language. You can turn on and off very specific options and even see examples of their impact as you make your choices.