Skip to content

Commit

Permalink
Add support for dprint
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Nov 20, 2023
1 parent 615b0f5 commit f7670ca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The format is based on [Keep a Changelog].

### Formatters

* [dprint](https://dprint.dev) for various (depends on installed plugins).
* [purs-tidy](https://github.com/natefaubion/purescript-tidy) for PureScript ([#182]).
* [`jq`](https://stedolan.github.io/jq/) for
[JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON)
Expand Down
4 changes: 4 additions & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
(cmake-format . ("cmake-format" "-"))
(crystal-tool-format . ("crystal" "tool" "format" "-"))
(dart-format . ("dart" "format"))
(dprint . ("dprint" "fmt" "--stdin" (file-name-nondirectory filepath)))
(elm-format . ("elm-format" "--yes" "--stdin"))
(fish-indent . ("fish_indent"))
(fourmolu . ("fourmolu"))
Expand Down Expand Up @@ -239,11 +240,13 @@ rather than using this system."
(cmake-mode . cmake-format)
(cmake-ts-mode . cmake-format)
(common-lisp-mode . lisp-indent)
(conf-toml-mode . dprint)
(crystal-mode . crystal-tool-format)
(css-mode . prettier-css)
(css-ts-mode . prettier-css)
(dart-mode . dart-format)
(dart-ts-mode . dart-format)
(dockerfile-mode . dprint)
(elixir-mode . mix-format)
(elixir-ts-mode . mix-format)
(elm-mode . elm-format)
Expand All @@ -269,6 +272,7 @@ rather than using this system."
(LaTeX-mode . latexindent)
(lua-mode . stylua)
(lisp-mode . lisp-indent)
(markdown-mode . dprint)
(nasm-mode . asmfmt)
(nix-mode . nixfmt)
(perl-mode . perltidy)
Expand Down
11 changes: 11 additions & 0 deletions test/formatters/installers/dprint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
npm install -g dprint
cat <<\EOF >/tmp/dprint.json
{
"toml": {},
"excludes": [],
"plugins": [
"https://plugins.dprint.dev/toml-0.5.4.wasm"
]
}
EOF
dprint config update
1 change: 1 addition & 0 deletions test/formatters/samplecode/dprint/in.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title = "Apheleia dprint TOML test"
1 change: 1 addition & 0 deletions test/formatters/samplecode/dprint/out.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title = "Apheleia dprint TOML test"

0 comments on commit f7670ca

Please sign in to comment.