From 3764d4bf55ee604b2fdd3f02eb6a3e25dd0b07fd Mon Sep 17 00:00:00 2001 From: blagoev Date: Mon, 29 May 2017 09:33:06 +0300 Subject: [PATCH] Return debugger context if running on node in vscode debugger Experimental --- lib/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/index.js b/lib/index.js index 353abe3b..8a1a93b6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -28,6 +28,12 @@ function getContext() { // If process is an object, we're probably running in Node or Electron // From: http://stackoverflow.com/a/24279593/1417293 if (typeof process === 'object' && process + '' === '[object process]') { + + // Visual Studio Code defines the global.__debug__ object. + if (typeof global !== 'undefined' && global.__debug__) { + return 'vscodedebugger'; + } + return process.type === 'renderer' ? 'electron' : 'nodejs'; }