Skip to content

Commit

Permalink
Do not depend on nor require haskell-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dschrempf committed Jan 20, 2025
1 parent 6981f8d commit 34db0b8
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 83 deletions.
1 change: 0 additions & 1 deletion Eask
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

(depends-on "emacs" "27.1")
(depends-on "lsp-mode")
(depends-on "haskell-mode")

(development
(depends-on "f")
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ Do not skip this!
It has important information.

`lsp-mode` automatically requires the `lsp-haskell` package , so you do not need to `require` `lsp-haskell` unless you like being explicit.
Similarly, `lsp-haskell` automatically requires the `haskell-mode` package, so you do not need to `require` `haskell-mode`.

You will need to set some hooks to ensure that `lsp-mode` is triggered when the `haskell-mode` major mode is entered.
You will need to set some hooks to ensure that `lsp-mode` is triggered when your Haskell major mode (e.g., `haskell-mode` or `haskell-ts-mode`) is entered.

```emacs-lisp
(add-hook 'haskell-mode-hook #'lsp)
Expand Down
159 changes: 79 additions & 80 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 -*- lexical-binding: t; -*-

;; 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 @@ -467,11 +466,11 @@ but will take exponentially more time."
"method"
"LSP semantic token type to use for typeclass methods"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.classMethodToken")
Expand All @@ -480,11 +479,11 @@ but will take exponentially more time."
"class"
"LSP semantic token type to use for typeclasses"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.classToken")
Expand All @@ -493,11 +492,11 @@ but will take exponentially more time."
"enumMember"
"LSP semantic token type to use for data constructors"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.dataConstructorToken")
Expand All @@ -506,11 +505,11 @@ but will take exponentially more time."
"function"
"LSP semantic token type to use for functions"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.functionToken")
Expand All @@ -519,11 +518,11 @@ but will take exponentially more time."
"namespace"
"LSP semantic token type to use for modules"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.moduleToken")
Expand All @@ -532,11 +531,11 @@ but will take exponentially more time."
"operator"
"LSP semantic token type to use for operators"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.operatorToken")
Expand All @@ -545,11 +544,11 @@ but will take exponentially more time."
"macro"
"LSP semantic token type to use for pattern synonyms"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.patternSynonymToken")
Expand All @@ -558,11 +557,11 @@ but will take exponentially more time."
"property"
"LSP semantic token type to use for record fields"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.recordFieldToken")
Expand All @@ -571,11 +570,11 @@ but will take exponentially more time."
"enum"
"LSP semantic token type to use for type constructors"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.typeConstructorToken")
Expand All @@ -584,11 +583,11 @@ but will take exponentially more time."
"interface"
"LSP semantic token type to use for type families"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.typeFamilyToken")
Expand All @@ -597,11 +596,11 @@ but will take exponentially more time."
"type"
"LSP semantic token type to use for type synonyms"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.typeSynonymToken")
Expand All @@ -610,11 +609,11 @@ but will take exponentially more time."
"typeParameter"
"LSP semantic token type to use for type variables"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.typeVariableToken")
Expand All @@ -623,11 +622,11 @@ but will take exponentially more time."
"variable"
"LSP semantic token type to use for variables"
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
(const "interface") (const "struct") (const "typeParameter")
(const "parameter") (const "variable") (const "property") (const "enumMember")
(const "event") (const "function") (const "method") (const "macro")
(const "keyword") (const "modifier") (const "comment") (const "string")
(const "number") (const "regexp") (const "operator") (const "decorator"))
:group 'lsp-haskell-plugins
:package-version '(lsp-mode . "9.0.0")
:lsp-path "haskell.plugin.semanticTokens.config.variableToken")
Expand Down Expand Up @@ -718,19 +717,19 @@ arguments are non-nullable booleans."

;; 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 haskell-ts-mode)
;; This is arbitrary.
:server-id 'lsp-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
:action-filter #'lsp-haskell--action-filter
))
(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 haskell-ts-mode)
;; This is arbitrary.
:server-id 'lsp-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
:action-filter #'lsp-haskell--action-filter
))

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

Expand Down

0 comments on commit 34db0b8

Please sign in to comment.