Formatting Options

Being able to format your file is great and all but it won’t always look nice depending on who you ask. Some might instead refer to a 3rd-party application / website to do so.
Some key features would be changing the spacing (default is 2 as of now), whether or not functions should go to the next line and a way to apply these formatting settings to multiple files at once.

It should work more as a 1-time “set up” than a per-use filter so we can set our settings account-wide (or project-wide) and simply format the file with these settings as opposed to selecting them each time we want to format our files.

I’d love to see it happen.

This is a great idea - I hate it when I’ve got a really long javascript array and every item is a new line… it happens sometimes. You have my invisible vote!

Edit: you have my actual vote as well.

1 Like

Hey @Thana and @Pufferfish101007,

Glitch uses Prettier for formatting code, and it is possible to configure Prettier with your own options. To do so, you need to create a file named .prettierrc in your project and add all your custom config. See how you can configure Prettier here: https://prettier.io/docs/en/options.html.

Example config:

{
   tabWidth: 4, // set indentation spaces to 4
   useTabs: true, // use tab instead of spaces
   printWidth: 100 // the number of characters to be used in a line before going on to the next line, default is 80
}

Hope this helps!

4 Likes