reddit / emacs
Anyone using regularly lsp-mode or eglot with tramp?
gdanov · 2022-12-23 09:55
Kinda short version:
I use docker-compose for local development with JS and TypeScript.
Decided to experiment and move everything into docker - nothing mounted from the host or running on the host except emacs.
Got that working, thanks to docker-tramp. Projectile, magit, eglot, lsp-mode — all of them run. It feels super snappy. eMacs codespaces, minus the browser.
HOWEVER my bliss lasts few minutes as very quickly I get “forbidden reeentrant call” error from tramp and eglot runs out of sync and gives me irrelevant errors.
This is caused by some change tramp did for eMacs 28. There are tickets for this explaining in detail, but both lsp-mode and eglot haven’t resolved it (and it may be company-mode bug). I’m not expert on tramp and lsp, so debugging that would be big effort investment for me.
Anyone using lsp server + tramp on daily basis and have dealt with this?
yyoncho · 2022-12-23 12:07
If you want to use lsp-mode with docker there is lsp-docker, there is no need to use tramp.
gdanov · 2022-12-23 12:11
I'm aware of lsp-docker, but it takes different route — sources are mounted from the host and I don't want that.
I looked into how lsp-mode servers are configured and it seems to be flexible enough to allow me workaround it and use stdio from \`docker run\` , map paths and avoid tramp, but I don't want to go this route yet.
jsadusk · 2022-12-23 16:50
lsp-mode is broken in tramp and the lsp-mode team is not inclined to fix it. I have been using eglot however, over tramp ssh, it it works great. What issues have you been having with eglot exactly?
gdanov · 2022-12-23 17:14
this is the message "Remote file error: Forbidden reentrant call of Tramp"
just tested, happens over ssh too.
Google it, it's kinda common. While digging I saw the lsp-mode team spend lots of time debugging encoding problems over tramp so I'm with the impression they do their best actually...
JDRiverRun · 2022-12-23 20:12
Tramp has a hard job to anticipate and work with all combinations of shells, shell prompts, tool versions, transfer protocols, etc. If you are using zsh, best to simplify for the "dumb" terminal type (at the top of the .zshrc on all your hosts):
`[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return`
See also [remote shell setup hints](https://www.gnu.org/software/tramp/#Remote-shell-setup).
jsadusk · 2022-12-23 21:07
The question is what is triggering the reentrant call. I believe it's caused by simultaneous requests to tramp data from the same connection. I did make a lot of these issues go away when I made backup files save to my .emacs.d.
gdanov · 2022-12-23 21:13
yes, it's exactly the concurrent requests for the same connection that tramp decided to "discourage" with change in emacs 28. This is what the error is saying.
gdanov · 2022-12-25 08:57
After understanding bit better what I’m dealing with, I’m convinced there’s no way anyone using company-mode to be working error-free. It relies on “async” timeouts and busts the one request per connection model enforced in emacs28.
I’m sure there are other packages doing that too, so until asynchrony is addressed all across the stack, tramp use will be problematic.
I’d say lsp and eglot are not guilty, it’s architectural problem, but my understanding is limited.
SomeConcernedDude · 2022-12-27 04:16
Note that 29.1+ has built-in support for docker + tramp. tramp-container.el i think.