private async Task HandleReferenceAssemblyReferenceAsync( List <Reference> allReferences, TSimpleNameSyntax nameNode, Project project, bool isAttributeSearch, ReferenceAssemblyWithTypeResult result, int weight, CancellationToken cancellationToken) { foreach (var reference in project.MetadataReferences) { cancellationToken.ThrowIfCancellationRequested(); var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var assemblySymbol = compilation.GetAssemblyOrModuleSymbol(reference) as IAssemblySymbol; if (assemblySymbol?.Name == result.AssemblyName) { // Project already has a reference to an assembly with this name. return; } } var desiredName = GetDesiredName(isAttributeSearch, result.TypeName); allReferences.Add(new AssemblyReference(_owner, new SearchResult(desiredName, nameNode, result.ContainingNamespaceNames, weight), result)); }
public AssemblyReference( AbstractAddImportFeatureService <TSimpleNameSyntax> provider, SearchResult searchResult, ReferenceAssemblyWithTypeResult referenceAssemblyWithType) : base(provider, searchResult) { _referenceAssemblyWithType = referenceAssemblyWithType; }
public static SerializableReferenceAssemblyWithTypeResult Dehydrate( ReferenceAssemblyWithTypeResult result) { return(new SerializableReferenceAssemblyWithTypeResult { ContainingNamespaceNames = result.ContainingNamespaceNames.ToArray(), AssemblyName = result.AssemblyName, TypeName = result.TypeName }); }