12 ms·
Eglot has landed on master: Emacs now has a built-in LSP client
- rwilson4 4y agoExciting! I've happily used elpy [0] for years but it seems to be unsupported now. Might be time to switch! [0]: https://github.com/jorgenschaefer/elpy https://github.com/jorgenschaefer/elpy
- chungus 4y agoInteresting, I've been using "the other one": lsp-mode, and have been quite happy with the results. Will see how eglot has progressed and if I can slim my config a bit.
- TacticalCoder 4y agoSame here. Anyone know if eglot is "better" than lsp-mode? Or was it just picked because of some licensing reason? I was under the impression, but I may be wrong, that lsp-mode was somehow better than eglot. Also I wonder: if eglot is now part of Emacs, is there any incentive for the lsp-mode devs to keep working on lsp-mode?
- pdimitar 4y agoI forgot the details but several months ago I had a lot of trouble just having Rust and Elixir LSPs to even start. I got quite weary of hacking on my Emacs so I switched to eglot and had zero trouble since. Sorry for lack of context, I am not shilling for eglot at all, it's just that I have a huge "make it your own by hacking!" fatigue these days.
- timlod 4y agoI've used both, or rather, tried using both - lsp-mode never quite worked for me, whereas eglot is rather simple in comparison and easy to set up. lsp-mode does 'more' (and there's also an auxiliary package, dap-mode, for debugging), but I guess is somewhat more brittle because of this. dap-mode I do use, by the way (for python mainly) - functionality-wise it's my favourite debugger available in Emacs. eglot further has a single developer who already assigns copyright to the FSF (and developed other packages, like flymake, which are already part of emacs), so it has that going for it as well.
- zozbot234 4y agoThe main difference is that eglot doesn't support the complete set of LSP features yet, but those it does support are better integrated with the existing Emacs codebase and featureset. It's very much a work in progress, not aiming to be a self-contained thing like lsp-mode.
- wakeupcall 4y agoHaving alternate implementations is never a bad thing. I spent some time to get lsp-mode working earlier this year. It took me more time to declutter the amount of stuff it put on screen than what it took to setup. In fact they have a page about this https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/ https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-o... After turning off 2/3 of these, the experience has been stable and supports almost everything. I experienced clangd crashes, but lsp-mode was always able to recover. I'm not too fond of the reliance of treemacs (don't particularly like treemacs behavior in general). I just tried briefly eglot. It worked right out of the box, and the default "output" on screen seems to match what I left enabled for lsp-mode, which seems sane to me. xref integration seems to highlight methods with cc-mode (lsp-mode doesn't). Some lsp features are missing. For example I couldn't find an equivalent for "incoming call hierarchy". Not a show stopper. I would need to spend some good time to see which one provides less overhead, for example.
- morelisp 4y ago> It took me more time to declutter the amount of stuff it put on screen than what it took to setup. Same. lsp-mode is great if you want to use a distraction-filled UI that doesn't integrate with anything else in the Emacs world. My first thought on trying it was "you're showing me three epitexts by default and yet none of them are running through eldoc." A large number of people seem to want that, god help them.
- nverno 4y agolsp-mode does integrate with eldoc, you just need to configure what it shows in the minibuffer, eg. to turn of the excessive clutter, set these to nil lsp-signature-render-documentation nil ;ridiculously shows entire doc in mini lsp-eldoc-render-all nil ; if t, shows all hover info in eldoc - too much
- josteink 4y ago> Same here. Anyone know if eglot is "better" than lsp-mode? Or was it just picked because of some licensing reason? I just checked, and both are licensed as GPLv3. I guess it could be this copyright-assignment thing? Either way because of this move, I decided to try eglot over lsp-mode. First thing which happens is that eglot complains its can't find a language-server for the major-mode I'm working in now... And it does *not* offer to automatically install one. Based on this alone, I would say for OOB experience lsp-mode still seems leaps and bounds better.
- deleted 4y ago[deleted]
- jhoechtl 4y ago> First thing which happens is that eglot complains its can't find a language-server for the major-mode I'm working in now That was also my experience. Eglot wasn't able to use the installed vscode-json-languageserver for editing JSON instead insisted that typescript is is not installed. lsp-mode worked worked without any configuration out of the box
- sreevisakh 4y agoI used lsp-mode for a while and then switched to eglot. The reason was that lsp-mode has quite a lot of dependencies including helm and hydra. This can be inconvenient when you use their alternatives likes the vertico-corfu stack. I didn't want more than one extension of the same type in my configuration. eglot uses native emacs APIs for completions and tooltips. This integrates very well with vertico and corfu. > Also I wonder: if eglot is now part of Emacs, is there any incentive for the lsp-mode devs to keep working on lsp-mode? I'm pretty sure that some people will stick to lsp-mode. There are a few builtin extensions which I replaced with more popular external packages (eg: projectile vs project.el). So, I think the lsp-mode devs should keep at it.
- aardvark179 4y agoLsp mode depends on neither helm, nor hydra. I think there are some utility things that can use helm, but as far as I remember it that didn’t require that helm was set up for anything else and it has never conflicted with anything else I use.
- jacobsenscott 4y agolsp-mode does not depend on helm or hydra, or anything else really. There are optional packages that allow it to work better with those systems though. https://emacs-lsp.github.io/lsp-mode/page/installation/#vanilla-emacs https://emacs-lsp.github.io/lsp-mode/page/installation/#vani...
- wakeupcall 4y ago> (eg: projectile vs project.el). Always curious of why you prefer one of the other. Any major thing you prefer projectile? (only ever used project.el here and was satisfied) Similarly, I'm using ivy, first time I see vertico which looks similar.
- ghosty141 4y agoIt has a working switch to cpp/hpp function that you cant really get otherwise. Thats the only thing I miss from projectile.
- tptacek 4y agoPresumably eglot was picked because it's by far the more emacsy LSP client. It does most of its user-visible job by integrating with other built-in packages, like Flymake, ElDoc, project.el, and most importantly xref. Integrating lsp-mode would make much less sense, since you'd be integrating an alternative universe of packages that already have built-in analogs.
- ghosty141 4y agoFlymake is my biggest gripe with eglot. Sadly you cant really switch it out with flycheck
- tptacek 4y agoI thought this would annoy me, since I had a custom flycheck setup for years and years prior to eglot, but I haven't noticed any differences in my workflow; it just works.
- morelisp 4y agoWas `flycheck-list-errors` not part of your workflow, or do you have a decent replacement for it? Its lack is my one gripe with flymake.
- mickeyp 4y agoHave you tried `M-x flymake-show-project-diagnostics'?
- morelisp 4y agoYes; as far as I can tell it runs afoul of unresolvable project.el incompatibilities unless you're using at least Emacs 28.
- BaculumMeumEst 4y ago
- oehtXRwMkIs 4y agoAt least for web development I believe eglot is strictly worse. It does not support running multiple servers (e.g. tsserver and eslint-ls) (https://github.com/joaotavora/eglot/issues/976 https://github.com/joaotavora/eglot/issues/976) which is supported by lsp-mode and neovim's built-in lsp client. Also, it does not have any equivalent to dap-mode which is lsp-mode only. Although worth noting dap-mode is currently useless for js (https://github.com/emacs-lsp/dap-mode/issues/369 https://github.com/emacs-lsp/dap-mode/issues/369).
- PuercoPop 4y agoWhy would one want to run eslint through an LSP? Using flymake it call the CLI works just fine and is more direct.
- jrockway 4y agoWhy wouldn't you want the lint error to be highlighted right as you type the code? gopls has staticcheck and govet warnings; they are quite useful as you're typing in your code. (Though sometimes a little aggressive. My favorite is highlighting an if statement as an "empty branch" before I've had time to type in any code. I'm working as fast as I can, Mr. Linter!)
- morelisp 4y ago> Why wouldn't you want the lint error to be highlighted right as you type the code? eslint's flymake integration can do this without any language server commitments. LSP maybe offers some performance advantage - but IMO that says more about eslint than LSP or flymake.
- PuercoPop 4y ago> Why wouldn't you want the lint error to be highlighted right as you type the code? Why do you think you need to involve an LSP for that?. ESLint, as most linters, can take their input from stdin. That is exactly how the eslint-flymake[0] works. Lint on buffer contents, not file on disk. No JSON RPC involved. 0: https://github.com/emacs-pe/eslint-flymake/ https://github.com/emacs-pe/eslint-flymake/
- PuercoPop 4y agoEglot was written with the explicit goal of landing into Emacs. Which is why from the start it required copyright assignment for non trivial changes. Landing into Emacs core was never a goal for lsp. So it wasnt a choice between eglot vs lsp. It was eglot, yay or nay.
- eddieh 4y agoIf Eglot is the Emacs blessed package I'll probably start using it over lsp-mode, but seriously how do I pronounce "Eglot"? Egg Lot? Ah-lot? A-lot? Ehh-lot? Eh-glot? I never tried Eglot simply because the name made me think it was less serious.
- rogual 4y agoE as in Emacs, glot as in polyglot?
- eddieh 4y agoThat sounds too close to EGOT https://en.wikipedia.org/wiki/List_of_EGOT_winners https://en.wikipedia.org/wiki/List_of_EGOT_winners
- frou_dh 4y agoThe clever thing is that it's also eglot as in polyglot.
- FPGAhacker 4y agoThat makes sense, and never occurred to me. I was in the egg-lot camp
- yellowapple 4y agoI'm partial to rhyming it with escargot, myself.
- codeflo 4y agoI’ve been wanting to learn Emacs for 20 years. Is now finally the time?
- noelwelsh 4y agoI put the question to the Emacs magic eight ball (https://github.com/RyanMatlock/eight-ball https://github.com/RyanMatlock/eight-ball) and the answer was yes!
- tsuru 4y agoYes.
- radarsat1 4y agoThe thing is that you can learn it very incrementally. I've been using it for years and don't know more than a tiny bit. My knowledge of elisp is abysmal. But, you get to learn how to add little things to your config here and there when you find something worth trying or improving. Meanwhile I recommend just learning the vanilla defaults as best as possible. As long as you know how to open files, save things, switch between buffers, and quit, you're kind of good to go as far as immediate usability goes. Eventually you learn a few more key bindings to make navigation easier and faster, how to use macros, shell commands, etc. But you can learn these things on an as-needed basis.
- mickeyp 4y agoAgreed. This is really good advice.
- gumby 4y agoOne of the offputting things about emacs is the enthusiasm directed to beginners to customize, pick a "distro" and basically overwhelm people when starting. It's a shame because what's wrong with enthusiasm? But you can start using emacs with a handful of commands. Just typing puts characters into your buffer; c-f goes forward a character, c-b back a character, c-p goes the previous line, c-n goes to the next. c-x c-s saves the buffer into a file while c-x c-f finds a file by name and makes a buffer containing its contents. These commands have existed since I started using Emacs about 45 years ago! Emacs is full of help. Press c-h for help -- it will prompt you for what you want help on. Every keystroke, every command, even "how did I get here" is in your help. Over time you'll learn more commands, perhaps put something in your init file...and eventually it will be like a comfortable glove designed to fit your hands (which will stay on the keyboard, right?)
- j_m_b 4y agoWhat's the difference between egplot and lsp-mode? Why was it what the emacs devs settled on?
- clircle 4y agoEglot has copyright assigned to FSF and has been targeting a master branch merge since its development started.
- honkob 4y agoEglot is a bit of a smaller implementation and from my experience tends to require a bit less configuration than lsp-mode. I think eglot was settled on as the developer of eglot specifically put in the effort to make sure people did copyright assignment so it could be easily merged into the emacs master
- e3bc54b2 4y ago*eglot (short for Emacs polyGLOT) And major difference is eglot is slimmer compared to lsp-mode, integrates with and relies on built-ins more (xref etc) rather than inventing its own paradigm, is less cluttered by default and IME less buggier than lsp-mode cludge and now comes with emacs so doesn't need any other packages (other than language servers themselves, of course). OTOH lsp-mode supports more than 1 active language server per buffer, generally support more features of the protocol than eglot and installs servers automatically (which may be a feature or bug depending on your system). It comes down to utility and personal preference, but I've used lsp-mode before, found it quite buggy and cluttered, moved to eglot and have near zero LSP config now.
- josteink 4y ago> egloty ... now comes with emacs so doesn't need any other packages (other than language servers themselves, of course). One of the things I love about lsp-mode is how it automatically installs any language server I need, when I need it. I would rather install one package and be done, than use one built-in package, and have to manually hunt, download, and manually maintain language-servers for all the different languages I'm using in my programs, on all the machines I do programming on. If eglot wants to become the defacto standard, it will need to solve this sooner rather than later. But I suspect RMS will be opposed to having Emacs automatically download "non-free" (not GPLed) code?
- frou_dh 4y agoThe next major release of Emacs is going to be awesome, because among other things the so-called PureGTK work was also merged, which means that it will support HiDPI screens properly on Wayland.
- NeutralForest 4y agoI'm using it right now!
- josteink 4y agoEmacs 29 also aims to introduce experimental support for tree-sitter[1], although it will probably be hidden behind a configure-flag. This should enable us to create better, faster parsers for popular languages where the Emacs-support so far has not been that great. So yeah I second that. Emacs 29 is going to be a great release! [1] https://github.com/tree-sitter/tree-sitter https://github.com/tree-sitter/tree-sitter
- mickeyp 4y agoI wrote about the importance of tree sitter a while back, for people who don't know why Emacs would adopt it: https://www.masteringemacs.org/article/tree-sitter-complications-of-parsing-languages https://www.masteringemacs.org/article/tree-sitter-complicat...
- bloopernova 4y agoThank you for a clear and informative article! (And thank you for your wonderful book and website, they've both made my life in DevOps more enjoyable and effective)
- mickeyp 4y agoThank you :) I'm glad you like the book and site! That makes me very happy.
- sph 4y ago
- NeutralForest 4y agoSo glad, there's a branch for tree-sitter as well =)
- bigbillheck 4y agoDespite the last-minute efforts of RMS: https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg00029.html https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg00...
- sph 4y agoYour comment makes it sound like RMS tried to stop it from getting merged into core. Whereas the mail in your link just shows that RMS wanted to discuss whether it should have a generic "LSP" name or not (i.e. retain the original eglot name), which is a valid concern.
- bigbillheck 4y agoHere's him suggesting delaying the release until January: https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg00181.html https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg00...
- sph 4y agoAgain, it's because of naming consistency, which one can agree with or not. My issue was your comment just pointed at RMS without specifying what he was being boneheaded about this time, which I thought was a little flamebaity.
- vfclists 4y agoThere only two hard things in computer science: This first is naming things The second is getting emacs-lisp to hold hands with the rest of the world
- didibus 4y agoI actually feel the name is the worst part of eglot, it's not like it's a generic polyglot thing, it's really an lsp mode, it'll be one more of those hard to discover Emacs features because of this.
- 4y ago
- hendrikrassmann 4y ago2023 will be the year of emacs on the desktop.
- fooker 4y ago* desktop on emacs. FTFY
- omnicognate 4y agoWith EXWM, Emacs has been my desktop for years.
- fithisux 4y agoHuge
- mnutt 4y agoI use eglot (via doom emacs) and it works but configuration always feels like a slog--the language server it wants to start is often not in the PATH, or is configured incorrectly or something. Javascript's eslint/prettier/tsc are particularly finicky. I'd love to have some method to denote that the presence of .eslintrc/eslint in package.json means run format-on-save, otherwise don't. But I also can't really see how it could be _that_ much better on any other editor?
- tikhonj 4y agoI've had a good experience with direnv[1] and emacs-direnv[2]. Direnv can automatically load an environment when you enter a directory, so it automatically "opens" virtualenvs/nix shells/etc. The Emacs direnv mode ensures that each buffer sees the direnv mode for its project directory. I've found this to be a great compromise between automatic behavior on the one hand and transparency + control on the other—I get the right environment loaded automatically very consistently and, if something goes wrong, I can open a shell and poke around to see what's going on (is my nix shell messed up? is the right tool not loaded via direnv? etc). The only time I need to do anything manually is if I make a change to the environment and need to update Emacs about it, in which case I just run M-x direnv-update-environment. Once I got this set up, I can just rely on executable-find to check for (and find) exactly the right tool on a per-project basis—no more worrying about global or seeing the wrong version of a tool. This also made it easy to do stuff like only run formatting if the corresponding tool is available: I add hooks to various programming language modes that only turn on lsp/formatting/etc if executable-find sees the corresponding executable. Compared to the hassle I've had to go through helping my colleagues debug VSCode not seeing the right conda environment, virtualenv or the right version of various tools, Emacs + direnv has been a far nicer and more consistent experience. [1]: https://direnv.net/ https://direnv.net/ [2]: https://github.com/wbolster/emacs-direnv https://github.com/wbolster/emacs-direnv
- mcbuilder 4y agoYeah, I've been doing the same thing. direnv is such a KISS tool, and is language agnostic as well. My prior experience with LSP wasn't exactly pain free, so it's definitely smoothing a rough patch. Having Elgot in master is great if makes the out of box experience work. I use VS code for a couple days and I will already want to go back to Emacs, and having a good LSP experience is pretty important for either.
- zarkov99 4y agoWith eglot and lsp-mode emacs, for me, has feature parity with vscode for c++ local development. Unfortunately for remote work tramp is still a nightmare and vscode far ahead.
- nine_k 4y agoBut VSCode has a very different model than Tramp: a remote server part, not just remote file access. Technically you can run an Emacs server remotely, and connect to it with the UI client. But the setup is going to be much more involved.
- deleted 4y ago[deleted]
- zora_goron 4y ago> Technically you can run an Emacs server remotely, and connect to it with the UI client. But the setup is going to be much more involved. Any pointers on how to get started with this?
- spudlyo 4y agoI'd like to be wrong about this, but after some investigation I've conclused that this is not the case. The Emacs client/server model assumes that the client and server are on the same host. It doesn't work over the network.
- nequo 4y agoI haven't tried this myself but would it be possible with ssh port forwarding? Here is someone who seems to have done it: https://mina86.com/2021/emacs-remote/ https://mina86.com/2021/emacs-remote/
- dan-robertson 4y agoI think the protocol between emacsclient and the server basically just allows for instructing the server which file to open and passing around things like which X display to open an x window on. I’m not sure how it works for the terminal interface (does it pass the fd over a Unix display socket or have Emacs send bytes over the protocol to the emacsclient?) I once tried to set up some hacked bash script instead of ssh which would set up environment variables and forward the Emacs daemon socket over ssh so that if I remotely attempted to edit a file, my local Emacs would open that remote file over tramp. But the whole thing was kinda nasty. I do want a ‘thicker’ emacsclient though but mostly because of the end of X windows as I currently use Emacs remotely with X forwarding over ssh.
- Myrmornis 4y agoMy biggest concern about this is that now it is in Emacs, there's no easy way to contribute to it, or follow development. Previously it was on GitHub and there was zero friction to contributing other than figuring out your elisp changes. But now, I think that Issues in the github site are discouraged, and so there will be no convenient way of watching issues and feature requests raised against the project, or of following discussion of proposed patches and code review. In principle of course, these things are possible by using old issue tracking applications and following often dysfunctional/cantankerous discussions in a email list, both of whose scope is the whole of emacs.
- db48x 4y agoEmail is Email. Either you reply to an email from Github or an email from the mailing list.
- Myrmornis 4y agoYou don't use GitHub/GitLab/SourceHut/Codeberg by "replying to emails". You use them by: - pushing branches to your own fork so that others can see your work while it's in draft form - opening PRs against the main project, and writing a nice PR introduction describing the changes that you've made, their background, and motivation, drawbacks and hesitations, etc. - participating in a feedback conversation with the maintainers and other developers with comments attached to specific lines in the code (at a specific revision), as well as attached at diff level - having the project CI run against your branch to check that all tests pass, across a collection of different OSs and architectures. (You can also run their CI in your own fork to check it works there before even opening a PR). - opening Issues, and discussing with other developers - having the ability to write your text comments along with images, videos, and syntax-highlighted code fragments. - and many other things
- rekado 4y agoYou can still do that with your fork on a forge. And all that other stuff relating to communication (commenting on specific lines of a change set, writing a nice introduction describing the changes you've made, discussing with other developers, etc.) is possible just as well with a patch-via-email workflow.
- tgerdin 4y agoAwesome