reddit / emacs

Eglot appreciation post

soumya6097 · 2022-06-08 12:14
I have been using lsp-mode for almost two years now with lot of tweaks, optimization and so on. Unfortunately, it is still not stable over Tramp and I don't see it getting better in coming years. Today I tried eglot for python and it just works flawlessly over tramp. No tweaks, no pain just smooth. Now I think that eglot guy is winning the beef with lsp-mode.
FrozenOnPluto · 2022-06-08 12:36
Post your eglot config, if theres anything interesting in an eglot config? (Last time I tried it was a couple years ago, don’t remember anything :)
soumya6097 · 2022-06-08 12:39
M-x eglot. It works over tramp :) . I have nothing related to eglot in my config file
FrozenOnPluto · 2022-06-08 12:40
Wow :) I’ll give it another swirl, as I live in tramp mode (though lsp has done okay for me, mostly)
soumya6097 · 2022-06-08 12:42
Same experience with LSP for me. Mostly works.
mauguro_ · 2022-06-08 13:23
any experience on js/ts/jsx/tsx with eglot? I've been using lsp but idk if should try eglot
soumya6097 · 2022-06-08 14:28
Nope. I am a python charmer :D. If you don't feel the need to switch then lsp-mode is working for you.
servingwater · 2022-06-08 14:37
Tramp always hangs for me unfortunately. Perhaps I'm spoiled from vscode's ssh-remote plugin, which for me works so much better and without fuss.
soumya6097 · 2022-06-08 14:51
Yes it's true for LSP. Eglot gave me some hope but I don't know when or how can it reach vscode level.
pathemata · 2022-06-08 15:04
by the way, has anyone tried [https://github.com/manateelazycat/lsp-bridge](https://github.com/manateelazycat/lsp-bridge)? how does it compared with `eglot`?
paretoOptimalDev · 2022-06-08 15:20
It'll take more people being constructively frustrated and making good bug reports and patches I bet.
akirakom · 2022-06-08 15:58
I'm using eglot on ts/tsx. For TSX, you will require some extra settings, but it works.
brotzeitmacher · 2022-06-08 16:49
I guess it's not realistic that emacs will be able to compete with microsoft. Unless more people realize it's not a good idea to support them, but I really doubt that will happen. Most people prefer comfort and conformity.
TheFrenchPoulp · 2022-06-08 16:59
This is what I use daily on a (very) large TypeScript codebase - Eglot: https://github.com/angrybacon/dotemacs/blob/master/dotemacs.org#language-server-protocol - Tree-sitter: https://github.com/angrybacon/dotemacs/blob/master/dotemacs.org#tree-sitter - TypeScript (you'll only need the `typescript-mode` configuration): https://github.com/angrybacon/dotemacs/blob/master/dotemacs.org#javascript
[deleted] · 2022-06-08 17:33
[deleted]
soumya6097 · 2022-06-08 17:33
For me emacs is only lagging in language servers that too over tramp. Apart from that I don't see any lack of features here. Even it does more and far superior. About MS, I don't care. They are not the best at anything.
wargxs · 2022-06-08 17:45
Strange … tramp is super stable for me while I had trouble with vscode … in addition vscode has to install a server on the remote machine which can go horribly wrong …
wargxs · 2022-06-08 17:48
I tried vscode because everyone seems so happy at work but I only had problems … with eglot it is easy to diagnose what goes wrong should this happen but with vscode it is quite difficult… maybe if you write lots of JavaScript …
servingwater · 2022-06-08 18:00
tramp only works (for me anyways) for small remote edits. But for all out remote developing with full features and all necessary plugins activated, it always failed for me. And if I just want to do small text edits, I can just use vim real quick. On the other hand remote development with vs-code is as polished and fully functional as it gets IMHO. Never had the remote install of a the vscode server go horrible wrong, not even wrong at all. It just works. It is the killer feature, IMO, that vscode has over practically every other editor or even IDE out there. None can provide such a clean and great remote dev experience. Only other options would be code directly on the remote server after connecting to it and run a local install on that server of vim or emacs with terminal mode.
wargxs · 2022-06-08 19:21
Btw I think we are very lucky that we have two fantastic lsp implementations for emacs
takeonrules · 2022-06-08 23:53
Same experience here.
carnivorousdrew · 2022-06-08 23:58
I tried it with pylsp today but can't find definitions or references :/ says the server I'm using does not support them, uet works fine with lsp mode
bugamn · 2022-06-09 06:14
I don't know if it is worth changing your lsp server, but I use lsp-pyright and eglot worked without a hitch.
carnivorousdrew · 2022-06-09 06:37
do you mind sharing your config for that?
bugamn · 2022-06-09 07:05
It doesn't have much: (use-package eglot :ensure t) (use-package lsp-pyright :ensure t :hook (python-mode . (lambda () (require 'lsp-pyright) (lsp-deferred))))
nullmove · 2022-06-09 10:11
Try enabling ssh ControlMaster/multiplexing to see if it helps (it helps me a lot). Basically by default Tramp necessarily needs to open (and close upon finishing) new ssh connection for every operation, which comes with ssh overheads like handshake and such. But when ControlMaster is enabled, openssh persists the connection for a while even after finishing, so that next time it can continue to re-use same connection.
onetom · 2022-06-09 10:19
can you share your related configuration, please? I've gathered, there are issues with TRAMP's built-in control-master related customization options and ppl recommended to enable control master via ~/.ssh/config. (If I understood correctly; they haven't shared a config example either)
nullmove · 2022-06-09 12:05
I am not sure if configuration in either side is enough on its own, but just to be safe I enable it in both sides. My tramp config is: (use-package tramp :config (setq remote-file-name-inhibit-cache 600 enable-remote-dir-locals t) (setq tramp-ssh-controlmaster-options (concat "-o ControlPath=/tmp/ssh-%%r@%%h:%%p " "-o ControlMaster=auto -o ControlPersist=10m")) (setq tramp-histfile-override t) (add-to-list 'tramp-remote-path "~/.local/bin/") (add-to-list 'tramp-remote-path "~/bin/")) And then in ~/.ssh/config to the correspondent machine, I do the same thing again: Host dev HostName .... StrictHostKeyChecking .... User .... IdentityFile .... ControlMaster auto ControlPath /tmp/ssh-%r@%h:%p ControlPersist 10m
onetom · 2022-06-09 12:09
thanks a lot! how about ssh-agent forwarding? how do you update your remote git repo? do I understand correctly, that you have an unencrypted ssh key on your remote machine, called "dev"?
nullmove · 2022-06-09 12:16
The ~/.ssh/config and the key used therein is in local machine. I am not sure I understand why I would need ssh-agent forwarding? As for updating remote git repo, I just open magit in tramp and work on the repo in remote machine as if it was local. Did you mean something else?
onetom · 2022-06-09 12:18
btw, my main issue regarding tramp was the fact that I didn't have my environment generated by direnv, via the https://github.com/purcell/envrc package. I use direnv almost exclusively to activate my nix-shell, so I can access the exact software dependencies required by that directory of a project. seeing tramp-remote-path in your example gave me some direction for debugging the issue further
nullmove · 2022-06-09 12:26
Sorry I don't use direnv, but you might get same functionality by using `.dir-local.el` in remote side which Tramp respects in my config. Setting buffer local environment var through .dir-local is tricky but likely do-able: https://emacs.stackexchange.com/questions/35964/how-can-i-get-buffer-local-environment-variables-via-dir-locals
younger-1 · 2022-06-10 03:51
I want to shout out to you try this third LSP implementations for emacs: https://github.com/manateelazycat/lsp-bridge Not mature yet(dev is fast) and capable of many usage and integrated well with corfu/company
younger-1 · 2022-06-10 03:52
but not support Tramp
to1ne · 2022-06-14 10:44
I tried it on golang for a while. Sometimes the completion mingled up, which annoyed me too much. So I went back to lsp, but it slows down my emacs way too much, so now I'm at eglot again. So I have to agree with the OP.
to1ne · 2022-06-14 10:46
I definitely have seen some performance improvement, but yes, there are some immaturities take made it hard for me to keep using.
6111772371 · 2022-07-01 13:59
LSP works over tramp with no configuration? Are you sure? With e.g. pyright? Or what language server?
6111772371 · 2022-07-01 14:01
Using sshx instead of ssh with Tramp made a massive difference for me, not sure if this is related?
Sad_Entry9267 · 2022-08-05 12:37
This issue has fixed by newest version of lsp-bridge.
FreeAd7233 · 2022-09-27 16:51
LSP bridge is the most performant one. The mainly reason is that it’s completion is completely async by using its own framework: acm. In contrast to the builtin capf, used by both LSP-mode and Eglot.