Exemplo n.º 1
0
 /// <summary>Values for these parameters can be provided (during testing) for mocking purposes.</summary>
 protected AbstractAddImportCodeFixProvider(
     IPackageInstallerService packageInstallerService = null,
     IPackageSearchService packageSearchService       = null)
 {
     _packageInstallerService = packageInstallerService;
     _packageSearchService    = packageSearchService;
 }
Exemplo n.º 2
0
            private async Task FindNugetOrReferenceAssemblyTypeReferencesAsync(
                PackageSource source,
                IPackageSearchService searchService,
                IPackageInstallerService installerService,
                List <Reference> allReferences,
                TSimpleNameSyntax nameNode,
                string name,
                int arity,
                bool isAttributeSearch,
                CancellationToken cancellationToken)
            {
                cancellationToken.ThrowIfCancellationRequested();
                var results = searchService.FindPackagesWithType(source.Name, name, arity, cancellationToken);

                var project   = _document.Project;
                var projectId = project.Id;
                var workspace = project.Solution.Workspace;

                int weight = 0;

                foreach (var result in results)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    if (result.IsDesktopFramework)
                    {
                        await HandleReferenceAssemblyReferenceAsync(
                            installerService, allReferences, nameNode, project,
                            isAttributeSearch, result, weight, cancellationToken).ConfigureAwait(false);
                    }
                    else
                    {
                        await HandleNugetReferenceAsync(
                            source.Source, installerService, allReferences, nameNode,
                            project, isAttributeSearch, result, weight).ConfigureAwait(false);
                    }

                    weight++;
                }
            }
Exemplo n.º 3
0
 public PackageController(IPackageSearchService packageService)
 {
     _packageService = packageService;
 }
 /// <summary>For testing purposes only (so that tests can pass in mock values)</summary>
 internal CSharpAddImportCodeFixProvider(
     IPackageInstallerService installerService,
     IPackageSearchService packageSearchService)
     : base(installerService, packageSearchService)
 {
 }
Exemplo n.º 5
0
 public SearchCommandHandler(IPackageSearchService packageSearchService)
 {
     _packageSearchService = packageSearchService;
 }