ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Prettierd Format

by Simone Mastromattei ST3 Trending

Sublime Text plugin to format files faster using prettierd

Details

Installs

  • Total 12K
  • Win 6K
  • Mac 3K
  • Linux 2K
Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28
Windows 2 11 9 18 19 11 12 8 8 8 8 12 12 14 18 5 8 12 18 8 12 9 9 6 20 14 16 20 15 12 12 6 18 19 11 16 13 15 9 10 14 15 10 7 11 15
Mac 3 5 5 6 5 5 13 9 6 6 13 7 11 4 8 1 2 13 11 10 10 8 4 3 6 6 7 8 3 4 4 10 6 10 9 10 5 7 9 12 8 7 6 2 5 8
Linux 0 6 1 4 4 6 7 8 11 4 3 2 6 3 2 3 5 5 6 9 2 3 5 4 4 2 4 6 7 2 2 5 3 2 4 6 5 7 6 7 7 4 1 0 5 10

Readme

Source
raw.​githubusercontent.​com

Prettierd Format

Sublime Text plugin to format files faster using prettierd.


Installation

  1. Install prettierd globally with npm/yarn/pnpm:
npm i -g @fsouza/prettierd
  1. Install this plugin with Package Control:

Package Control: Install PackagePrettierd Format

  1. Restart Sublime Text


Usage

By default it formats on save any file supported by Prettier out-of-the-box.

Commands

To format a file:

  • Prettierd: Format

To save a file without formatting:

  • Prettierd: Save without formatting

Options

Enable/disable format on save:

"format_on_save": true

Add additional extensions (enabled via prettier plugins) to be formatted either on save or commands:

"additional_extensions": ["php"]

Exclude extensions from being formatted on save:

"disabled_extensions_on_save": ["md"]

Exclude directories from being formatted on save:

"disabled_directories_on_save": ["*/node_modules/*"]

Optional, path to prettierd executable. If not specified, it will be searched for in the system:

"prettierd_path": null

All these options can be configured globally in your user settings, or per project under the "PrettierdFormat" setting:

{
    "settings":
    {
        "PrettierdFormat":
        {
            "format_on_save": true
        }
    }
}


Notes

This plugin does nothing else than piping the input to prettierd and replacing the view contents with the output.

It is basically just like executing cat file.js | prettierd file.js with the command line.

For this reason, any issue with prettier plugins or configuration should be investigated on the prettierd repo as it is the underlying tool actually interacting with Prettier.

Astro / Svelte

As of September 2023, there are some upstream issues with Astro and Svelte files.

You can format them with the command LSP: format after installing their LSPs and enabling format on save for each language in the LSP settings.

Using the above command not only respects the .prettierrc configuration but is also very fast.


License

0BSD