News for hackers. Stuff that matters.
Re:Ask HN: Best practices for editing remote code locally? by JamesMcMinn on Monday April 11, 2022 @09:28AM (#30988369)
VS Code + The Remote SSH extension is a remarkable solution to developing code (not just editing!) on a remote machine.

When Covid hit and my main work machine was still a desktop, I worked from my home using VS Code and the remote plugin. This lasted for 18 months, and the only time I ever had an issue was due to a power outage in the office. Data, code (everything, really) lived on my work desktop that was sat in an empty office while I was at home.

There's no latency, the terminal opens as if you were on the remote machine, and ports are automatically forwarded. It runs code, tests, etc. all on the remote machine.

If there's a better solution out there it's almost certainly down to IDE preference.

Re:Ask HN: Best practices for editing remote code locally? by evilotto on Monday April 11, 2022 @12:54PM (#30991558)
I like vscode + remote ssh a lot, but one thing to be aware of is that the node server that it installs on the remote can be a bit memory hungry if you're on a small machine (i.e., low-end droplet or vps). One of the rsync or sftp remote adapters is much nicer to such environments.
Re:Ask HN: Best practices for editing remote code locally? by Bad_CRC on Tuesday April 12, 2022 @05:42AM (#31000470)
I usually use the this extension: https://marketplace.visualstudio.com/items?itemName=Kelvin.v...

Which doesn't starts up any server on the remote server.

Re:Ask HN: Best practices for editing remote code locally? by monkeybutton on Monday April 11, 2022 @10:13AM (#30988996)
I use VS code with the same plugin for working remotely. I also use jupyter lab with port tunneling and there's no difference to what it was like working locally. My company issued computer is just a VM off in some cloud. Working like this has a oddly retro-futuristic feel to it. Like we've gone back to the days of mainframe development.
Re:Ask HN: Best practices for editing remote code locally? by aldanor on Monday April 11, 2022 @12:23PM (#30991030)
Just a suggestion - VS Code (now) has a super nice support for jupyter. You don't have to start the server externally, vim mode and all your extensions like github copilot work fine, proper autocompleting works, etc. Debugging is absolutely amazing. I've recently switched myself and am never going back to browser-based jupyter.
Re:Ask HN: Best practices for editing remote code locally? by monkeybutton on Monday April 11, 2022 @01:37PM (#30992169)
Debugging jupyter notebooks, as in you can set a breakpoint then shift-enter to run a cell and hit it? I'll have to give that a try!
Re:Ask HN: Best practices for editing remote code locally? by aldanor on Monday April 11, 2022 @06:54PM (#30996181)
E.g., you can set up a breakpoint in your own local module that your notebook is importing and get the full vscode debugging experience by executing a cell.
Re:Ask HN: Best practices for editing remote code locally? by tta on Monday April 11, 2022 @10:43AM (#30989470)
Relatedly, iTerm's tmux integration[1] pairs very well with this setup.

[1]: https://iterm2.com/documentation-tmux-integration.html

Re:Ask HN: Best practices for editing remote code locally? by flutetornado on Monday April 11, 2022 @10:53AM (#30989636)
This is the best solution I have found so far being a long time vim user. ssh + tmux + vim is all you need. Least amount of potential problems in this setup. vim runs locally on the server where "remote development" is being done, so there is very little friction in terms of getting it to do what you'd like it to do given all the plugins you can add to it for beefing it up.

I have heard stories from coworkers about work being lost when editing is done remotely instead of locally, so never ventured that way.

Re:Ask HN: Best practices for editing remote code locally? by eschneider on Monday April 11, 2022 @12:54PM (#30991562)
I'm definitely team emacs -nw, but I use the same tmux setup. Tmux's ability to reconnect to a session after disconnect is definitely it's killer feature.
Re:Ask HN: Best practices for editing remote code locally? by lyrr on Monday April 11, 2022 @12:06PM (#30990764)
Since you seem to know what you’re talking about, I’m looking for some advice: I work for a large and very well known engineering company and currently our incredibly terrible workflow looks something like this: Develop locally using VStudio -> transfer repo to network drive -> login to tester via three layers of Remote Desktop Connections -> run and debug code live on tester RDC The tester setup is virtually all GUI based. It’s also located on the other side of Asia which is the reason of logging in via RDC. Is there possibly a better way of making this workflow more contained in a terminal/single ide environment, without having to jump through the RDC loops?
Re:Ask HN: Best practices for editing remote code locally? by rank0 on Monday April 11, 2022 @01:32PM (#30992116)
Is there a way to do your testing without a gui? I have no idea what your testing setup requires, but is there some technical reason why tests are not done automatically in your ci/cd pipeline?

If it must be done manually, can you just ssh/rdp directly into the testing box? The network where the testing box exists could use some tunneling protocol (stunnel, socks, wireguard, vpc peering...) to make it more accessible from your dev machine or your company VPN.

Re:Ask HN: Best practices for editing remote code locally? by wey-gu on Monday April 11, 2022 @01:13PM (#30991863)
I had similar experiences but some layers are Citrix and others RDC. Seeing your situation brought back my anxiety on those connections. Sorry for this. Is there any terminal servers to be able to ssh port forwarding? Thus to reduce layers, while as the test setup is gui based at least one layer of RDC is required. Reducing nested Remote Desktop would for sure help with the experience. Sorry again for you situation.
Re:Ask HN: Best practices for editing remote code locally? by swah on Monday April 11, 2022 @12:04PM (#30990711)
I recently registered for a free VPS from Oracle and could get a box in my country - then those setups start working well.

With my VPS from DigitalOcean the ping will be 170ms and then its no bueno.

Re:Ask HN: Best practices for editing remote code locally? by vsgzusnex on Monday April 11, 2022 @11:39AM (#30990290)
I started with this and still prefer it from a functionality stand point but the one use case where it falls apart for me is when you have an internet connection with occasional lag spikes.

This could be a variety of scenarios like working remote on bad ISPs or cellular or a crappy VPN but all that matters is when it acts up it will cause lag, or dropped connections depending on severity. Too many interruptions while trying to focus.

For this reason I keep everything local and use an rsync wrapper over my build system that streams output back. The added delay for each command disrupts workflow less than it happening during editing.

Re:Ask HN: Best practices for editing remote code locally? by woopwoop on Monday April 11, 2022 @10:12AM (#30988986)
Seconded. It is so seemless that it is literally possible to not notice which machine you are on if you are just firing up something new for quick exploration.
Re:Ask HN: Best practices for editing remote code locally? by rubicon33 on Monday April 11, 2022 @12:19PM (#30990951)
Could this be used to do firmware development on Pi? One thing I’ve always hated was having to either SSH and use vim, or login directly to the Pi and use an IDE directly on it.

I would love to use my main mac + VS Code to edit code and dispatch commands like compile / run

Re:Ask HN: Best practices for editing remote code locally? by npage97 on Monday April 11, 2022 @12:22PM (#30991011)
I've done this exact setup (though not for firmware development). VS Code C/C++ extension also supports arm64 as well (https://devblogs.microsoft.com/cppblog/visual-studio-code-c-...). This works well with remote ssh.
Re:Ask HN: Best practices for editing remote code locally? by rubicon33 on Monday April 11, 2022 @03:09PM (#30993286)
Thank you! I'm going to give it a try, sounds like it could be perfect for me to finally get deeper into firmware development. Just can't stand working directly on the Pi.
Re:Ask HN: Best practices for editing remote code locally? by ActorNightly on Monday April 11, 2022 @12:22PM (#30991018)
VSCode install processes to support remote editing. I think PI is supported, but I know it had issues with certain architectures last year. Its very easy to try though.
Re:Ask HN: Best practices for editing remote code locally? by sschueller on Monday April 11, 2022 @05:23PM (#30995269)
It is, I have used it and it works great on a pi3.
Re:Ask HN: Best practices for editing remote code locally? by blowfish721 on Monday April 11, 2022 @12:02PM (#30990690)
How does it handle disconnects? With two kids and lots of interruptions my laptop is going to sleep a lot if I don’t have it plugged in between sessions, does it reconnect everything automatically so you wouldn’t notice it much?
Re:Ask HN: Best practices for editing remote code locally? by barefeg on Monday April 11, 2022 @02:02PM (#30992499)
Make sure to add TCPKeepAlive yes into your ssh config so the ssh doesn’t disconnect. Vscode will disconnect but then it’s just a matter of clicking retry
Re:Ask HN: Best practices for editing remote code locally? by baq on Monday April 11, 2022 @01:03PM (#30991736)
depends on length of the disconnect. it can be seamless and if it fails, it asks you to reload itself, conveniently placing a button to do just that in the same dialog window.
Re:Ask HN: Best practices for editing remote code locally? by atwebb on Monday April 11, 2022 @11:18AM (#30990011)
Exactly what I was thinking, it really is crazy nice for development over SSH or within a container. The Live additions are neat for sharing as well though I've only dabbled in it.
Re:Ask HN: Best practices for editing remote code locally? by posharma on Monday April 11, 2022 @12:26PM (#30991085)
I used this setup a lot myself and it worked great except that name completions, intellisense didn't work as expected.
Re:Ask HN: Best practices for editing remote code locally? by qbasic_forever on Monday April 11, 2022 @01:41PM (#30992216)
You might need to install all the language servers and extensions on the remote host too. Typically VS code realizes they're missing and prompts to install them. But if there's an issue you might need to dig around and see why it can't install the LSP services there (perhaps you don't have permission or access to get them).
Re:Ask HN: Best practices for editing remote code locally? by baq on Monday April 11, 2022 @01:02PM (#30991713)
switched to vscode from neovim in tmux a couple years ago, which used to be my weapon of choice for more than a decade (vim before neovim for the purists). practically haven't looked back. it really is amazing.
Re:Ask HN: Best practices for editing remote code locally? by rhacker on Monday April 11, 2022 @11:35AM (#30990237)
And you can run the debugger!