I’ve tried to do this before, I believe the easier way to approach this is to make a reservation on a compute node and then attach your vs code remote session to the compute node. This will probably require proxying your SSH connection through the login node, as those are often the only ones exposed to the external network. If you google “vs code remote on HPC” or “vs code remote on compute nodes” there are plenty of resources.
A recomendation - if you are using a Windows laptop or desktop to remotely access the HPC then download and use MobaXterm. It has an intuitive GUI for setting up ssh tunnels