Install dprint
Install using one of the methods below.
-
Shell (Mac, Linux, WSL):
curl -fsSL https://dprint.dev/install.sh | sh
-
Windows Installer
-
Powershell (Windows):
iwr https://dprint.dev/install.ps1 -useb | iex
-
Scoop (Windows):
scoop install dprint
-
Homebrew (Mac):
brew install dprint
-
Cargo (builds and installs the cargo package from source):
# this will be slower since it builds from the source cargo install --locked dprint
-
Deno:
For just your project, add a deno task to your deno.json file:
{ "tasks": { "fmt": "deno task dprint fmt", "fmt:check": "deno task dprint check", "dprint": "deno run -A npm:dprint" } }
Then run
deno task dprint init
to initialize and format by running:deno task fmt
Also, you could install it globally via Deno, but like npm it has a startup and memory cost since it needs to run Deno then run dprint. It's recommended to install it globally via another method.
deno install -A npm:dprint dprint help
-
npm:
# for your project npm install dprint npx dprint help # or install globally (not recommended because it has a startup and memory cost) npm install -g dprint dprint help
-
asdf plugin-add dprint https://github.com/asdf-community/asdf-dprint asdf install dprint latest
-
Install with any AUR helper, for example:
paru -S dprint
or binaries
paru -S dprint-bin
For binaries and source, see the GitHub releases.
Editor Extensions
- Visual Studio Code
- IntelliJ - Thanks to the developers at Canva
- Neovim with nvim-lspconfig
- The
dprint lsp
subcommand (requires dprint 0.45+) provides code formatting over the language server protocol. This can be used to format in other editors.
Next step: Setup