Skip to content

Commit 18a7c78

Browse files
authored
Merge pull request #183 from robbert-vdh/robbert-vdh/patch-boolean-action-values
Fix JSON false values incorrectly being encoded as nulls in code actions
2 parents 2808b06 + 049be2c commit 18a7c78

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lsp-haskell.el

+8
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,13 @@ These are assembled from the customizable variables `lsp-haskell-server-path'
484484
and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
485485
(funcall lsp-haskell-server-wrapper-function (append (list lsp-haskell-server-path "--lsp") lsp-haskell-server-args) ))
486486

487+
(defun lsp-haskell--action-filter (command)
488+
"lsp-mode transforms JSON false values in code action
489+
arguments to JSON null values when sending the requests back to
490+
the server. We need to explicitly tell it which code action
491+
arguments are non-nullable booleans."
492+
(lsp-fix-code-action-booleans command '(:restrictToOriginatingFile :withSig)))
493+
487494
;; This mapping is set for 'haskell-mode -> haskell' in the lsp-mode repo itself. If we move
488495
;; it there, then delete it from here.
489496
;; It also isn't *too* important: it only sets the language ID, see
@@ -511,6 +518,7 @@ and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
511518
;; we should set something consistent here.
512519
:language-id "haskell"
513520
:completion-in-comments? lsp-haskell-completion-in-comments
521+
:action-filter #'lsp-haskell--action-filter
514522
))
515523

516524
;; ---------------------------------------------------------------------

0 commit comments

Comments
 (0)