Skip to content

Commit 6d3164c

Browse files
committed
When loading the solution:
* Do not show installed extensions * Do not offer installation if all extensions are installed
1 parent 13a4442 commit 6d3164c

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/ExtensionManager/Features/Install/InstallFeatureBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public async Task ExecuteAsync()
5454
var manifest = await ManifestService.ReadAsync(filePath).ConfigureAwait(false);
5555
var extensionsToInstall = await CreateExtensionsToInstallListAsync(manifest.Extensions).ConfigureAwait(false);
5656

57-
await ShowInstallDialogAsync(manifest, this, extensionsToInstall);
57+
await ShowInstallDialogAsync(manifest, this, extensionsToInstall.ToList());
5858
}
5959

60-
private async Task<IReadOnlyList<VSExtensionToInstall>> CreateExtensionsToInstallListAsync(IEnumerable<IVSExtension> toInstall)
60+
protected virtual async Task<IEnumerable<VSExtensionToInstall>> CreateExtensionsToInstallListAsync(IEnumerable<IVSExtension> toInstall)
6161
{
6262
var installed = await Extensions.GetInstalledExtensionsAsync().ConfigureAwait(false);
6363
var gallery = await Extensions.GetGalleryExtensionsAsync(toInstall.Select(x => x.Id)).ConfigureAwait(false);
@@ -75,8 +75,7 @@ private async Task<IReadOnlyList<VSExtensionToInstall>> CreateExtensionsToInstal
7575

7676
return toInstall
7777
.Distinct(ExtensionEqualityComparer.Instance)
78-
.Select(x => new VSExtensionToInstall(x, statuses[x.Id]))
79-
.ToList();
78+
.Select(x => new VSExtensionToInstall(x, statuses[x.Id]));
8079
}
8180

8281
async Task IInstallWorker.InstallAsync(IManifest manifest, IReadOnlyCollection<IVSExtension> extensions, bool systemWide, IProgress<ProgressStep<InstallStep>> progress, CancellationToken cancellationToken)

src/ExtensionManager/Features/Install/InstallForSolutionFeature.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ExtensionManager.Manifest;
22
using ExtensionManager.UI;
33
using ExtensionManager.UI.Worker;
4+
using ExtensionManager.VisualStudio.Extensions;
45
using ExtensionManager.VisualStudio.Solution;
56

67
namespace ExtensionManager.Features.Install;
@@ -18,6 +19,19 @@ public InstallForSolutionFeature(Args args, IVSSolutions solutions)
1819
protected override async Task<string?> GetFilePathAsync()
1920
=> await _solutions.GetCurrentSolutionExtensionsManifestFilePathAsync(MessageBox);
2021

22+
protected override async Task<IEnumerable<VSExtensionToInstall>> CreateExtensionsToInstallListAsync(IEnumerable<IVSExtension> toInstall)
23+
{
24+
var extensions = await base.CreateExtensionsToInstallListAsync(toInstall);
25+
26+
return extensions
27+
.Where(x => x.Status != VSExtensionStatus.Installed);
28+
}
29+
2130
protected override async Task ShowInstallDialogAsync(IManifest manifest, IInstallWorker worker, IReadOnlyCollection<VSExtensionToInstall> extensions)
22-
=> await DialogService.ShowInstallForSolutionDialogAsync(worker, manifest, extensions);
31+
{
32+
if (extensions.Count == 0)
33+
return;
34+
35+
await DialogService.ShowInstallForSolutionDialogAsync(worker, manifest, extensions);
36+
}
2337
}

0 commit comments

Comments
 (0)