Skip to content

Commit 17d7d4c

Browse files
authored
Merge pull request #68 from notogawa/config-formatter
Add formatter configuration
2 parents 783d9e9 + 4b6d06a commit 17d7d4c

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
@@ -62,6 +62,9 @@ exposed via a set of interactive functions.
6262
- `lsp-haskell-set-completion-snippets-on` /
6363
`lsp-haskell-set-completion-snippets-off` Whether completion should
6464
return plain text or snippets.
65+
- `lsp-haskell-set-formatter-brittany` /
66+
`lsp-haskell-set-formatter-floskell` /
67+
`lsp-haskell-set-formatter-ormolu` Set code formatter.
6568

6669
There are also non-interactive versions that do not actually send the
6770
settings to the live server, but are suitable for use in `.dir-locals`
@@ -71,3 +74,4 @@ for a specific project.
7174
- `lsp-haskell-set-max-problems`
7275
- `lsp-haskell-set-liquid`
7376
- `lsp-haskell-set-completion-snippets`
77+
- `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)