I've written earlier about using Toolbox as a development environment along with VS Code installed using Flatpak. Since then I have encountered some problems that you may have come across as well.
Primarily, the issue was that Git integration was not working within VS Code. This was actually a symptom of the Toolbox user and the VS Code extension users being different. When entering the container using the terminal (
toolbox enter ), the user used inside the container is the same as the one who is logged in, the host OS user. But, when a terminal is used from within the VS Code instance attached to the container, the user used is
root. This cause the git integration to malfunction because the
.git director was actually owned by the host OS user.
First solution I tried was to change the user for the VS Code extension to the same user as the host. While this worked at the first launch, every time I restarted the editor, I would be unable to connect to the container. The problem was that VS Code would try to use the root user home directory on restart of the editor. After several failed attempts to change this, I stopped perusing this solution.
The solution that worked was simpler than I thought. I created a brand new container using Toolbox, and connected to it with default VS Code configuration. Now with VS Code using the root user, of course the Git integration didn't work again. This time I opened a terminal tab inside the VS Code window that was connected to the container. Then I ran the following command to insure that Git is not restricted:
git config --global --add safe.directory '*'
This insured that
.git directories that are owned different users can still be read. So after a quick editor restart, the Git integration worked flawlessly.
Stay tuned for another container based that is arguably better because it is much easier to setup and much more flexible.