-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix1444 #3
Fix1444 #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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<IVsPackageManagerProvider> Sort(IEnumerable<Lazy<IVsPackageManagerProvider, IOrderable>> packageManagerProviders, int max) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Break long lines. Should be <= 120 chars |
||
{ | ||
var sortedProviders = new List<IVsPackageManagerProvider>(); | ||
var uniqueId = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | ||
|
||
foreach (var provider in Orderer.Order(packageManagerProviders)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
{ | ||
if (sortedProviders.Count < max && !uniqueId.Contains(provider.Value.PackageManagerId)) | ||
{ | ||
uniqueId.Add(provider.Value.PackageManagerId); | ||
sortedProviders.Add(provider.Value); | ||
} | ||
} | ||
|
||
return sortedProviders; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ public StandaloneUIContext( | |
IOptionsPageActivator optionsPageActivator, | ||
IEnumerable<NuGetProject> projects) | ||
: | ||
base(sourceProvider, solutionManager, packageManager, uiActionEngine, packageRestoreManager, optionsPageActivator, projects) | ||
base(sourceProvider, solutionManager, packageManager, uiActionEngine, packageRestoreManager, optionsPageActivator, projects, null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
_settingsFile = settingsFile; | ||
LoadSettings(); | ||
|
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please break long line here and in other places in your change as applicable |
||
/// </summary> | ||
[ComImport] | ||
[Guid("BCED5BF2-40FC-4D9F-BF0A-43CD4E9FF65F")] | ||
public interface IVsPackageManagerProvider | ||
{ | ||
/// <summary> | ||
/// Localized display package manager name. | ||
/// </summary> | ||
string PackageManagerName { get; } | ||
|
||
/// <summary> | ||
/// Package manager unique id. | ||
/// </summary> | ||
string PackageManagerId { get; } | ||
|
||
/// <summary> | ||
/// The tool tip description for the package | ||
/// </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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a convention to have a suffix 'async' when the return type is Task or Task. Consider changing this to 'CheckForPackageAsync' if possible. |
||
|
||
/// <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); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to be a read-only getter like SourceProvider