-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,014 additions
and
16 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/NuGet.Clients/PackageManagement.UI/Utility/PackageManagerProviderUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.VisualStudio.Utilities; | ||
using NuGet.VisualStudio; | ||
|
||
namespace NuGet.PackageManagement.UI | ||
{ | ||
public static class PackageManagerProviderUtility | ||
{ | ||
public static List<IPackageManagerProvider> Sort(IEnumerable<Lazy<IPackageManagerProvider, IOrderable>> packageManagerProviders, int max) | ||
{ | ||
var sortedProviders = new List<IPackageManagerProvider>(); | ||
var uniqueId = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | ||
|
||
foreach (var provider in Orderer.Order(packageManagerProviders)) | ||
{ | ||
if (sortedProviders.Count() < max && !uniqueId.Contains(provider.Value.PackageManagerId)) | ||
{ | ||
uniqueId.Add(provider.Value.PackageManagerId); | ||
sortedProviders.Add(provider.Value); | ||
} | ||
} | ||
|
||
return sortedProviders; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.VisualStudio | ||
{ | ||
/// <summary> | ||
/// Interface allowing integration of alternate package manager suggestion for a NuGet package. | ||
/// For example jQuery may appear on Bower and it might be more appropriate to install a package from Bower for certain projects | ||
/// </summary> | ||
[ComImport] | ||
[Guid("BCED5BF2-40FC-4D9F-BF0A-43CD4E9FF65F")] | ||
public interface IPackageManagerProvider | ||
{ | ||
/// <summary> | ||
/// Localized display package manager name. | ||
/// </summary> | ||
string PackageManagerName { get; } | ||
|
||
/// <summary> | ||
/// Package manager unique id. | ||
/// </summary> | ||
string PackageManagerId { get; } | ||
|
||
/// <summary> | ||
/// Display description for package manager when user hover over the manager name on UI. | ||
/// </summary> | ||
string Description { get; } | ||
|
||
/// <summary> | ||
/// Check if a recommendation should be surfaced for an alternate package manager. | ||
/// This code should not rely on slow network calls, and should return rapidly. | ||
/// </summary> | ||
/// <param name="packageId">Current package id</param> | ||
/// <param name="projectName">Unique project name for finding the project through VS dte</param> | ||
/// <param name="token">Cancellation Token</param> | ||
/// <returns>return true if need to direct to integrated package manager for this package</returns> | ||
Task<bool> CheckForPackage(string packageId, string projectName, CancellationToken token); | ||
|
||
/// <summary> | ||
/// This Action should take the user to the other package manager. | ||
/// </summary> | ||
/// <param name="packageId">Current package id</param> | ||
/// <param name="projectName">Unique project name for finding the project through VS dte</param> | ||
void GoToPackage(string packageId, string projectName); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.