title: VS Code: How to access debug variables from within extension?
body: <p>I am writing an extension for visual studio code where I want to evaluate the current variables of a javascript debug session. These variables are normally shown when one have open the debug pane under the section <code>VARIABLES</code>. See the attached screenshot.</p>
  
  <p><a href="https://i.stack.imgur.com/Ugml5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ugml5.png" alt="Debug variables pane in visual studio code"></a></p>
  
  <p>I want to get access to these variables when the user right clicks the editor, but I don't know how.</p>
  
  <p>My current extension setting for this is like that: in the <code>package.json</code> I have registered a menu contribution along with a command:</p>
  
  <pre><code>"contributes": {
      "menus": {
          "editor/context": [{
              "command": "extension.showVariables",
              "group": "navigation"
          }]
      }
  }
  </code></pre>
  
  <p>In my extension.ts I register the command like that:</p>
  
  <pre><code>export function activate(context: vscode.ExtensionContext) {
  
      let disposable = vscode.commands.registerCommand('extension.showVariables', () =&gt; {
  
          // TODO: let variables = vscode.debug.activeDebugSession.variables.toString();
  
          vscode.window.showInformationMessage(variables);
      });
  }
  </code></pre>
  
  <p>I have tried to get them through <code>vscode.debug.activeDebugSession</code> but there is no API for variables here. I also tried to register an event handler for <code>vscode.debug.onDidReceiveDebugSessionCustomEvent</code> but I can't figure out where to search for the debug variables.</p>
  
  <p>Is it even possible to access these variables in an vs extension or do I need to implement my own debugger?</p>