this post was submitted on 24 Nov 2023
2 points (100.0% liked)

Emacs

305 readers
3 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hi, I’ve been banging my head against something and I figured I’d ask for help.

I open files over tramp and use a remote login machine to do that. Said login machine is shared by many people and thus I can’t run a language server on it. I’d like to use eglot but don’t want to run the language server on it.

I’ve been trying to either run the language server on a computer machine (another remote one) or on my local Mac (Mac would be preferable).

Has anyone managed to point a language server running on a local Mac to files over ssh?

top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 9 months ago (2 children)

Wouldn't it be simpler to just dev locally and then rsync the files?

[–] [email protected] 1 points 9 months ago

This is what I do, I also use tramp pretty extensively but it's the exception not the rule so subpar completion once in a while is fine with me

[–] [email protected] 1 points 9 months ago

That would work. However, it would be a pretty dodgy thing to do from a security perspective. Since this is a work related query, I am pretty hesitant to do that.

[–] [email protected] 1 points 9 months ago

You could mount all the files with sshfs and point the language server at that.

[–] [email protected] 1 points 9 months ago

as long as those files are opened via tramp, there is no way to do that, unless you patch tramp.

[–] [email protected] 1 points 9 months ago (1 children)

is emacs running on your local lap/desktop? Or are you running it on a machine you ssh'ed into ? And that from that machine, you tramp into another?

Tramp is just filling the buffer with under the hood calls to `scp` if the code is in you local machine's buffer, I don't see how the eglot would not work.

If you are not running emacs on your local Mac, you should try to do so. So start emacs on your local Mac and try to do a multi-hop tramp:

C-x C-f /ssh:bird@bastion|ssh:you@remotehost:/path

the hops can be any level, but, more levels means more lag. I don't have time to test my theory now. Might do so over the weekend.

[–] [email protected] 1 points 9 months ago (2 children)

Yes eMacs is running on my local laptop.

If I try running eglot on a local file (on my laptop) all is well - it immediately finds the language server binary and runs it fine.

However, if attempt it on a remote file (opened over tramp) it says it can’t find the binary and prompts me to point it at it. I could do that, but then the language server would start on that same machine and that’s a no go since it’s a shared login machine.

So ideally I’d be able to tell it to use a language server running on my laptop but have been unable to get that to happen.

[–] [email protected] 1 points 9 months ago

oh, that sucks. I did not understand the LSP's requirements:

https://emacs.stackexchange.com/questions/76311/can-i-use-a-local-language-server-for-remote-files

the language servers are pretty simple C/C++ programs. If you have access to gcc/g++ on the target machine, you could try compile/running them in the BG just as a command line prgram. you would not need to `sudo blah install` anything.

[–] [email protected] 1 points 9 months ago

However, if attempt it on a remote file (opened over tramp) it says it can’t find the binary and prompts me to point it at it. I could do that, but then the language server would start on that same machine and that’s a no go since it’s a shared login machine.

How would the local language server inspect a file which is on some other machine?

You should start by establishing how that is going to work, and add that information to your question.