title: VSCode Extension write and open file
body: <p>My requirement is actually pretty simple, I want to write a file and open it in vscode. But I can't get this to work:</p>
  
  <pre><code>var content = rec[rt.fields[field]];
  var filePath = path.join(vscode.workspace.rootPath, selected.label + '.' + field);
  fs.writeFileSync(filePath, content, 'utf8');
  
  var openPath = vscode.Uri.parse(filePath);
  vscode.workspace.openTextDocument(openPath).then(doc =&gt; {
    vscode.window.showTextDocument(doc);
  });
  </code></pre>
  
  <p>I get the following error message and have no idea what that should mean:</p>
  
  <blockquote>
    <p>cannot open c:%5CUsers%5Cmak%5C.sneditor%5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js. Detail: No model with uri 'c:%5CUsers%5Cmak%5C.sneditor%5Csoftpointdev1.service-now.com%5CRMCostPlanHelper.js' nor a resolver for the scheme 'c'.</p>
  </blockquote>