protected async Task <Entry> TryCreateDocumentSpanEntryAsync( RoslynDefinitionBucket definitionBucket, DocumentSpan documentSpan, HighlightSpanKind spanKind, ImmutableDictionary <string, ImmutableArray <string> > propertiesWithMultipleValuesMapOpt, ImmutableArray <FindUsageProperty> additionalProperties) { var document = documentSpan.Document; var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(document).ConfigureAwait(false); var(excerptResult, lineText) = await ExcerptAsync(sourceText, documentSpan).ConfigureAwait(false); var mappedDocumentSpan = await AbstractDocumentSpanEntry.TryMapAndGetFirstAsync(documentSpan, sourceText, CancellationToken).ConfigureAwait(false); if (mappedDocumentSpan == null) { // this will be removed from the result return(null); } return(new DocumentSpanEntry( this, definitionBucket, spanKind, projectName, guid, mappedDocumentSpan.Value, excerptResult, lineText, GetCustomColumnsData(propertiesWithMultipleValuesMapOpt, additionalProperties))); }
private async Task <Entry?> TryCreateEntryAsync( RoslynDefinitionBucket definitionBucket, DefinitionItem definition ) { var documentSpan = definition.SourceSpans[0]; var(guid, projectName, _) = GetGuidAndProjectInfo(documentSpan.Document); var sourceText = await documentSpan.Document .GetTextAsync(CancellationToken) .ConfigureAwait(false); var lineText = AbstractDocumentSpanEntry.GetLineContainingPosition( sourceText, documentSpan.SourceSpan.Start ); var mappedDocumentSpan = await AbstractDocumentSpanEntry .TryMapAndGetFirstAsync(documentSpan, sourceText, CancellationToken) .ConfigureAwait(false); if (mappedDocumentSpan == null) { // this will be removed from the result return(null); } return(new DefinitionItemEntry( this, definitionBucket, projectName, guid, lineText, mappedDocumentSpan.Value )); }