diff --git a/Sources/Commands/PackageCommands/AddDependency.swift b/Sources/Commands/PackageCommands/AddDependency.swift index e6086e11781..03c49fc9661 100644 --- a/Sources/Commands/PackageCommands/AddDependency.swift +++ b/Sources/Commands/PackageCommands/AddDependency.swift @@ -255,7 +255,7 @@ extension SwiftPackageCommand { } } - let editResult = try AddPackageDependency.manifestRefactor( + let editResult = try AddPackageDependency.textRefactor( syntax: manifestSyntax, in: .init(dependency: packageDependency) ) diff --git a/Sources/Commands/PackageCommands/AddProduct.swift b/Sources/Commands/PackageCommands/AddProduct.swift index 9410b035b76..288e691797b 100644 --- a/Sources/Commands/PackageCommands/AddProduct.swift +++ b/Sources/Commands/PackageCommands/AddProduct.swift @@ -93,7 +93,7 @@ extension SwiftPackageCommand { targets: targets ) - let editResult = try SwiftRefactor.AddProduct.manifestRefactor( + let editResult = try SwiftRefactor.AddProduct.textRefactor( syntax: manifestSyntax, in: .init(product: product) ) diff --git a/Sources/Commands/PackageCommands/AddSetting.swift b/Sources/Commands/PackageCommands/AddSetting.swift index 9a1e3988895..4589bfa50f9 100644 --- a/Sources/Commands/PackageCommands/AddSetting.swift +++ b/Sources/Commands/PackageCommands/AddSetting.swift @@ -126,7 +126,7 @@ extension SwiftPackageCommand { } } - let editResult: PackageEdit + let editResult: [SourceEdit] switch setting { case .experimentalFeature: diff --git a/Sources/Commands/PackageCommands/AddTarget.swift b/Sources/Commands/PackageCommands/AddTarget.swift index b625931bd44..089f148675f 100644 --- a/Sources/Commands/PackageCommands/AddTarget.swift +++ b/Sources/Commands/PackageCommands/AddTarget.swift @@ -129,7 +129,8 @@ extension SwiftPackageCommand { url: url, checksum: checksum ) - let editResult = try AddPackageTarget.manifestRefactor( + + let editResult = try AddPackageTarget.textRefactor( syntax: manifestSyntax, in: .init( target: target, diff --git a/Sources/Commands/PackageCommands/AddTargetDependency.swift b/Sources/Commands/PackageCommands/AddTargetDependency.swift index ad8cb7829fc..c5daf524361 100644 --- a/Sources/Commands/PackageCommands/AddTargetDependency.swift +++ b/Sources/Commands/PackageCommands/AddTargetDependency.swift @@ -73,7 +73,7 @@ extension SwiftPackageCommand { dependency = .target(name: dependencyName) } - let editResult = try SwiftRefactor.AddTargetDependency.manifestRefactor( + let editResult = try SwiftRefactor.AddTargetDependency.textRefactor( syntax: manifestSyntax, in: .init( dependency: dependency, diff --git a/Sources/Commands/Utilities/RefactoringSupport.swift b/Sources/Commands/Utilities/RefactoringSupport.swift index fe57c09dc4f..352e4055c8e 100644 --- a/Sources/Commands/Utilities/RefactoringSupport.swift +++ b/Sources/Commands/Utilities/RefactoringSupport.swift @@ -15,7 +15,7 @@ import Basics @_spi(PackageRefactor) import SwiftRefactor import SwiftSyntax -package extension PackageEdit { +package extension [SourceEdit] { /// Apply the edits for the given manifest to the specified file system, /// updating the manifest to the given manifest func applyEdits( @@ -32,7 +32,7 @@ package extension PackageEdit { } let updatedManifestSource = FixItApplier.apply( - edits: manifestEdits, + edits: self, to: manifest ) try filesystem.writeFileContents(