private Task HandleNugetReferenceAsync( string source, IPackageInstallerService installerService, List <Reference> allReferences, TSimpleNameSyntax nameNode, Project project, bool isAttributeSearch, PackageWithTypeResult result, int weight) { if (!installerService.IsInstalled(project.Solution.Workspace, project.Id, result.PackageName)) { var desiredName = GetDesiredName(isAttributeSearch, result.TypeName); allReferences.Add(new PackageReference(_owner, installerService, new SearchResult(desiredName, nameNode, result.ContainingNamespaceNames, weight), source, result.PackageName, result.Version)); } return(SpecializedTasks.EmptyTask); }
private CodeAction TryCreateCodeAction(Document document, AddImportFixData fixData, IPackageInstallerService installerService) { switch (fixData.Kind) { case AddImportFixKind.ProjectSymbol: return(new ProjectSymbolReferenceCodeAction(document, fixData)); case AddImportFixKind.MetadataSymbol: return(new MetadataSymbolReferenceCodeAction(document, fixData)); case AddImportFixKind.ReferenceAssemblySymbol: return(new AssemblyReferenceCodeAction(document, fixData)); case AddImportFixKind.PackageSymbol: return(!installerService.IsInstalled(document.Project.Solution.Workspace, document.Project.Id, fixData.PackageName) ? new ParentInstallPackageCodeAction(document, fixData, installerService) : null); } throw ExceptionUtilities.Unreachable; }