Skip to content

Commit 2497ca1

Browse files
committed
Add temporary eglot-server-programs workaround for neocaml
Older neocaml versions don't register with eglot-server-programs, so eglot doesn't know to start ocamllsp. This workaround adds the entry if neocaml hasn't done it already. Safe to remove once neocaml >= 20260331 is widely available on MELPA.
1 parent 5fbde9f commit 2497ca1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/prelude-ocaml.el

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,21 @@
5151
;; get the same setup.
5252
(use-package neocaml
5353
:ensure t
54-
:hook (neocaml-base-mode . prelude-ocaml-mode-defaults))
54+
:hook (neocaml-base-mode . prelude-ocaml-mode-defaults)
55+
:config
56+
;; Workaround: register neocaml modes with eglot until neocaml
57+
;; ships this fix itself (neocaml >= 20260331). add-to-list is
58+
;; a no-op if the entry already exists.
59+
(with-eval-after-load 'eglot
60+
(unless (cl-some (lambda (entry)
61+
(and (consp (car entry))
62+
(assq 'neocaml-mode (car entry))))
63+
eglot-server-programs)
64+
(add-to-list 'eglot-server-programs
65+
'((neocaml-mode :language-id "ocaml")
66+
(neocaml-interface-mode
67+
:language-id "ocaml.interface")
68+
"ocamllsp")))))
5569

5670
;; OCaml-specific Eglot extensions (requires ocaml-lsp-server).
5771
;; Only installed when Eglot is the configured LSP client.

0 commit comments

Comments
 (0)