Exemplo n.º 1
0
 public static SerializableReferenceLocation Dehydrate(
     ReferenceLocation referenceLocation)
 {
     return(new SerializableReferenceLocation
     {
         Document = referenceLocation.Document.Id,
         Alias = SerializableSymbolAndProjectId.Dehydrate(referenceLocation.Alias, referenceLocation.Document),
         Location = referenceLocation.Location.SourceSpan,
         IsImplicit = referenceLocation.IsImplicit,
         IsWrittenTo = referenceLocation.IsWrittenTo,
         CandidateReason = referenceLocation.CandidateReason
     });
 }
Exemplo n.º 2
0
 public static SerializableReferenceLocation Dehydrate(
     ReferenceLocation referenceLocation, CancellationToken cancellationToken)
 {
     return(new SerializableReferenceLocation
     {
         Document = referenceLocation.Document.Id,
         Alias = SerializableSymbolAndProjectId.Dehydrate(referenceLocation.Alias, referenceLocation.Document, cancellationToken),
         Location = referenceLocation.Location.SourceSpan,
         IsImplicit = referenceLocation.IsImplicit,
         SymbolUsageInfo = SerializableSymbolUsageInfo.Dehydrate(referenceLocation.SymbolUsageInfo),
         AdditionalProperties = referenceLocation.AdditionalProperties,
         CandidateReason = referenceLocation.CandidateReason
     });
 }
 public Task OnDefinitionFoundAsync(SymbolAndProjectId definition)
 => _service.Rpc.InvokeAsync(nameof(OnDefinitionFoundAsync),
                             SerializableSymbolAndProjectId.Dehydrate(definition));
Exemplo n.º 4
0
 public Task OnDefinitionFoundAsync(SymbolAndProjectId definition)
 => _service.InvokeAsync(nameof(OnDefinitionFoundAsync), new object[] { SerializableSymbolAndProjectId.Dehydrate(definition) }, _cancellationToken);
Exemplo n.º 5
0
 public Task OnDefinitionFoundAsync(SymbolAndProjectId definition)
 => _endPoint.InvokeAsync(nameof(SymbolFinder.FindReferencesServerCallback.OnDefinitionFoundAsync), new object[] { SerializableSymbolAndProjectId.Dehydrate(definition) }, _cancellationToken);
        private Task <ImmutableArray <SerializableSymbolAndProjectId> > FindAndCacheTypesAsync(
            PinnedSolutionInfo solutionInfo,
            SerializableSymbolAndProjectId typeAndProjectId,
            ProjectId[] projectIds,
            Func <INamedTypeSymbol, Solution, ImmutableHashSet <Project>, Task <ImmutableArray <INamedTypeSymbol> > > func,
            CancellationToken cancellationToken)
        {
            return(RunServiceAsync(async() =>
            {
                using (UserOperationBooster.Boost())
                {
                    var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false);

                    var symbol = await typeAndProjectId.TryRehydrateAsync(
                        solution, cancellationToken).ConfigureAwait(false);

                    if (!(symbol is INamedTypeSymbol namedType))
                    {
                        return ImmutableArray <SerializableSymbolAndProjectId> .Empty;
                    }

                    var projects = projectIds?.Select(id => solution.GetProject(id)).ToImmutableHashSet();
                    var types = await func(namedType, solution, projects).ConfigureAwait(false);

                    return types.SelectAsArray(
                        (Func <INamedTypeSymbol, SerializableSymbolAndProjectId>)(t => SerializableSymbolAndProjectId.Dehydrate(solution, t, cancellationToken)));
                }
            }, cancellationToken));
        }