You might have better luck when using the Dev Containers extension instead of the flatpak-spawn command. Using this extension the IDE integrates much better with the toolbox.
I explained how to do this in an older post, see the flatpak with toolbox integration part.