mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Pass file extension to Prettier
This commit is contained in:
parent
405f71143c
commit
b12fcff9fa
1 changed files with 6 additions and 2 deletions
|
@ -376,7 +376,11 @@ argument, a buffer containing the output of the formatter."
|
|||
(when (file-executable-p binary)
|
||||
(setcar command binary)))))
|
||||
(when (memq 'input command)
|
||||
(let ((input-fname (make-temp-file "apheleia")))
|
||||
(let ((input-fname (make-temp-file
|
||||
"apheleia" nil
|
||||
(and buffer-file-name
|
||||
(file-name-extension
|
||||
buffer-file-name 'period)))))
|
||||
(apheleia--write-region-silently nil nil input-fname)
|
||||
(setq command (mapcar (lambda (arg)
|
||||
(if (eq arg 'input)
|
||||
|
@ -402,7 +406,7 @@ argument, a buffer containing the output of the formatter."
|
|||
|
||||
(defcustom apheleia-formatters
|
||||
'((black . ("black" "-"))
|
||||
(prettier . (npx "prettier"))
|
||||
(prettier . (npx "prettier" input))
|
||||
(gofmt . ("gofmt")))
|
||||
"Alist of code formatting commands.
|
||||
The keys may be any symbols you want, and the values are
|
||||
|
|
Loading…
Add table
Reference in a new issue