public async Task <IntellisenseQuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken) { var triggerPoint = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot); if (!triggerPoint.HasValue) { return(null); } var snapshot = triggerPoint.Value.Snapshot; var document = snapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) { return(null); } var service = QuickInfoService.GetService(document); if (service == null) { return(null); } try { using (Logger.LogBlock(FunctionId.Get_QuickInfo_Async, cancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); var options = _globalOptions.GetSymbolDescriptionOptions(document.Project.Language); var item = await service.GetQuickInfoAsync(document, triggerPoint.Value, options, cancellationToken).ConfigureAwait(false); if (item != null) { var textVersion = snapshot.Version; var trackingSpan = textVersion.CreateTrackingSpan(item.Span.ToSpan(), SpanTrackingMode.EdgeInclusive); var classificationOptions = _globalOptions.GetClassificationOptions(document.Project.Language); return(await IntellisenseQuickInfoBuilder.BuildItemAsync( trackingSpan, item, document, classificationOptions, _threadingContext, _operationExecutor, _asyncListener, _streamingPresenter, cancellationToken).ConfigureAwait(false)); } return(null); } } catch (Exception e) when(FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken, ErrorSeverity.Critical)) { throw ExceptionUtilities.Unreachable; } }
public async Task <IntellisenseQuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken) { var triggerPoint = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot); if (!triggerPoint.HasValue) { return(null); } var snapshot = triggerPoint.Value.Snapshot; var document = snapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) { return(null); } var service = QuickInfoService.GetService(document); if (service == null) { return(null); } try { using (Internal.Log.Logger.LogBlock(FunctionId.Get_QuickInfo_Async, cancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); var item = await service.GetQuickInfoAsync(document, triggerPoint.Value, cancellationToken).ConfigureAwait(false); if (item != null) { var textVersion = snapshot.Version; var trackingSpan = textVersion.CreateTrackingSpan(item.Span.ToSpan(), SpanTrackingMode.EdgeInclusive); return(await IntellisenseQuickInfoBuilder.BuildItemAsync(trackingSpan, item, snapshot, document, _streamingPresenter, cancellationToken).ConfigureAwait(false)); } return(null); } } catch (Exception e) when(FatalError.ReportUnlessCanceled(e)) { throw ExceptionUtilities.Unreachable; } }