static async Task DocumentOpenAsync(IIncrementalAnalyzer analyzer, TextDocument textDocument, CancellationToken cancellationToken) { if (textDocument is Document document) { await analyzer.DocumentOpenAsync(document, cancellationToken).ConfigureAwait(false); } else if (analyzer is IIncrementalAnalyzer2 analyzer2) { await analyzer2.NonSourceDocumentOpenAsync(textDocument, cancellationToken).ConfigureAwait(false); } }