Skip to content

Commit 4b6d06a

Browse files
committed
Add formatter configuration
1 parent 1a541e2 commit 4b6d06a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ exposed via a set of interactive functions.
7979
- `lsp-haskell-set-completion-snippets-on` /
8080
`lsp-haskell-set-completion-snippets-off` Whether completion should
8181
return plain text or snippets.
82+
- `lsp-haskell-set-formatter-brittany` /
83+
`lsp-haskell-set-formatter-floskell` /
84+
`lsp-haskell-set-formatter-ormolu` Set code formatter.
8285

8386
There are also non-interactive versions that do not actually send the
8487
settings to the live server, but are suitable for use in `.dir-locals`
@@ -88,3 +91,4 @@ for a specific project.
8891
- `lsp-haskell-set-max-problems`
8992
- `lsp-haskell-set-liquid`
9093
- `lsp-haskell-set-completion-snippets`
94+
- `lsp-haskell-set-formatter`

lsp-haskell.el

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,29 @@ These are assembled from the customizable variables
290290
(lsp-haskell-set-completion-snippets :json-false)
291291
(lsp-haskell--set-configuration))
292292

293+
;; -------------------------------------
294+
295+
(defun lsp-haskell-set-formatter (val)
296+
"Set code formatter."
297+
(lsp-haskell-set-config "formattingProvider" val))
298+
299+
(defun lsp-haskell-set-formatter-brittany ()
300+
"Use brittany."
301+
(interactive)
302+
(lsp-haskell-set-formatter :brittany)
303+
(lsp-haskell--set-configuration))
304+
305+
(defun lsp-haskell-set-formatter-floskell ()
306+
"Use floskell."
307+
(interactive)
308+
(lsp-haskell-set-formatter :floskell)
309+
(lsp-haskell--set-configuration))
310+
311+
(defun lsp-haskell-set-formatter-ormolu ()
312+
"Use ormolu."
313+
(interactive)
314+
(lsp-haskell-set-formatter :ormolu)
315+
(lsp-haskell--set-configuration))
293316

294317
;; ---------------------------------------------------------------------
295318

0 commit comments

Comments
 (0)