Poor terminal performance in local VS Code Dev Container - visual-studio-code

I'm exploring remote container development in VS Code and GitHub Codespaces.
For context, I'm working in Windows 11 on performant Dell XPS 9310 i7 / 32 GB RAM machine.
When I open my Codespace / Dev Container in GitHub Codespaces via the browser, or in VS Code via the > Codespaces: Open in VS Code command, there are no performance issues.
Because I want to know whether development offline is feasible, I am testing having cloned my repo on my local machine, and having opened the repository folder in VS Code locally. This causes a local Docker container to be started in Docker Desktop running on WSL 2. (As expected, Git commands need to be managed outside of VS Code as expected due to permissions, but otherwise looks OK).
A performance issue is apparent when interacting with the terminal (bash or zsh). A terminal prompt takes literal minutes to appear, and to return after every command. I am often stuck waiting for a prompt as shown below after running simple commands requiring few resources.
What is the cause of the poor performance here?

Related

is there a way to work offline with vscode remote ssh to save cost?

I am using vscode ssh remote plugin https://code.visualstudio.com/docs/remote/ssh
to connect to gcp sandbox vm. gcp sandbox vm has an hourly cost if kept turned on.
most of the time I am reading or changing the code and I am not running any command in the VM's terminal. So, if I had the code offline, I would not need to keep the VM running and pay for each second of it.
Is there a way I can do this?
When using VSCode over SSH, you are running a VSCode server on the remote host which is used to read the files.
If you want to be able to open files locally, you will need to download them.
If you already have the files opened, you can disconnect from the VM and keep looking at them.
Another option to consider is mounting whatever file store you're using locally as a FUSE file system. Here is an example for git: https://github.com/presslabs/gitfs

VS Code multi-container dev containers git index keeps refreshing

I'm using a multi-container VS Code dev environment exactly as recommended in the docs. My different service environments successfully run using the Dev Containers: Open Folder in Container... as suggested.
Inside the VS Code terminal (in the Docker service container), after every command (e.g. ls) the terminal loads for 5-10 seconds and says Refresh index: 100% (805/805), done which appears to be git refreshing the index. This makes the terminal unusable - how can I stop this?
I think this is happening because the .git folder is part of the workspace volume and is thus copied from my host OS of Windows 11 to my container OS - Linux (Debian 11). But this is what the docs suggest and I need the .git folder to use git inside the repo.

Using host system Git when using WSL Remote in VSCode

I am currently trying to set up a new development environment, using VSCode, WSL, and the WSL Remote Extension. The environment will also utilize Git, and will sign commits via a YubiKey.
I initially tested this out the setup on a Windows 10 machine, using wsl2-ssh-pageant, and that worked flawlessly. I could sign commits straight from my WSL environment, and everything was awesome. Then I tried implementing this on my work machine, which is running Windows 11... Nothing is awesome.
Apparently there are a whole bunch of issues getting something like this to work on Windows 11, and the author of that library has abandoned the project. I have tried finding an alternative, testing things like npiperelay, wsl-ssh-agent, and a ton of others (too many to list), but the issue always comes back to Windows 11 (and downgrading is not an option).
Therefore, I decided to try a different approach. I can sign commits from Windows 11, using the Yubikey, without issue. So I wanted to get VSCode to use my local Windows 11 Git installation, rather than the WSL one. However, even when configuring git path in the settings, to use the Windows 11 Git, it seems to be using it inside a WSL container, meaning the Yubikey is unreachable; so all signing fails.
I should probably mention that both WSL and Windows 11 has access to the folder.
My current workaround is to do my development in VSCode, and then do all Git commands in a Windows 11 Terminal, which allows me to do signing, but it skips all the VSCode GUI and fancy tools, so I would like to keep everything in a single place.
So my question is: Is there a way to develop in WSL via VSCode, using the remote extension, while making VSCode do all Git operations on the host system (completely ignoring WSL)?

Can I add a remote Python interpreter (via SSH) to a local VSCode environment (i.e. a hybrid local/remote SSH setup)?

I have VSCode set up with the "Remote - SSH" extension, and I am able to run a local VSCode window as the face of a full remote environment. Really cool.
However, I would also like to be able to set up a local VSCode environment which loads files from my local filesystem but runs them on a remote Python interpreter (via an SSH connection).
I am hoping I can run all the regular interactive Python REPL stuff using the remote kernel (e.g. show variables, etc). It seems like I should be able to somehow add a remote kernel and then select it via "Python: Select Interpreter", but I can't figure out how.
In the past I was able to configure such a setup in JupyterLab using the "remote_ikernel" package.
Is this possible in VSCode? I've found tons of documentation on the full remote setup, but haven't located information on this hybrid kind of set up.
I found a related bug report which discusses mixing local and remote filesystems (not interpreters).
I suspect that the same difficulties it describes for filesystems may be similar reasons for why local files can not be easily fed into remote interpreters.
The full thread is here for reference:
https://github.com/microsoft/vscode-remote-release/issues/706
The specific quote:
Having a mixed workspace would require that a workspace extension can be active both locally and remotely. Currently an extension can only be active once, either locally or remotely. So this is currently not possible and we have no plans to support this.
The recommendation is to have separate windows open for the local and remote workspace.
So it sound like this is a feature that is not currently supported.

Remote Java Development using IntelliJ or Eclipse

I have some code that only runs on a remote Ubuntu box with a gateway in between. Every time I have make some changes I have to make the change in my local Mac and push it to git and rebuild it on the box to see if it is working. Was wondering if there is a way to configure IntelliJ or Eclipse to modify code directly on the remote box and have it running there with debug etc. so that I minimize on the roundtrip?
The solution may be to mount the remote filesystem in your local machine.
Then run the IDE off the remote file mount in the local system.
That way, the IDE will access all the files as if it is local.
The IDE can connect to the process running in remote machine.
Also the IDE can remote debug the JVM easily.
Here is the how to of mounting the remote file system locally
https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh