Skip to content

Commit 34db0b8

Browse files
committed
Do not depend on nor require haskell-mode
1 parent 6981f8d commit 34db0b8

File tree

3 files changed

+80
-83
lines changed

3 files changed

+80
-83
lines changed

Eask

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
(depends-on "emacs" "27.1")
1616
(depends-on "lsp-mode")
17-
(depends-on "haskell-mode")
1817

1918
(development
2019
(depends-on "f")

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ Do not skip this!
2323
It has important information.
2424

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

28-
You will need to set some hooks to ensure that `lsp-mode` is triggered when the `haskell-mode` major mode is entered.
27+
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.
2928

3029
```emacs-lisp
3130
(add-hook 'haskell-mode-hook #'lsp)

lsp-haskell.el

Lines changed: 79 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;;; lsp-haskell.el --- Haskell support for lsp-mode -*- lexical-binding: t; -*-
22

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

@@ -29,7 +29,6 @@
2929
;;; Code:
3030

3131
(require 'lsp-mode)
32-
(require 'haskell-mode)
3332

3433
;; ---------------------------------------------------------------------
3534
;; Configuration
@@ -467,11 +466,11 @@ but will take exponentially more time."
467466
"method"
468467
"LSP semantic token type to use for typeclass methods"
469468
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
470-
(const "interface") (const "struct") (const "typeParameter")
471-
(const "parameter") (const "variable") (const "property") (const "enumMember")
472-
(const "event") (const "function") (const "method") (const "macro")
473-
(const "keyword") (const "modifier") (const "comment") (const "string")
474-
(const "number") (const "regexp") (const "operator") (const "decorator"))
469+
(const "interface") (const "struct") (const "typeParameter")
470+
(const "parameter") (const "variable") (const "property") (const "enumMember")
471+
(const "event") (const "function") (const "method") (const "macro")
472+
(const "keyword") (const "modifier") (const "comment") (const "string")
473+
(const "number") (const "regexp") (const "operator") (const "decorator"))
475474
:group 'lsp-haskell-plugins
476475
:package-version '(lsp-mode . "9.0.0")
477476
:lsp-path "haskell.plugin.semanticTokens.config.classMethodToken")
@@ -480,11 +479,11 @@ but will take exponentially more time."
480479
"class"
481480
"LSP semantic token type to use for typeclasses"
482481
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
483-
(const "interface") (const "struct") (const "typeParameter")
484-
(const "parameter") (const "variable") (const "property") (const "enumMember")
485-
(const "event") (const "function") (const "method") (const "macro")
486-
(const "keyword") (const "modifier") (const "comment") (const "string")
487-
(const "number") (const "regexp") (const "operator") (const "decorator"))
482+
(const "interface") (const "struct") (const "typeParameter")
483+
(const "parameter") (const "variable") (const "property") (const "enumMember")
484+
(const "event") (const "function") (const "method") (const "macro")
485+
(const "keyword") (const "modifier") (const "comment") (const "string")
486+
(const "number") (const "regexp") (const "operator") (const "decorator"))
488487
:group 'lsp-haskell-plugins
489488
:package-version '(lsp-mode . "9.0.0")
490489
:lsp-path "haskell.plugin.semanticTokens.config.classToken")
@@ -493,11 +492,11 @@ but will take exponentially more time."
493492
"enumMember"
494493
"LSP semantic token type to use for data constructors"
495494
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
496-
(const "interface") (const "struct") (const "typeParameter")
497-
(const "parameter") (const "variable") (const "property") (const "enumMember")
498-
(const "event") (const "function") (const "method") (const "macro")
499-
(const "keyword") (const "modifier") (const "comment") (const "string")
500-
(const "number") (const "regexp") (const "operator") (const "decorator"))
495+
(const "interface") (const "struct") (const "typeParameter")
496+
(const "parameter") (const "variable") (const "property") (const "enumMember")
497+
(const "event") (const "function") (const "method") (const "macro")
498+
(const "keyword") (const "modifier") (const "comment") (const "string")
499+
(const "number") (const "regexp") (const "operator") (const "decorator"))
501500
:group 'lsp-haskell-plugins
502501
:package-version '(lsp-mode . "9.0.0")
503502
:lsp-path "haskell.plugin.semanticTokens.config.dataConstructorToken")
@@ -506,11 +505,11 @@ but will take exponentially more time."
506505
"function"
507506
"LSP semantic token type to use for functions"
508507
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
509-
(const "interface") (const "struct") (const "typeParameter")
510-
(const "parameter") (const "variable") (const "property") (const "enumMember")
511-
(const "event") (const "function") (const "method") (const "macro")
512-
(const "keyword") (const "modifier") (const "comment") (const "string")
513-
(const "number") (const "regexp") (const "operator") (const "decorator"))
508+
(const "interface") (const "struct") (const "typeParameter")
509+
(const "parameter") (const "variable") (const "property") (const "enumMember")
510+
(const "event") (const "function") (const "method") (const "macro")
511+
(const "keyword") (const "modifier") (const "comment") (const "string")
512+
(const "number") (const "regexp") (const "operator") (const "decorator"))
514513
:group 'lsp-haskell-plugins
515514
:package-version '(lsp-mode . "9.0.0")
516515
:lsp-path "haskell.plugin.semanticTokens.config.functionToken")
@@ -519,11 +518,11 @@ but will take exponentially more time."
519518
"namespace"
520519
"LSP semantic token type to use for modules"
521520
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
522-
(const "interface") (const "struct") (const "typeParameter")
523-
(const "parameter") (const "variable") (const "property") (const "enumMember")
524-
(const "event") (const "function") (const "method") (const "macro")
525-
(const "keyword") (const "modifier") (const "comment") (const "string")
526-
(const "number") (const "regexp") (const "operator") (const "decorator"))
521+
(const "interface") (const "struct") (const "typeParameter")
522+
(const "parameter") (const "variable") (const "property") (const "enumMember")
523+
(const "event") (const "function") (const "method") (const "macro")
524+
(const "keyword") (const "modifier") (const "comment") (const "string")
525+
(const "number") (const "regexp") (const "operator") (const "decorator"))
527526
:group 'lsp-haskell-plugins
528527
:package-version '(lsp-mode . "9.0.0")
529528
:lsp-path "haskell.plugin.semanticTokens.config.moduleToken")
@@ -532,11 +531,11 @@ but will take exponentially more time."
532531
"operator"
533532
"LSP semantic token type to use for operators"
534533
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
535-
(const "interface") (const "struct") (const "typeParameter")
536-
(const "parameter") (const "variable") (const "property") (const "enumMember")
537-
(const "event") (const "function") (const "method") (const "macro")
538-
(const "keyword") (const "modifier") (const "comment") (const "string")
539-
(const "number") (const "regexp") (const "operator") (const "decorator"))
534+
(const "interface") (const "struct") (const "typeParameter")
535+
(const "parameter") (const "variable") (const "property") (const "enumMember")
536+
(const "event") (const "function") (const "method") (const "macro")
537+
(const "keyword") (const "modifier") (const "comment") (const "string")
538+
(const "number") (const "regexp") (const "operator") (const "decorator"))
540539
:group 'lsp-haskell-plugins
541540
:package-version '(lsp-mode . "9.0.0")
542541
:lsp-path "haskell.plugin.semanticTokens.config.operatorToken")
@@ -545,11 +544,11 @@ but will take exponentially more time."
545544
"macro"
546545
"LSP semantic token type to use for pattern synonyms"
547546
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
548-
(const "interface") (const "struct") (const "typeParameter")
549-
(const "parameter") (const "variable") (const "property") (const "enumMember")
550-
(const "event") (const "function") (const "method") (const "macro")
551-
(const "keyword") (const "modifier") (const "comment") (const "string")
552-
(const "number") (const "regexp") (const "operator") (const "decorator"))
547+
(const "interface") (const "struct") (const "typeParameter")
548+
(const "parameter") (const "variable") (const "property") (const "enumMember")
549+
(const "event") (const "function") (const "method") (const "macro")
550+
(const "keyword") (const "modifier") (const "comment") (const "string")
551+
(const "number") (const "regexp") (const "operator") (const "decorator"))
553552
:group 'lsp-haskell-plugins
554553
:package-version '(lsp-mode . "9.0.0")
555554
:lsp-path "haskell.plugin.semanticTokens.config.patternSynonymToken")
@@ -558,11 +557,11 @@ but will take exponentially more time."
558557
"property"
559558
"LSP semantic token type to use for record fields"
560559
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
561-
(const "interface") (const "struct") (const "typeParameter")
562-
(const "parameter") (const "variable") (const "property") (const "enumMember")
563-
(const "event") (const "function") (const "method") (const "macro")
564-
(const "keyword") (const "modifier") (const "comment") (const "string")
565-
(const "number") (const "regexp") (const "operator") (const "decorator"))
560+
(const "interface") (const "struct") (const "typeParameter")
561+
(const "parameter") (const "variable") (const "property") (const "enumMember")
562+
(const "event") (const "function") (const "method") (const "macro")
563+
(const "keyword") (const "modifier") (const "comment") (const "string")
564+
(const "number") (const "regexp") (const "operator") (const "decorator"))
566565
:group 'lsp-haskell-plugins
567566
:package-version '(lsp-mode . "9.0.0")
568567
:lsp-path "haskell.plugin.semanticTokens.config.recordFieldToken")
@@ -571,11 +570,11 @@ but will take exponentially more time."
571570
"enum"
572571
"LSP semantic token type to use for type constructors"
573572
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
574-
(const "interface") (const "struct") (const "typeParameter")
575-
(const "parameter") (const "variable") (const "property") (const "enumMember")
576-
(const "event") (const "function") (const "method") (const "macro")
577-
(const "keyword") (const "modifier") (const "comment") (const "string")
578-
(const "number") (const "regexp") (const "operator") (const "decorator"))
573+
(const "interface") (const "struct") (const "typeParameter")
574+
(const "parameter") (const "variable") (const "property") (const "enumMember")
575+
(const "event") (const "function") (const "method") (const "macro")
576+
(const "keyword") (const "modifier") (const "comment") (const "string")
577+
(const "number") (const "regexp") (const "operator") (const "decorator"))
579578
:group 'lsp-haskell-plugins
580579
:package-version '(lsp-mode . "9.0.0")
581580
:lsp-path "haskell.plugin.semanticTokens.config.typeConstructorToken")
@@ -584,11 +583,11 @@ but will take exponentially more time."
584583
"interface"
585584
"LSP semantic token type to use for type families"
586585
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
587-
(const "interface") (const "struct") (const "typeParameter")
588-
(const "parameter") (const "variable") (const "property") (const "enumMember")
589-
(const "event") (const "function") (const "method") (const "macro")
590-
(const "keyword") (const "modifier") (const "comment") (const "string")
591-
(const "number") (const "regexp") (const "operator") (const "decorator"))
586+
(const "interface") (const "struct") (const "typeParameter")
587+
(const "parameter") (const "variable") (const "property") (const "enumMember")
588+
(const "event") (const "function") (const "method") (const "macro")
589+
(const "keyword") (const "modifier") (const "comment") (const "string")
590+
(const "number") (const "regexp") (const "operator") (const "decorator"))
592591
:group 'lsp-haskell-plugins
593592
:package-version '(lsp-mode . "9.0.0")
594593
:lsp-path "haskell.plugin.semanticTokens.config.typeFamilyToken")
@@ -597,11 +596,11 @@ but will take exponentially more time."
597596
"type"
598597
"LSP semantic token type to use for type synonyms"
599598
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
600-
(const "interface") (const "struct") (const "typeParameter")
601-
(const "parameter") (const "variable") (const "property") (const "enumMember")
602-
(const "event") (const "function") (const "method") (const "macro")
603-
(const "keyword") (const "modifier") (const "comment") (const "string")
604-
(const "number") (const "regexp") (const "operator") (const "decorator"))
599+
(const "interface") (const "struct") (const "typeParameter")
600+
(const "parameter") (const "variable") (const "property") (const "enumMember")
601+
(const "event") (const "function") (const "method") (const "macro")
602+
(const "keyword") (const "modifier") (const "comment") (const "string")
603+
(const "number") (const "regexp") (const "operator") (const "decorator"))
605604
:group 'lsp-haskell-plugins
606605
:package-version '(lsp-mode . "9.0.0")
607606
:lsp-path "haskell.plugin.semanticTokens.config.typeSynonymToken")
@@ -610,11 +609,11 @@ but will take exponentially more time."
610609
"typeParameter"
611610
"LSP semantic token type to use for type variables"
612611
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
613-
(const "interface") (const "struct") (const "typeParameter")
614-
(const "parameter") (const "variable") (const "property") (const "enumMember")
615-
(const "event") (const "function") (const "method") (const "macro")
616-
(const "keyword") (const "modifier") (const "comment") (const "string")
617-
(const "number") (const "regexp") (const "operator") (const "decorator"))
612+
(const "interface") (const "struct") (const "typeParameter")
613+
(const "parameter") (const "variable") (const "property") (const "enumMember")
614+
(const "event") (const "function") (const "method") (const "macro")
615+
(const "keyword") (const "modifier") (const "comment") (const "string")
616+
(const "number") (const "regexp") (const "operator") (const "decorator"))
618617
:group 'lsp-haskell-plugins
619618
:package-version '(lsp-mode . "9.0.0")
620619
:lsp-path "haskell.plugin.semanticTokens.config.typeVariableToken")
@@ -623,11 +622,11 @@ but will take exponentially more time."
623622
"variable"
624623
"LSP semantic token type to use for variables"
625624
:type '(choice (const "namespace") (const "type") (const "class") (const "enum")
626-
(const "interface") (const "struct") (const "typeParameter")
627-
(const "parameter") (const "variable") (const "property") (const "enumMember")
628-
(const "event") (const "function") (const "method") (const "macro")
629-
(const "keyword") (const "modifier") (const "comment") (const "string")
630-
(const "number") (const "regexp") (const "operator") (const "decorator"))
625+
(const "interface") (const "struct") (const "typeParameter")
626+
(const "parameter") (const "variable") (const "property") (const "enumMember")
627+
(const "event") (const "function") (const "method") (const "macro")
628+
(const "keyword") (const "modifier") (const "comment") (const "string")
629+
(const "number") (const "regexp") (const "operator") (const "decorator"))
631630
:group 'lsp-haskell-plugins
632631
:package-version '(lsp-mode . "9.0.0")
633632
:lsp-path "haskell.plugin.semanticTokens.config.variableToken")
@@ -718,19 +717,19 @@ arguments are non-nullable booleans."
718717

719718
;; Register the client itself
720719
(lsp-register-client
721-
(make-lsp--client
722-
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--server-command)))
723-
;; 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.
724-
:major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode haskell-cabal-mode haskell-ts-mode)
725-
;; This is arbitrary.
726-
:server-id 'lsp-haskell
727-
:synchronize-sections '("haskell")
728-
;; This is somewhat irrelevant, but it is listed in lsp-language-id-configuration, so
729-
;; we should set something consistent here.
730-
:language-id "haskell"
731-
:completion-in-comments? lsp-haskell-completion-in-comments
732-
:action-filter #'lsp-haskell--action-filter
733-
))
720+
(make-lsp--client
721+
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--server-command)))
722+
;; 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.
723+
:major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode haskell-cabal-mode haskell-ts-mode)
724+
;; This is arbitrary.
725+
:server-id 'lsp-haskell
726+
:synchronize-sections '("haskell")
727+
;; This is somewhat irrelevant, but it is listed in lsp-language-id-configuration, so
728+
;; we should set something consistent here.
729+
:language-id "haskell"
730+
:completion-in-comments? lsp-haskell-completion-in-comments
731+
:action-filter #'lsp-haskell--action-filter
732+
))
734733

735734
;; ---------------------------------------------------------------------
736735

0 commit comments

Comments
 (0)