private static async Task <CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document documentOpt, SourceText text, int position, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { if (provider is TextCompletionProvider) { return(((TextCompletionProvider)provider).GetCompletionList(text, position, triggerInfo, cancellationToken)); } if (documentOpt != null) { var context = new CompletionListContext(documentOpt, position, triggerInfo, cancellationToken); await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); return(new CompletionList(context.GetItems(), context.Builder, context.IsExclusive)); } Contract.Fail("Should never get here."); return(null); }
private static async Task <CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document document, int position, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { var context = new CompletionListContext(document, position, triggerInfo, cancellationToken); await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); return(new CompletionList(context.GetItems(), context.Builder, context.IsExclusive)); }
private static async Task <CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document document, int position, CompletionTriggerInfo triggerInfo, OptionSet options, CancellationToken cancellationToken) { var context = new CompletionListContext(document, position, triggerInfo, options, cancellationToken); if (document.SupportsSyntaxTree) { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!root.FullSpan.IntersectsWith(position)) { try { // Trying to track down source of https://github.com/dotnet/roslyn/issues/9325 var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); ReportException(position, root, sourceText); } catch (Exception e) when(FatalError.ReportWithoutCrash(e)) { } } else { await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); } } else { await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); } return(new CompletionList(context.GetItems(), context.Builder, context.IsExclusive)); }
private static async Task<CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document documentOpt, SourceText text, int position, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { if (provider is TextCompletionProvider) { return ((TextCompletionProvider)provider).GetCompletionList(text, position, triggerInfo, cancellationToken); } if (documentOpt != null) { var context = new CompletionListContext(documentOpt, position, triggerInfo, cancellationToken); await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); return new CompletionList(context.GetItems(), context.Builder, context.IsExclusive); } Contract.Fail("Should never get here."); return null; }
private static async Task<CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document document, int position, CompletionTriggerInfo triggerInfo, OptionSet options, CancellationToken cancellationToken) { var context = new CompletionListContext(document, position, triggerInfo, options, cancellationToken); if (document.SupportsSyntaxTree) { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (!root.FullSpan.IntersectsWith(position)) { try { // Trying to track down source of https://github.com/dotnet/roslyn/issues/9325 var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); ReportException(position, root, sourceText); } catch (Exception e) when (FatalError.ReportWithoutCrash(e)) { } } else { await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); } } else { await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); } return new CompletionList(context.GetItems(), context.Builder, context.IsExclusive); }
private static async Task<CompletionList> GetCompletionListAsync( CompletionListProvider provider, Document document, int position, CompletionTriggerInfo triggerInfo, OptionSet options, CancellationToken cancellationToken) { var context = new CompletionListContext(document, position, triggerInfo, options, cancellationToken); await provider.ProduceCompletionListAsync(context).ConfigureAwait(false); return new CompletionList(context.GetItems(), context.Builder, context.IsExclusive); }