From fa482ddcf3a377c7b7f26703078706be287b117f Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Wed, 31 May 2017 13:46:18 -0700 Subject: [PATCH] Move to more data based (i.e. no logic) code actions --- .../InstallPackageAndAddImportCodeAction.cs | 151 +++++++++++++++++ .../InstallWithPackageManagerCodeAction.cs | 55 +++++++ ...ce.InstallPackageAndAddImportCodeAction.cs | 154 ------------------ ...nce.InstallWithPackageManagerCodeAction.cs | 51 ------ .../PackageReference.ParentCodeAction.cs | 104 ------------ .../ParentInstallPackageCodeAction.cs | 109 +++++++++++++ .../AddImport/References/PackageReference.cs | 3 +- src/Features/Core/Portable/Features.csproj | 6 +- 8 files changed, 320 insertions(+), 313 deletions(-) create mode 100644 src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs create mode 100644 src/Features/Core/Portable/AddImport/CodeActions/InstallWithPackageManagerCodeAction.cs delete mode 100644 src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallPackageAndAddImportCodeAction.cs delete mode 100644 src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallWithPackageManagerCodeAction.cs delete mode 100644 src/Features/Core/Portable/AddImport/CodeActions/PackageReference.ParentCodeAction.cs create mode 100644 src/Features/Core/Portable/AddImport/CodeActions/ParentInstallPackageCodeAction.cs diff --git a/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs new file mode 100644 index 00000000000..fdf6c4c389a --- /dev/null +++ b/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.AddPackage; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.Shared.Utilities; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.CodeFixes.AddImport +{ + internal abstract partial class AbstractAddImportCodeFixProvider + { + private class InstallPackageAndAddImportCodeAction : CodeAction + { + /// + /// The document before we added the import. Used so we can roll back if installing + /// the package failed. + /// + private readonly Document _oldDocument; + + /// + /// The changes to make to to add the import. + /// + private readonly ImmutableArray _textChanges; + + /// + /// The operation that will actually install the nuget package. + /// + private readonly InstallPackageDirectlyCodeActionOperation _installOperation; + + public override string Title { get; } + public override string EquivalenceKey => Title; + internal override CodeActionPriority Priority { get; } + + public InstallPackageAndAddImportCodeAction( + string title, + CodeActionPriority priority, + Document oldDocument, + ImmutableArray textChanges, + InstallPackageDirectlyCodeActionOperation installOperation) + { + Title = title; + Priority = priority; + _oldDocument = oldDocument; + _textChanges = textChanges; + _installOperation = installOperation; + } + + /// + /// For preview purposes we return all the operations in a list. This way the + /// preview system stiches things together in the UI to make a suitable display. + /// i.e. if we have a SolutionChangedOperation and some other operation with a + /// Title, then the UI will show that nicely to the user. + /// + protected override async Task> ComputePreviewOperationsAsync(CancellationToken cancellationToken) + { + // Make a SolutionChangeAction. This way we can let it generate the diff + // preview appropriately. + var solutionChangeAction = new SolutionChangeAction( + "", c => GetUpdatedSolutionAsync(c)); + + var result = ArrayBuilder.GetInstance(); + result.AddRange(await solutionChangeAction.GetPreviewOperationsAsync(cancellationToken).ConfigureAwait(false)); + result.Add(_installOperation); + return result.ToImmutableAndFree(); + } + + private async Task GetUpdatedSolutionAsync(CancellationToken cancellationToken) + { + var oldText = await _oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var newText = oldText.WithChanges(_textChanges); + + var newDocument = _oldDocument.WithText(newText); + var newRoot = await newDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + + // Suppress diagnostics on the import we create. Because we only get here when we are + // adding a nuget package, it is certainly the case that in the preview this will not + // bind properly. It will look silly to show such an error, so we just suppress things. + var updatedRoot = newRoot.WithAdditionalAnnotations(SuppressDiagnosticsAnnotation.Create()); + var updatedDocument = newDocument.WithSyntaxRoot(updatedRoot); + + return updatedDocument.Project.Solution; + } + + /// + /// However, for application purposes, we end up returning a single operation + /// that will then apply all our sub actions in order, stopping the moment + /// one of them fails. + /// + protected override async Task> ComputeOperationsAsync( + CancellationToken cancellationToken) + { + var oldText = await _oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var newText = oldText.WithChanges(_textChanges); + + return ImmutableArray.Create( + new InstallPackageAndAddImportOperation( + _oldDocument.Id, oldText, newText, _installOperation)); + } + } + + private class InstallPackageAndAddImportOperation : CodeActionOperation + { + private readonly DocumentId _changedDocumentId; + private readonly SourceText _oldText; + private readonly SourceText _newText; + private readonly InstallPackageDirectlyCodeActionOperation _installPackageOperation; + + public InstallPackageAndAddImportOperation( + DocumentId changedDocumentId, + SourceText oldText, + SourceText newText, + InstallPackageDirectlyCodeActionOperation item2) + { + _changedDocumentId = changedDocumentId; + _oldText = oldText; + _newText = newText; + _installPackageOperation = item2; + } + + internal override bool ApplyDuringTests => _installPackageOperation.ApplyDuringTests; + public override string Title => _installPackageOperation.Title; + + internal override bool TryApply(Workspace workspace, IProgressTracker progressTracker, CancellationToken cancellationToken) + { + var newSolution = workspace.CurrentSolution.WithDocumentText( + _changedDocumentId, _newText); + + // First make the changes to add the import to the document. + if (workspace.TryApplyChanges(newSolution, progressTracker)) + { + if (_installPackageOperation.TryApply(workspace, progressTracker, cancellationToken)) + { + return true; + } + + // Installing the nuget package failed. Roll back the workspace. + var rolledBackSolution = workspace.CurrentSolution.WithDocumentText( + _changedDocumentId, _oldText); + workspace.TryApplyChanges(rolledBackSolution, progressTracker); + } + + return false; + } + } + } +} \ No newline at end of file diff --git a/src/Features/Core/Portable/AddImport/CodeActions/InstallWithPackageManagerCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/InstallWithPackageManagerCodeAction.cs new file mode 100644 index 00000000000..9d0d74be46f --- /dev/null +++ b/src/Features/Core/Portable/AddImport/CodeActions/InstallWithPackageManagerCodeAction.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.Packaging; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.CodeFixes.AddImport +{ + internal abstract partial class AbstractAddImportCodeFixProvider + { + private class InstallWithPackageManagerCodeAction : CodeAction + { + private readonly IPackageInstallerService _installerService; + private readonly string _packageName; + + public InstallWithPackageManagerCodeAction( + IPackageInstallerService installerService, + string packageName) + { + _installerService = installerService; + _packageName = packageName; + } + + public override string Title => FeaturesResources.Install_with_package_manager; + + protected override Task> ComputeOperationsAsync(CancellationToken cancellationToken) + { + return Task.FromResult(SpecializedCollections.SingletonEnumerable( + new InstallWithPackageManagerCodeActionOperation(_installerService, _packageName))); + } + + private class InstallWithPackageManagerCodeActionOperation : CodeActionOperation + { + private readonly IPackageInstallerService _installerService; + private readonly string _packageName; + + public InstallWithPackageManagerCodeActionOperation( + IPackageInstallerService installerService, + string packageName) + { + _installerService = installerService; + _packageName = packageName; + } + + public override string Title => FeaturesResources.Install_with_package_manager; + + public override void Apply(Workspace workspace, CancellationToken cancellationToken) + => _installerService.ShowManagePackagesDialog(_packageName); + } + } + } +} \ No newline at end of file diff --git a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallPackageAndAddImportCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallPackageAndAddImportCodeAction.cs deleted file mode 100644 index 74d9fb3ff57..00000000000 --- a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallPackageAndAddImportCodeAction.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.AddPackage; -using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.Shared.Utilities; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.CodeFixes.AddImport -{ - internal abstract partial class AbstractAddImportCodeFixProvider - { - private partial class PackageReference - { - private class InstallPackageAndAddImportCodeAction : CodeAction - { - public override string Title { get; } - public override string EquivalenceKey => Title; - internal override CodeActionPriority Priority { get; } - - /// - /// The document before we added the import. Used so we can roll back if installing - /// the package failed. - /// - private readonly Document _oldDocument; - - /// - /// The changes to make to to add the import. - /// - private readonly ImmutableArray _textChanges; - - /// - /// The operation that will actually install the nuget package. - /// - private readonly InstallPackageDirectlyCodeActionOperation _installOperation; - - public InstallPackageAndAddImportCodeAction( - string title, - CodeActionPriority priority, - Document oldDocument, - ImmutableArray textChanges, - InstallPackageDirectlyCodeActionOperation installOperation) - { - Title = title; - Priority = priority; - _oldDocument = oldDocument; - _textChanges = textChanges; - _installOperation = installOperation; - } - - /// - /// For preview purposes we return all the operations in a list. This way the - /// preview system stiches things together in the UI to make a suitable display. - /// i.e. if we have a SolutionChangedOperation and some other operation with a - /// Title, then the UI will show that nicely to the user. - /// - protected override async Task> ComputePreviewOperationsAsync(CancellationToken cancellationToken) - { - // Make a SolutionChangeAction. This way we can let it generate the diff - // preview appropriately. - var solutionChangeAction = new SolutionChangeAction( - "", c => GetUpdatedSolutionAsync(c)); - - var result = ArrayBuilder.GetInstance(); - result.AddRange(await solutionChangeAction.GetPreviewOperationsAsync(cancellationToken).ConfigureAwait(false)); - result.Add(_installOperation); - return result.ToImmutableAndFree(); - } - - private async Task GetUpdatedSolutionAsync(CancellationToken cancellationToken) - { - var oldText = await _oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); - var newText = oldText.WithChanges(_textChanges); - - var newDocument = _oldDocument.WithText(newText); - var newRoot = await newDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - - // Suppress diagnostics on the import we create. Because we only get here when we are - // adding a nuget package, it is certainly the case that in the preview this will not - // bind properly. It will look silly to show such an error, so we just suppress things. - var updatedRoot = newRoot.WithAdditionalAnnotations(SuppressDiagnosticsAnnotation.Create()); - var updatedDocument = newDocument.WithSyntaxRoot(updatedRoot); - - return updatedDocument.Project.Solution; - } - - /// - /// However, for application purposes, we end up returning a single operation - /// that will then apply all our sub actions in order, stopping the moment - /// one of them fails. - /// - protected override async Task> ComputeOperationsAsync( - CancellationToken cancellationToken) - { - var oldText = await _oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); - var newText = oldText.WithChanges(_textChanges); - - return ImmutableArray.Create( - new InstallPackageAndAddImportOperation( - _oldDocument.Id, oldText, newText, _installOperation)); - } - } - - private class InstallPackageAndAddImportOperation : CodeActionOperation - { - private readonly DocumentId _changedDocumentId; - private readonly SourceText _oldText; - private readonly SourceText _newText; - private readonly InstallPackageDirectlyCodeActionOperation _installPackageOperation; - - public InstallPackageAndAddImportOperation( - DocumentId changedDocumentId, - SourceText oldText, - SourceText newText, - InstallPackageDirectlyCodeActionOperation item2) - { - _changedDocumentId = changedDocumentId; - _oldText = oldText; - _newText = newText; - _installPackageOperation = item2; - } - - internal override bool ApplyDuringTests => _installPackageOperation.ApplyDuringTests; - public override string Title => _installPackageOperation.Title; - - internal override bool TryApply(Workspace workspace, IProgressTracker progressTracker, CancellationToken cancellationToken) - { - var newSolution = workspace.CurrentSolution.WithDocumentText( - _changedDocumentId, _newText); - - // First make the changes to add the import to the document. - if (workspace.TryApplyChanges(newSolution, progressTracker)) - { - if (_installPackageOperation.TryApply(workspace, progressTracker, cancellationToken)) - { - return true; - } - - // Installing the nuget package failed. Roll back the workspace. - var rolledBackSolution = workspace.CurrentSolution.WithDocumentText( - _changedDocumentId, _oldText); - workspace.TryApplyChanges(rolledBackSolution, progressTracker); - } - - return false; - } - } - } - } -} \ No newline at end of file diff --git a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallWithPackageManagerCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallWithPackageManagerCodeAction.cs deleted file mode 100644 index 7529d451868..00000000000 --- a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.InstallWithPackageManagerCodeAction.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CodeActions; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.CodeFixes.AddImport -{ - internal abstract partial class AbstractAddImportCodeFixProvider - { - private partial class PackageReference : Reference - { - private class InstallWithPackageManagerCodeAction : CodeAction - { - private readonly PackageReference reference; - - public InstallWithPackageManagerCodeAction(PackageReference reference) - { - this.reference = reference; - } - - public override string Title => FeaturesResources.Install_with_package_manager; - - protected override Task> ComputeOperationsAsync(CancellationToken cancellationToken) - { - return Task.FromResult(SpecializedCollections.SingletonEnumerable( - new InstallWithPackageManagerCodeActionOperation(reference))); - } - - private class InstallWithPackageManagerCodeActionOperation : CodeActionOperation - { - private readonly PackageReference reference; - - public InstallWithPackageManagerCodeActionOperation(PackageReference reference) - { - this.reference = reference; - } - - public override string Title => FeaturesResources.Install_with_package_manager; - - public override void Apply(Workspace workspace, CancellationToken cancellationToken) - { - reference._installerService.ShowManagePackagesDialog(reference._packageName); - } - } - } - } - } -} diff --git a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.ParentCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.ParentCodeAction.cs deleted file mode 100644 index 6d8788e9134..00000000000 --- a/src/Features/Core/Portable/AddImport/CodeActions/PackageReference.ParentCodeAction.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Immutable; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.AddPackage; -using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.Tags; -using Microsoft.CodeAnalysis.Text; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.CodeFixes.AddImport -{ - internal abstract partial class AbstractAddImportCodeFixProvider - { - private partial class PackageReference : Reference - { - /// - /// This is the top level 'Install Nuget Package' code action we show in - /// the lightbulb. It will have children to 'Install Latest', - /// 'Install Version 'X' ..., and 'Install with package manager'. - /// - private class ParentCodeAction : CodeAction.CodeActionWithNestedActions - { - private readonly PackageReference _reference; - - public override ImmutableArray Tags => WellKnownTagArrays.NuGet; - - // Adding a nuget reference is lower priority than other fixes.. - internal override CodeActionPriority Priority => CodeActionPriority.Low; - - /// - /// Even though we have child actions, we mark ourselves as explicitly non-inlinable. - /// We want to the experience of having the top level item the user has to see and - /// navigate through, and we don't want our child items confusingly being added to the - /// top level light-bulb where it's not clear what effect they would have if invoked. - /// - public ParentCodeAction( - PackageReference reference, - Document document, - ImmutableArray textChanges) - : base(string.Format(FeaturesResources.Install_package_0, reference._packageName), - CreateNestedActions(reference, document, textChanges), - isInlinable: false) - { - _reference = reference; - } - - private static ImmutableArray CreateNestedActions( - PackageReference reference, - Document document, - ImmutableArray textChanges) - { - // Determine what versions of this package are already installed in some project - // in this solution. We'll offer to add those specific versions to this project, - // followed by an option to "Find and install latest version." - var installedVersions = reference._installerService.GetInstalledVersions(reference._packageName).NullToEmpty(); - var codeActions = ArrayBuilder.GetInstance(); - - // First add the actions to install a specific version. - codeActions.AddRange(installedVersions.Select( - v => CreateCodeAction(reference, document, textChanges, versionOpt: v, isLocal: true))); - - // Now add the action to install the specific version. - var preferredVersion = reference._versionOpt; - if (preferredVersion == null || !installedVersions.Contains(preferredVersion)) - { - codeActions.Add(CreateCodeAction(reference, document, textChanges, - versionOpt: reference._versionOpt, isLocal: false)); - } - - // And finally the action to show the package manager dialog. - codeActions.Add(new InstallWithPackageManagerCodeAction(reference)); - return codeActions.ToImmutableAndFree(); - } - - private static CodeAction CreateCodeAction( - PackageReference reference, - Document document, - ImmutableArray textChanges, - string versionOpt, - bool isLocal) - { - var title = versionOpt == null - ? FeaturesResources.Find_and_install_latest_version - : isLocal - ? string.Format(FeaturesResources.Use_local_version_0, versionOpt) - : string.Format(FeaturesResources.Install_version_0, versionOpt); - - var installOperation = new InstallPackageDirectlyCodeActionOperation( - reference._installerService, document, reference._source, - reference._packageName, versionOpt, - includePrerelease: false, isLocal: isLocal); - - // Nuget hits should always come after other results. - return new InstallPackageAndAddImportCodeAction( - title, CodeActionPriority.Low, - document, textChanges, installOperation); - } - } - } - } -} \ No newline at end of file diff --git a/src/Features/Core/Portable/AddImport/CodeActions/ParentInstallPackageCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/ParentInstallPackageCodeAction.cs new file mode 100644 index 00000000000..666e2563b8a --- /dev/null +++ b/src/Features/Core/Portable/AddImport/CodeActions/ParentInstallPackageCodeAction.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.AddPackage; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.Packaging; +using Microsoft.CodeAnalysis.Tags; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.CodeFixes.AddImport +{ + internal abstract partial class AbstractAddImportCodeFixProvider + { + /// + /// This is the top level 'Install Nuget Package' code action we show in + /// the lightbulb. It will have children to 'Install Latest', + /// 'Install Version 'X' ..., and 'Install with package manager'. + /// + private class ParentInstallPackageCodeAction : CodeAction.CodeActionWithNestedActions + { + public override ImmutableArray Tags => WellKnownTagArrays.NuGet; + + // Adding a nuget reference is lower priority than other fixes.. + internal override CodeActionPriority Priority => CodeActionPriority.Low; + + /// + /// Even though we have child actions, we mark ourselves as explicitly non-inlinable. + /// We want to the experience of having the top level item the user has to see and + /// navigate through, and we don't want our child items confusingly being added to the + /// top level light-bulb where it's not clear what effect they would have if invoked. + /// + public ParentInstallPackageCodeAction( + IPackageInstallerService installerService, + string source, + string packageName, + string versionOpt, + Document document, + ImmutableArray textChanges) + : base(string.Format(FeaturesResources.Install_package_0, packageName), + CreateNestedActions(installerService, source, packageName, versionOpt, document, textChanges), + isInlinable: false) + { + } + + private static ImmutableArray CreateNestedActions( + IPackageInstallerService installerService, + string source, + string packageName, + string versionOpt, + Document document, + ImmutableArray textChanges) + { + // Determine what versions of this package are already installed in some project + // in this solution. We'll offer to add those specific versions to this project, + // followed by an option to "Find and install latest version." + var installedVersions = installerService.GetInstalledVersions(packageName).NullToEmpty(); + var codeActions = ArrayBuilder.GetInstance(); + + // First add the actions to install a specific version. + codeActions.AddRange(installedVersions.Select( + v => CreateCodeAction( + installerService, source, packageName, v, + document, textChanges, isLocal: true))); + + // Now add the action to install the specific version. + var preferredVersion = versionOpt; + if (preferredVersion == null || !installedVersions.Contains(preferredVersion)) + { + codeActions.Add(CreateCodeAction( + installerService, source, packageName, versionOpt, + document, textChanges, isLocal: false)); + } + + // And finally the action to show the package manager dialog. + codeActions.Add(new InstallWithPackageManagerCodeAction(installerService, packageName)); + return codeActions.ToImmutableAndFree(); + } + + private static CodeAction CreateCodeAction( + IPackageInstallerService installerService, + string source, + string packageName, + string versionOpt, + Document document, + ImmutableArray textChanges, + bool isLocal) + { + var title = versionOpt == null + ? FeaturesResources.Find_and_install_latest_version + : isLocal + ? string.Format(FeaturesResources.Use_local_version_0, versionOpt) + : string.Format(FeaturesResources.Install_version_0, versionOpt); + + var installOperation = new InstallPackageDirectlyCodeActionOperation( + installerService, document, source, packageName, versionOpt, + includePrerelease: false, isLocal: isLocal); + + // Nuget hits should always come after other results. + return new InstallPackageAndAddImportCodeAction( + title, CodeActionPriority.Low, + document, textChanges, installOperation); + } + } + } +} \ No newline at end of file diff --git a/src/Features/Core/Portable/AddImport/References/PackageReference.cs b/src/Features/Core/Portable/AddImport/References/PackageReference.cs index 8a076363044..bd0d06468fd 100644 --- a/src/Features/Core/Portable/AddImport/References/PackageReference.cs +++ b/src/Features/Core/Portable/AddImport/References/PackageReference.cs @@ -39,7 +39,8 @@ private partial class PackageReference : Reference var textChanges = await GetTextChangesAsync( document, node, placeSystemNamespaceFirst, cancellationToken).ConfigureAwait(false); - return new ParentCodeAction(this, document, textChanges); + return new ParentInstallPackageCodeAction( + _installerService, _source, _packageName, _versionOpt, document, textChanges); } public override bool Equals(object obj) diff --git a/src/Features/Core/Portable/Features.csproj b/src/Features/Core/Portable/Features.csproj index 2274b00bac8..868eea7f31b 100644 --- a/src/Features/Core/Portable/Features.csproj +++ b/src/Features/Core/Portable/Features.csproj @@ -118,8 +118,8 @@ - - + + @@ -184,7 +184,7 @@ - + -- GitLab