title: VS Code extension: how to access serial port?
body: <p>I am writing VS Code extension for embedded Forth. Due to the nature of Forth, any debugging must be done on the target system.  Therefore I need to talk to it via serial port.</p>
  
  <p>I started with a simple extension command that would just list available serial ports in the system.  Unfortunately, this very first step failed because, although VS Code extensions kind of run as node modules, they cannot use any precompiled code (probably DLL).</p>
  
  <p>The error message says this: "Activating extension <code>jvavruska.forth-studio</code> failed: %1 is not a valid Win32 application." (this disappears when I don't import serialport module)</p>
  
  <p>Is there a way how to overcome this limitation?</p>
  
  <p>Below is my extension.js. It uses serialport@4.0.6 installed from NPM. My local version of node is 6.9.1 64bit.</p>
  
  <pre class="lang-js prettyprint-override"><code>let vscode = require('vscode');
  let serial = require('serialport');
  
  function activate(context) {
  
      console.log('Congratulations, your extension "forth-studio" is now active!');
      let disposable = vscode.commands.registerCommand('extension.showCommPorts', function () {
          serial.list( onResult );
          function onResult( data ) {
              if( data.length === 0 ) {
                  vscode.window.showInformationMessage('NO SERIAL PORTS AVAILABLE');
              }
              else { 
                  let list = [] ;
                  for( let port of data ) {
                      list.push( port.commName );
                  }
                  vscode.window.showInformationMessage('Serial ports: ', list.join(', '));
              }
          }
      });
      context.subscriptions.push(disposable);
  }
  exports.activate = activate;
  function deactivate() {
  }
  exports.deactivate = deactivate;
  </code></pre>
  
  <p>I was trying to find something in VS Code documentation, but it mostly declares that extensions are possible and except a brief instruction how to create an empty stub extension it does not explain too much.  I am lost.</p>