3

Why there is no language server protocol for the emacs-lisp language? For example, the lsp-mode package for Emacs contains support for many languages with their respecting language servers. But no emacs-lisp.

Why is that so?

The same goes for the eglot package too.

Drew
  • 29,895
  • 7
  • 74
  • 104
Refael Sheinker
  • 713
  • 7
  • 20

1 Answers1

8

If there is no language server available for a given language, that is because no one has been sufficiently motivated to go to the effort of writing one.

I'm sure if anyone wants this badly enough, they'll write one; but very few people who don't use Emacs are likely to be interested in writing a language server which is of almost no benefit to non-Emacs users; and for people who do use Emacs, Emacs has always provided a pretty robust development environment for writing Emacs Lisp, and I imagine most people feel that's already good enough.

Also bear in mind that the development environment "Emacs" and the normal runtime environment for the programming language "Emacs Lisp" are the same program. Which is unusual. So Emacs isn't reliant upon any external program like a language server to tell it things about the language.

I do recall this topic coming up in the development lists, and some people felt that the primary benefit to an elisp language server would be to people using editors other than Emacs and that efforts would be better directed at improvements to Emacs. There wasn't a general agreement on that, but nevertheless it probably reduces the pool of people who might feel the need to work on such a project in the first place.

Y. E.
  • 687
  • 1
  • 10
  • 29
phils
  • 71,335
  • 11
  • 153
  • 198
  • I understand what you are saying is like this: "Emacs itself has such great features and support and not what for the Elisp language that you don't really need an LSP". Am I correct? If yes, then here is my counterargument: I tried googling for the simplest things to do on an Elisp buffer and could not find anything. How do you do formatting (not indenting)? Go to definition? Hover? I must be using the wrong keywords for my google searches. – Refael Sheinker May 08 '23 at 10:29
  • 1
    Format manually. `find-function` and `find-variable` (or `xref-find-definitions`). I don't know what you want from "hover". I'm sure you won't find equivalents for all LSP features, but I think that such absences are not necessarily going to prompt anyone to write a language server. (I believe LSP is less than a decade old, and people have been happily writing Emacs Lisp for three decades more than that.) – phils May 08 '23 at 11:03
  • 1
    Of course someone may already be working on one for all I know -- there's no technical reason why one couldn't be written, so all it takes is someone who wants it badly enough to do it. I'm not currently aware of such a project, though, and I'm mostly just trying to point out why it might not be a high priority for many people. – phils May 08 '23 at 11:13
  • "I'm sure you won't find equivalents for all LSP features" - I must say it bothers me greatly. All those LSP feature are making the life of the developer much easier. "Format manually" - I dont want to do it manually, we have computers for that :-) It truly does pick my interest why there is no LSP like facilities for Elisp. – Refael Sheinker May 08 '23 at 11:32
  • Please edit your answer with examples of "Emacs has always provided a pretty robust development environment for writing Emacs Lisp". Thank you in advance. – Refael Sheinker May 14 '23 at 20:14
  • 1
    I don't know what it is that you want, sorry, and I'm not going to try to enumerate all the editing features in Emacs. – phils May 14 '23 at 22:18
  • "I don't know what it is that you want, sorry, and I'm not going to try to enumerate all the editing features in Emacs." - Here are a few examples of what an LSP server provides: go to definition, hover, parameters, formatting. UPDATE: Aaaand now the light bulb hit me! I managed to find the proper google search keyword to replicate all the functionality of an LSP using vanilla Emacs. For example: "emacs elisp go to definition" and/or "emacs elisp hover" and etc. – Refael Sheinker May 15 '23 at 12:25
  • One more [argument against Elisp LS](https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00720.html): "pay the price of serializing from/to JSON, RPC, and having an inferior process running all the time when the introspection capabilities of Emacs can provide the same capabilities". – Y. E. May 21 '23 at 12:48