Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote code editing via distant #3721

Closed
chipsenkbeil opened this issue Sep 6, 2022 · 25 comments
Closed

Remote code editing via distant #3721

chipsenkbeil opened this issue Sep 6, 2022 · 25 comments
Labels
A-plugin Area: Plugin system C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.

Comments

@chipsenkbeil
Copy link

Curious if there's been any thought to offering remote code editing support similar to https://code.visualstudio.com/docs/remote/remote-overview.

I've been working on a project for a couple of years called distant with a plugin (distant.nvim) geared to leverage it to introduce remote coding editing support to neovim.

Since helix is written in Rust, it could leverage directly the libraries that distant offers to enable remote editing - including remote LSPs and shells - through both ssh and the distant protocol.

@chipsenkbeil chipsenkbeil added the C-enhancement Category: Improvements label Sep 6, 2022
@archseer
Copy link
Member

archseer commented Sep 6, 2022

Wouldn't using something like sshfs to mount the remote fs be sufficient?

@chipsenkbeil
Copy link
Author

chipsenkbeil commented Sep 6, 2022

@archseer, here's some of the primary differences that come to mind at the moment:

  1. Filesystem: sshfs is built using FUSE, meaning that you need support for it as a userland filesystem. Having a native integration (i.e. like distant.nvim for neovim) requires no special filesystem as the file contents are only reflected in buffers. Anything you read goes into a buffer and anything you write gets transmitted across the network to the remote file.
  2. Program locations: having a direct integration supports running programs on the remote machine, colocated with your files. Language servers would run on the remote machine, for instance. When using sshfs to mount the remote file system on your local machine, you would then run programs locally and point them to the mounted files.
    • i.e. with distant.nvim, you are leveraging the resources of a remote machine. This can be advantageous if you want to perform CPU or GPU intensive operations without heavily impacting your local machine.
    • With sshfs, you are leveraging the resources of a local machine for programs that you run. Depending on what you're doing, this can be much more expensive. If a program needs to access the filesystem frequently, this would transmit a lot of requests over the network, especially if working over a large set of files. With distant.nvim, all of the filesystem operations would happen directly on the remote machine and only the program's output would be transmitted over the network.
  3. Singular connection: instead of needing to maintain a separate connection for a shell using ssh alongside your filesystem being mounted via sshfs, having an integration like distant lets both being transmitted over the same network connection. This can be handy when you need to perform extensive authentication prior to connecting and want to avoid managing multiple connections.

There are other technical differences, but the distinctions above are - at the moment - the differences that stand out. In some cases, using sshfs might be preferred, but for my use personally and at work this is the preferred method as language servers and other utilities cannot be run locally. :)

If you want to think of what this more closely relates to, then take a look at VS Code Remote Development or the formerly-active Nuclide.

@silvergasp
Copy link

silvergasp commented Sep 7, 2022

I don't know anything about distant. But I regularly use vscode remote. As helix is more of a tui text editor wouldn't it make more sense to install it on your dev server and ssh into it? I know sshfs was mentioned but why not just plain old ssh? For reference the vscode-remote server is already bigger than the helix editor. I'm curious as to what use case you couldn't meet by doing this.

I think the case for vscode-remote is a little different as it is a web-based GUI rather than a TUI. It might be worth considering in more detail when/if helix gets a GUI?

EDIT: I'm not a dev here, just a curios user.

@chipsenkbeil
Copy link
Author

@silvergasp good questions! The remote code functionality is agnostic to whether you use it with a terminal editor or a graphical editor.

Now, you bring up a good point about an advantage of terminal editors is that you can install and run them on remote machines more easily than a graphical editor.

The reasons that I've found a solution like this preferred - and many of my coworkers as well - are that the latency of your network doesn't affect your typing experience and similarly disruptions of your network don't fully block you from editing.

I worked on a bus to and from work for many years before 2020 and the network reliability was poor, causing tools like ssh to yield a broken pipe and mosh to freeze frequently waiting for the connection to re-establish. In contrast, VS Code's remote development feature let me continue working on a file without having my cursor and text freeze as I went in-and-out of networks.

For some of my colleagues, they live and work in locations where networks are poor, meaning that they cannot maintain a reliable ssh connection and mosh causes their editing experience to be nearly unusable as it frequently would cut out for ~10-15 seconds.

@chipsenkbeil
Copy link
Author

Oh, and while this may not be as relevant to Helix, another reason is to avoid needing to copy your configuration files over to another machine. With ssh, to get the same experience with your editor, you have to copy your configuration files and plugins over to the other machine. In contrast, VS Code's remote editor and other offerings like distant let you avoid that and maintain your configurations on your local machine, only outsourcing programs and source code to the remote machine.

@silvergasp
Copy link

Oh yeah, that seems reasonable. I'd definitely be keen on an improvement in latency/consistency!

@kirawi kirawi added the A-plugin Area: Plugin system label Sep 10, 2022
@kirawi
Copy link
Member

kirawi commented Sep 10, 2022

Tentatively marking as a plugin unless otherwise changed.

@jfaz1
Copy link

jfaz1 commented Sep 20, 2022

Wouldn't using something like sshfs to mount the remote fs be sufficient?

I use SSHFS at work with Helix and it's almost enough to make me contemplate going back to VS Code (for work) 😆

The connection is stable, the main issue is I can't use the file picker or global search because there are so many files on the remote server it hangs Helix for minutes at a time, sometimes even crashing it. Even just typing :o <space> out of muscle memory makes me need to restart the editor. It's a big repo (not as big as you'd think) but even small ones are plagued by this problem. I'd definitely appreciate a solution for this!

@dead10ck
Copy link
Member

Even just typing :o out of muscle memory makes me need to restart the editor. It's a big repo (not as big as you'd think) but even small ones are plagued by this problem.

Not to hand wave the issue, because there is room for improvement there, but this sounds unusual. Are you sure there isn't a problem with IO on your server?

@jfaz1
Copy link

jfaz1 commented Sep 21, 2022

Not to hand wave the issue, because there is room for improvement there, but this sounds unusual. Are you sure there isn't a problem with IO on your server?

Yeah, we route our network through a VPN which isn't the fastest, which will definitely slow things down. But even then I added an exception out of curiosity and while it was noticeably faster, was still unusable in the grand scheme of things. For context, opening the file picker in the fully cloned local repository takes around a second. So it's definitely a large repo. But I tried some more manageably-sized repos and it was still pretty sluggish.

@taylorpool
Copy link

Hi all, just curious if there have been any updates on this issue. I love Helix and am very interested in using this feature.

@chipsenkbeil
Copy link
Author

Hi all, just curious if there have been any updates on this issue. I love Helix and am very interested in using this feature.

I haven't revisited yet. Distant is maturing more and more over time. One of the last major features was persistent connections, meaning that if you lose your connection with the remote machine, it will be able to reconnect later without any extra work or reauthentication from the user's side.

I'd be happy to work with someone on the helix side to integrate this. Either by just supporting the client-component of the library, or even making it where having helix on both machines would let you set up helix as a server for other helix instances to connect to.

Either way, going to let the folks from the helix side reach out if there's interest and availability. :)

@luigifcruz
Copy link

I have another use case for this. I have to access servers that are on the other side of the planet. The latency between my machine and the server is often higher than 300 ms. This can be very annoying while trying to type on a terminal-based IDE, like Helix. The remote feature proposed by this issue has the potential to ameliorate these latency issues.

@beegan
Copy link

beegan commented May 23, 2023

I also see a benefit to this. I have a remote environment running on Amazon Linux 2 that comes packaged with glibc 2.26

As a result, helix can't be run natively there so support for running it remotely from my actual device would be a super handy workaround.

@kirawi kirawi removed their assignment Jun 6, 2023
@kirawi kirawi added the S-needs-discussion Status: Needs discussion or design. label Jun 6, 2023
@shane-tran-whitmire
Copy link

Another benefit would be for development on older systems that cannot support helix. I am using debian 9 (I know, don't tell me it sucks), and literally cannot install it. Would be nice if I could ssh into the system with helix.

@pascalkuthe
Copy link
Member

helix runs just fine on older systems you just have to compile it yourself.

@shane-tran-whitmire
Copy link

shane-tran-whitmire commented Jun 30, 2023

helix runs just fine on older systems you just have to compile it yourself.

I might be a bit of an idiot, but I blew up (boot loader went bye bye) a system trying to get a new enough version of c++ to compile helix onto that system. My resolution was just to give up trying to get helix to run on debian 9.

@pascalkuthe
Copy link
Member

That shuldn't happen. iiirc all C++ compilers released since 2015 rhold support everything we need so I am surprised it doesn't work out to the box. It can be a bit of a pain to get newer compiler sunning but I bootstrapped clang-15 on centos 7 so it's definitely possible. There are probably existing docker images for this. I would not recommend messing with a live system.

I use this docker image to build my other rust projects for ancient glibc versions. I am not sure if it has everything helix has but you could try that if you don't find anything else

@gyzerok
Copy link

gyzerok commented Jul 1, 2023

Since potentially many of us are subscribed to the issue to see updates on the remote functionality, I kindly ask you to move unrelated discussions somewhere else to avoid unnecessary notifications for everybody.

@nyabinary
Copy link

Zed is now open source.
Maybe we can look and see what Zed did?

@TJTorola
Copy link

Zed doesn't have remote code editing either: zed-industries/zed#5347

@nyabinary
Copy link

Zed doesn't have remote code editing either: zed-industries/zed#5347

Zed does have good collab editing, tho.

@kirawi
Copy link
Member

kirawi commented Jan 25, 2024

Zed is GPL and based on the Matrix conversation we can't reference it at all without polluting Helix's licensing.

@lianghu
Copy link

lianghu commented Mar 28, 2024

Lapce has a remote code editing support although Lapce itself is not stable yet.

@tulilirockz
Copy link

If you guys want an alternative to sshfs that doesnt freeze up whenever you use the file picker, check this out, seems particularly good for this case! It is just a workaround for now, but still might help out https://github.com/kahing/catfs/

@helix-editor helix-editor locked and limited conversation to collaborators Apr 14, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10411 Apr 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-plugin Area: Plugin system C-enhancement Category: Improvements S-needs-discussion Status: Needs discussion or design.
Projects
None yet
Development

No branches or pull requests