You are advised to enable Save Executed SQL Statements in the upper right corner so that the recently executed SQL statements can be saved to the server.
The formatting takes effect for all the SQL statements in the SQL window. You cannot format only the selected statements.