Add command to reformat JS

This commit is contained in:
Jeremy Dormitzer 2019-11-27 10:12:56 -05:00
parent 92ae084f70
commit 5a2ea9e799

View File

@ -1479,6 +1479,15 @@ Use nvm to manage node versions:
:commands (nvm-use nvm-use-for nvm-use-for-buffer))
#+END_SRC
A command to format JS via prettier:
#+BEGIN_SRC emacs-lisp
(defun prettier ()
(interactive)
(let ((start (if (use-region-p) (region-beginning) (point-min)))
(end (if (use-region-p) (region-end) (point-max))))
(shell-command-on-region start end "prettier --parser babel" nil t)))
#+END_SRC
* LSP Mode
Emacs support for the Language Server Protocol