There should probably be an option to tell the editor that the address 'localhost' is meant to be the host machine's localhost and not the container's.
Shell command ip route show | awk '/default/ {print $3}' can be used to find out the ip address for routing from the container to the machine.
Maybe we can run that command and cut the ip address and substitute it with the specified 'localhost'.