title: How to Access File Contents in VS Code Extension
body: <p>I would like to scan through the contents of the file currently open in the workspace. I tried:</p>
  <pre class="lang-js prettyprint-override"><code>console.log(vscode.window.activeTextEditor); // Doesn't work
  </code></pre>
  <p>I also tried:</p>
  <pre class="lang-js prettyprint-override"><code>vscode.workspace.openTextDocument(vscode.window.terminals).then(document =&gt; {
    let text = document.getText();
    console.log(text);
  });
  </code></pre>
  <p>That last one threw an error: &quot;did not find a valid project structure, exiting....&quot; What am I doing wrong?</p>