Setting up LSP in Emacs
Untested. I don’t use Emacs, so this is the standard recipe rather than a verified setup. If you get it working (or it doesn’t), please let me know.
With eglot, built into Emacs 29+:
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(M2-mode . ("m2-ls"))))
(add-hook 'M2-mode-hook #'eglot-ensure)
M2-mode is the major mode from Macaulay2’s own Emacs package; the server works alongside it.