@@ -144,30 +144,32 @@ public struct AddTarget: ManifestEditRefactoringProvider {
144144 to: & auxiliaryFiles
145145 )
146146
147- if #available( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , tvOS 16 . 0 , * ) , !manifest. description. contains ( " swift-syntax " ) {
148- newPackageCall =
149- try AddPackageDependency
150- . addPackageDependencyLocal (
151- . swiftSyntax(
152- version: configuration. swiftSyntaxVersion
153- ) ,
154- to: newPackageCall
155- )
156-
157- // Look for the first import declaration and insert an
158- // import of `CompilerPluginSupport` there.
159- let newImport = " import CompilerPluginSupport \n "
160- for node in manifest. statements {
161- if let importDecl = node. item. as ( ImportDeclSyntax . self) {
162- let insertPos = importDecl
163- . positionAfterSkippingLeadingTrivia
164- extraManifestEdits. append (
165- SourceEdit (
166- range: insertPos..< insertPos,
167- replacement: newImport
168- )
147+ if #available( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , tvOS 16 . 0 , * ) {
148+ if !manifest. description. contains ( " swift-syntax " ) {
149+ newPackageCall =
150+ try AddPackageDependency
151+ . addPackageDependencyLocal (
152+ . swiftSyntax(
153+ version: configuration. swiftSyntaxVersion
154+ ) ,
155+ to: newPackageCall
169156 )
170- break
157+
158+ // Look for the first import declaration and insert an
159+ // import of `CompilerPluginSupport` there.
160+ let newImport = " import CompilerPluginSupport \n "
161+ for node in manifest. statements {
162+ if let importDecl = node. item. as ( ImportDeclSyntax . self) {
163+ let insertPos = importDecl
164+ . positionAfterSkippingLeadingTrivia
165+ extraManifestEdits. append (
166+ SourceEdit (
167+ range: insertPos..< insertPos,
168+ replacement: newImport
169+ )
170+ )
171+ break
172+ }
171173 }
172174 }
173175 }
0 commit comments