VS Code: Local source code with remote run/debug - visual-studio-code

I have my personal machine, which has version control credentials, VS code, etc. all set up as I like it.
I have a remote machine that has some specialized hardware that my code uses. I don't want to set it up as a development environment through, as it's a shared machine/account and I don't want my version control credentials and such stored on that machine.
I'd like to be able to set it up such that the source code is on my personal machine, but when I run/debug in VS Code, it sends the executable to the remote machine and runs it there (and Delve connects to a port on that machine so I can step through from my local machine).
Is this possible with VS Code? I know it supports Remote Development, but that's just where your local VS Code connects to a remote VS Code server, and the source code is on the remote machine.

Related

Host user tasks used on remote SSH side

Background:
At work I develop either in a virtual machine on my Windows laptop, or in a desktop workstation via a remote desktop app. Both environments are Ubuntu.
I have recently started to enjoy using VSCode, with the Remote SSH plugin. But I have to manually copy my setup .vscode/ folder to each project. I work actively in 10-20 projects, which makes this a bit of annoying.
All projects have the same setup and file structure, and both environments are setup the same. It feels like I could automate this more.
Using 3rd party tools is not applicable for me, since I cannot install whatever I want. Native support is important.
Question:
Is there any way for me to setup VSCode settings and tasks on my hosting Windows machine, but use them on the remote side after starting an SSH session of VSCode?

Change default extensions location for remote development in VS code

I have a visual studio code installed in a desktop. As I don't have any runtime environments installed in it, the source code repository is kept in the remote server where the runtime and other dependencies are available, so SSH connection is established from the VS code to update the source code.
I'm installing few extensions using VS code in the remote server where the source code and runtime are available. It gets installed in my home directory(/home/myname/.vscode-server)by default on the remote server.
As I have very limited disk space in my home directory, I want to change the extension location of vs code. Can you guide me here?. Your insights will be helpful. Thank you !!!
PS: Can't install VS code in the remote server due to limited access rights.
It has been well discussed on GitHub under https://github.com/microsoft/vscode-remote-release/issues/472 and remote.SSH.serverInstallPath is the current solution.

Install extensions for remote - ssh when remote machine is behind a proxy

I've installed the Remote - SSH extension to develop while working from home, code that is sitting on a remote work computer. Previously I'd been using VSCode installed on the remote Linux machine and just used NX or some remote desktop software to connect and develop. I note that just to point out that a local version of VSCode is also installed on the machine. Now while home, I first connect my laptop to VPN and then using the Remote - SSH extension I am able to develop code sitting on the remote machine. For this SSH connection, I've installed a few extensions on the remote machine that seem to work fine, but I am having trouble installing or getting others to work. Namely the rust-analyzer extension won't install and the rust extension doesn't work. I assume it is because of the "Known limitations" listed on this page https://code.visualstudio.com/docs/remote/ssh#_managing-extensions where it advices to extensions may not work unless the appropriate environment variables are set. Previously I'd been setting http_proxy and https_proxy but now I also set HTTP_PROXY and HTTPS_PROXY because of this advice. However, setting these variables does not solve the problem. I also set these variables in .wgetrc following advice I found somewhere. If this is a proxy issue, how do I set the correct variable? Also, is there an alternative way to install extensions so that they work via the Remote - SSH extension?
Settings -> "Remote" tab -> search "proxy"
set "Http: Proxy", and then reconnect remote

Running eclipse with remote Git checkout repository

On my windows laptop, I use putty to ssh on the remote server where I have git checkout a C project. I would like to use eclipse(CDT) for program development on my laptop but compilation and program execution is only possible on the remote server. Can I map the repository checked out on remote server into eclipse on my laptop so that I can avoid working with two copies of the checked out project.
This seems not possible unless you are using an Eclipse installed on the remote machine... and use it on your Windows laptop.
See "Remote Eclipse over X11".
Since you are on Windows, you would use an X11 emulator like vcxsrv.
That would avoid the sshfs setup.
The other approach would be to replicate your remote machine environment in a VM (VirtualBox) or a Docker image/container in order to be able to compile locally (and then push the modified sources to your remote machine with Git)

eclipse neon remote debug

I just installed the latest version of eclipse neon. I previously used eclipse mars. But due to other issues that should be updated in eclipse Neon I changed to this version.
I develop a program for a ARM Linux system on a Windows computer, so using a cross-gcc and doing remote debug using gdb/gdbserver from eclipse. I first made a connection using the remote systems perspective using ftp for file transfer and ssh for the shell. This worked fine and I was happy with this.
But in Neon it seems to be changed because the connection that I made in the Remote Systems explorer can't be selected anymore when you use C/C++ Remote Application Debug. When you look at the connection listbox I only see local connection and not the remote systems anymore. When I create a new connection from the debug configurations dialog I can only choose serial/telnet/ssh but when I choose ssh it doesn't work. I can make the connection and open a command shell, so ssh works. But when it wants to transfer the file to my target it is using sftp appearently (looking at the error log) but I don't have this on my target.
When I transfer the file manually to my target (using the remote systems perspective) the debugging works fine but of course I want to transfer the file automatically when I start a debug.
My question is if indeed this connection management is changed that you can't choose anymore the systems that you defined in the remote systems explorer?
Or do you need install a specific plugin?
The current configuration possibilities are very limited and also the debugging of the issues is limited.
Other solution is that I have scp installed on the target. Is there a way to change from sftp to scp?
Thanks.