title: Get correct selection with VSCode extension when user navigates to new document
body: <p>I have an extension that subscribes to <code>window.onDidChangeActiveTextEditor</code>. If <code>Go to definition</code> is used, the <code>TextEditor</code> received by <code>onDidChangeActiveTextEditor</code> will report a <code>selection</code> of <code>0,0</code>. The &quot;correct&quot; selection is transported in a separate event (<code>onDidChangeTextEditorSelection</code>).</p>
  <p>The <code>onDidChangeActiveTextEditor</code> event seems to originate from <code>textFileEditors.ts</code>:</p>
  <pre><code>textEditor.setModel(textFileModel.textEditorModel);
  </code></pre>
  <p>The selection is updated shortly afterwards:</p>
  <pre><code>// Apply options to editor if any
  if (options) {
      applyTextEditorOptions(options, textEditor, ScrollType.Immediate);
  }
  </code></pre>
  <p>Even if flipped around, this has no impact, because the new selection is transported in an internal event that will not reach the code before the <code>onDidChangeActiveTextEditor</code> event is sent to the extension host.</p>
  <p>Is there a way for an extension to know if the new editor is opened at <code>0,0</code> or another position without waiting to see if the selection is updated shortly after?</p>
  <p>The events for opening a editor at (0,0) are:</p>
  <ul>
  <li><code>didOpenTextDocument</code></li>
  <li><code>didChangeActiveTextEditor</code></li>
  </ul>
  <p>The events for opening an editor at any other position are:</p>
  <ul>
  <li><code>didOpenTextDocument</code></li>
  <li><code>didChangeActiveTextEditor</code> (position is (0,0))</li>
  <li><code>onDidChangeTextEditorSelection</code> (position is the &quot;correct&quot; position)</li>
  </ul>