To have the exact environment you are building / tar-getting in.
E.g. you can't (easily) have autocomplete in C++ on VS Code on your Mac if your project doesn't target Mac and can't build there (or doesn't have the dependencies etc).
But you can do it inside a Docker image.