Skip to content

Commit

Permalink
Compatibility with newer versions of editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheid committed Aug 31, 2024
1 parent 5965223 commit 3b20226
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions prettier.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Created: 7 Nov 2018
;; Keywords: convenience, languages, files
;; Homepage: https://github.com/jscheid/prettier.el
;; Package-Requires: ((emacs "26.1") (iter2 "0.9") (nvm "0.2") (editorconfig "0.8"))
;; Package-Requires: ((emacs "26.1") (iter2 "0.9") (nvm "0.2") (editorconfig "0.9"))

;; This file is not part of GNU Emacs.

Expand Down Expand Up @@ -1179,12 +1179,19 @@ post-formatting as possible."
t))
(prettier--backup-buffer-local-values
(lambda ()
(editorconfig-set-indentation
(if (eq (plist-get options :useTabs) t) "tab" "space")
(number-to-string (plist-get options :tabWidth))
nil)
(editorconfig-set-line-length
(number-to-string (plist-get options :printWidth)))
(let ((props (make-hash-table)))
(puthash 'indent_style
(if (eq (plist-get options :useTabs) t)
"tab"
"space")
props)
(puthash 'indent_size
(number-to-string (plist-get options :tabWidth))
props)
(puthash 'max_line_length
(number-to-string (plist-get options :printWidth))
props)
(editorconfig-set-local-variables props))

(mapc (lambda (setting)
(let* ((vars (nth 0 setting))
Expand Down

0 comments on commit 3b20226

Please sign in to comment.