When developing Visual Studio Code extensions, it might come in handy to know when running a production- or debug-build.
Typically in Node.js projects, we verify this by using the NODE_ENV
environment variable. Unfortunately, this approach cannot be used as VS Code runs in a different instance, and environment variables are lost.
Solution
Luckily, there is a way to check how your extension is running. You can check this via the vscode extension API.
You can retrieve the mode your extension is started with via the context.extensionMode
property.
|
|
There are three modes:
- Development
- Production
- Test
Hopefully, this #DevHack helps you to tweak your development flow when creating VS Code extensions.