In one of the extensions I am developing with a custom authentication provider, I required to bring the last Visual Studio Code instance to the front once signed in.
When you can control the full authentication flow, you typically redirect the user to
vscode://..., which triggers your browser from opening Visual Studio Code.
In my case, I do not own the authentication flow but still wanted to give a similar experience to the developer, so I came up with the following trick:
All the above code does is open the project again in Visual Studio Code. As the project/solution is already opened, it would not get reloaded. All it does is bring your Visual Studio Code instance to the front, which we needed.