Skip to content

Commit

Permalink
wip! Make it work with hs-ts-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
magthe committed Oct 6, 2023
1 parent b36b23e commit 2084ff1
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions lsp-haskell.el
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;; lsp-haskell.el --- Haskell support for lsp-mode

;; Version: 1.1
;; Package-Requires: ((emacs "27.1") (lsp-mode "3.0") (haskell-mode "16.1"))
;; Package-Requires: ((emacs "27.1") (lsp-mode "3.0"))
;; Keywords: haskell
;; URL: https://github.com/emacs-lsp/lsp-haskell

Expand Down Expand Up @@ -29,7 +29,6 @@
;;; Code:

(require 'lsp-mode)
(require 'haskell-mode)

;; ---------------------------------------------------------------------
;; Configuration
Expand Down Expand Up @@ -481,30 +480,32 @@ and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
;; it there, then delete it from here.
;; It also isn't *too* important: it only sets the language ID, see
;; https://microsoft.github.io/language-server-protocol/specification#textDocumentItem
(add-to-list 'lsp-language-id-configuration '(haskell-literate-mode . "haskell"))
(add-to-list 'lsp-language-id-configuration '(haskell-tng-mode . "haskell"))
(add-to-list 'lsp-language-id-configuration '(haskell-cabal-mode . "haskell"))
;; (add-to-list 'lsp-language-id-configuration '(haskell-literate-mode . "haskell"))
;; (add-to-list 'lsp-language-id-configuration '(haskell-tng-mode . "haskell"))
;; (add-to-list 'lsp-language-id-configuration '(haskell-cabal-mode . "haskell"))
(add-to-list 'lsp-language-id-configuration '(haskell-ng-mode . "haskell"))

;; Register the client itself
(lsp-register-client
(make-lsp--client
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--server-command)))
;; Should run under haskell-mode, haskell-literate-mode and haskell-tng-mode. We need to list haskell-literate-mode even though it's a derived mode of haskell-mode.
:major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode haskell-cabal-mode)
;; This is arbitrary.
:server-id 'lsp-haskell
;; HLS does not currently send 'workspace/configuration' on startup (https://github.com/haskell/haskell-language-server/issues/2762),
;; so we need to push the configuration to it manually on startup. We should be able to
;; get rid of this once the issue is fixed in HLS.
:initialized-fn (lambda (workspace)
(with-lsp-workspace workspace
(lsp--set-configuration (lsp-configuration-section "haskell"))))
:synchronize-sections '("haskell")
;; This is somewhat irrelevant, but it is listed in lsp-language-id-configuration, so
;; we should set something consistent here.
:language-id "haskell"
:completion-in-comments? lsp-haskell-completion-in-comments
))
(make-lsp--client
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--server-command)))
;; Should run under haskell-mode, haskell-literate-mode and haskell-tng-mode. We need to list haskell-literate-mode even though it's a derived mode of haskell-mode.
;; :major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode haskell-cabal-mode)
:major-modes '(haskell-ng-mode)
;; This is arbitrary.
:server-id 'lsp-haskell
;; HLS does not currently send 'workspace/configuration' on startup (https://github.com/haskell/haskell-language-server/issues/2762),
;; so we need to push the configuration to it manually on startup. We should be able to
;; get rid of this once the issue is fixed in HLS.
:initialized-fn (lambda (workspace)
(with-lsp-workspace workspace
(lsp--set-configuration (lsp-configuration-section "haskell"))))
:synchronize-sections '("haskell")
;; This is somewhat irrelevant, but it is listed in lsp-language-id-configuration, so
;; we should set something consistent here.
:language-id "haskell"
:completion-in-comments? lsp-haskell-completion-in-comments
))

;; ---------------------------------------------------------------------

Expand Down

0 comments on commit 2084ff1

Please sign in to comment.