public async Task <DkmTextSpan?> GetCurrentActiveStatementPositionAsync(Guid moduleId, int methodToken, int methodVersion, int ilOffset, CancellationToken cancellationToken) { var solution = _workspace.CurrentSolution; var activeStatementSpanProvider = new SolutionActiveStatementSpanProvider(async(documentId, cancellationToken) => { var document = solution.GetRequiredDocument(documentId); return(await _activeStatementTrackingService.GetSpansAsync(document, cancellationToken).ConfigureAwait(false)); }); var instructionId = new ActiveInstructionId(moduleId, methodToken, methodVersion, ilOffset); var span = await _encService.GetCurrentActiveStatementPositionAsync(solution, activeStatementSpanProvider, instructionId, cancellationToken).ConfigureAwait(false); return(span?.ToDebuggerSpan()); }
private SolutionActiveStatementSpanProvider GetActiveStatementSpanProvider(Solution solution) => new SolutionActiveStatementSpanProvider((documentId, cancellationToken) => _activeStatementTrackingService.GetSpansAsync(solution.GetRequiredDocument(documentId), cancellationToken));