compiler-plugin / arrow.meta.quotes.filebase / File / <init>

<init>

File(value: KtFile, @annotations: ScopedList<KtAnnotationEntry> = ScopedList(value.annotationEntries), name: String = value.name, importList: Scope<KtImportList> = Scope(value.importList), fileAnnotationList: Scope<KtFileAnnotationList>? = Scope(value.fileAnnotationList), importDirectives: ScopedList<KtImportDirective> = ScopedList(value = value.importDirectives, postfix = ", "), packageDirective: PackageDirective = PackageDirective(value.packageDirective), packageFqName: FqName = value.packageFqName, packageFqNameByTree: FqName = value.packageFqNameByTree, script: Scope<KtScript>? = Scope(value.script), danglingAnnotations: ScopedList<KtAnnotationEntry> = ScopedList(value = value.danglingAnnotations, postfix = ", "), fileType: FileType = value.fileType, declarations: ScopedList<KtDeclaration> = ScopedList(value = value.declarations, postfix = ", "), stub: KotlinFileStub? = value.stub, classes: Array<PsiClass> = value.classes, sourcePath: FqName? = null)

file(name, “”” $packageDirective $importList $classes “””)

A template destructuring Scope for a File. See below:

import arrow.meta.Meta
import arrow.meta.CliPlugin
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.file

val Meta.reformatFile: CliPlugin
  get() =
    "ReformatFile" {
      meta(
       file({ true }) { file ->
         Transform.replace(
           replacing = file,
           newDeclaration = {
             """$packageDirective$importList$classes""".file(name)
           }
         )
       }
     )
   }

Do you like Arrow?

Arrow Org
<