Revert "Update existing formatters to use new utility functions"

This reverts commit ceaddebf39.
This commit is contained in:
Mohsin Kaleem 2023-03-12 10:50:49 +00:00
parent a7800ac50b
commit 48e7233b42

View file

@ -100,16 +100,17 @@ Otherwise return the extension only."
(defcustom apheleia-formatters (defcustom apheleia-formatters
'((bean-format . ("bean-format")) '((bean-format . ("bean-format"))
(black . ("black" (black . ("black" "-"))
(when (apheleia-formatters-extension-p "pyi") "--pyi")
(apheleia-formatters-fill-column "--line-length")
"-"))
(brittany . ("brittany")) (brittany . ("brittany"))
(caddyfmt . ("caddy" "fmt" "-")) (caddyfmt . ("caddy" "fmt" "-"))
(clang-format . ("clang-format" (clang-format . ("clang-format"
"-assume-filename" "-assume-filename"
(or (buffer-file-name) (or (buffer-file-name)
(apheleia-formatters-mode-extension) (cdr (assoc major-mode
'((c-mode . ".c")
(c++-mode . ".cpp")
(cuda-mode . ".cu")
(protobuf-mode . ".proto"))))
".c"))) ".c")))
(crystal-tool-format . ("crystal" "tool" "format" "-")) (crystal-tool-format . ("crystal" "tool" "format" "-"))
(dart-format . ("dart" "format")) (dart-format . ("dart" "format"))
@ -121,58 +122,35 @@ Otherwise return the extension only."
(google-java-format . ("google-java-format" "-")) (google-java-format . ("google-java-format" "-"))
(isort . ("isort" "-")) (isort . ("isort" "-"))
(lisp-indent . apheleia-indent-lisp-buffer) (lisp-indent . apheleia-indent-lisp-buffer)
(ktlint . ("ktlint" "--log-level=none" "--stdin" "-F" "-")) (ktlint . ("ktlint" "--log-level=none" "--stdin" "-F"))
(latexindent . ("latexindent" "--logfile=/dev/null")) (latexindent . ("latexindent" "--logfile=/dev/null"))
(mix-format . ("mix" "format" "-")) (mix-format . ("mix" "format" "-"))
(nixfmt . ("nixfmt")) (nixfmt . ("nixfmt"))
(ocamlformat . ("ocamlformat" "-" "--name" filepath (ocamlformat . ("ocamlformat" "-" "--name" filepath
"--enable-outside-detected-project")) "--enable-outside-detected-project"))
(phpcs . ("apheleia-phpcs")) (phpcs . ("apheleia-phpcs"))
(prettier (prettier . (npx "prettier" "--stdin-filepath" filepath))
. (npx "prettier" "--stdin-filepath" filepath
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-css (prettier-css
. (npx "prettier" "--stdin-filepath" filepath "--parser=css" . (npx "prettier" "--stdin-filepath" filepath "--parser=css"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-html (prettier-html
. (npx "prettier" "--stdin-filepath" filepath "--parser=html" . (npx "prettier" "--stdin-filepath" filepath "--parser=html"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-graphql (prettier-graphql
. (npx "prettier" "--stdin-filepath" filepath "--parser=graphql" . (npx "prettier" "--stdin-filepath" filepath "--parser=graphql"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-javascript (prettier-javascript
. (npx "prettier" "--stdin-filepath" filepath "--parser=babel-flow" . (npx "prettier" "--stdin-filepath" filepath "--parser=babel-flow"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-json (prettier-json
. (npx "prettier" "--stdin-filepath" filepath "--parser=json" . (npx "prettier" "--stdin-filepath" filepath "--parser=json"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-markdown (prettier-markdown
. (npx "prettier" "--stdin-filepath" filepath "--parser=markdown" . (npx "prettier" "--stdin-filepath" filepath "--parser=markdown"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-ruby (prettier-ruby
. (npx "prettier" "--stdin-filepath" filepath "--parser=ruby" . (npx "prettier" "--stdin-filepath" filepath "--parser=ruby"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-scss (prettier-scss
. (npx "prettier" "--stdin-filepath" filepath "--parser=scss" . (npx "prettier" "--stdin-filepath" filepath "--parser=scss"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-typescript (prettier-typescript
. (npx "prettier" "--stdin-filepath" filepath "--parser=typescript" . (npx "prettier" "--stdin-filepath" filepath "--parser=typescript"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-yaml (prettier-yaml
. (npx "prettier" "--stdin-filepath" filepath "--parser=yaml" . (npx "prettier" "--stdin-filepath" filepath "--parser=yaml"))
(apheleia-formatters-js-indent "--use-tabs" "--tab-width"))) (shfmt . ("shfmt" "-i" "4"))
(shfmt . ("shfmt"
"-filename" filepath
"-ln" (cl-case (bound-and-true-p sh-shell)
(sh "posix")
(t "bash"))
"-i" (number-to-string
(cond
(indent-tabs-mode 0)
((boundp 'sh-basic-offset)
sh-basic-offset)
(t 4)))
"-"))
(stylua . ("stylua" "-")) (stylua . ("stylua" "-"))
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout")) (rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-"))) (terraform . ("terraform" "fmt" "-")))