in src/extension/index.ts [228:246]
function activateSelectionSync(disposables: Disposable[], panel: Panel) {
disposables.push(window.onDidChangeTextEditorSelection(({ selections, textEditor }) => {
// Anti-feedback-loop. Prevent panel-originated changes from echoing back to the panel.
if (window.activeTextEditor !== textEditor) return;
// Length 0 - I have yet to see this in practice.
// Length 2+ - User is likely editing and does not want to be distracted by selection changes.
if (selections.length !== 1) return;
const selection = selections[0];
const position = selection.isReversed ? selection.start : selection.end; // The blinking caret.
const diagnostics = languages.getDiagnostics(textEditor.document.uri);
const diagnostic = diagnostics.find(diagnostic => diagnostic.range.contains(position)) as ResultDiagnostic | undefined;
const result = diagnostic?.result;
if (!result) return;
panel.select(result);
}));
}