compiler-plugin / arrow.meta.quotes.filebase / File

File

class File : Scope<KtFile>

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)
           }
         )
       }
     )
   }

Constructors

<init> file(name, “”” $packageDirective $importList $classes “””)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)

Properties

@annotations val @annotations: ScopedList<KtAnnotationEntry>
classes val classes: Array<PsiClass>
danglingAnnotations val danglingAnnotations: ScopedList<KtAnnotationEntry>
declarations val declarations: ScopedList<KtDeclaration>
fileAnnotationList val fileAnnotationList: Scope<KtFileAnnotationList>?
fileType val fileType: FileType
importDirectives val importDirectives: ScopedList<KtImportDirective>
importList val importList: Scope<KtImportList>
name val name: String
packageDirective val packageDirective: PackageDirective
packageFqName val packageFqName: FqName
packageFqNameByTree val packageFqNameByTree: FqName
script val script: Scope<KtScript>?
sourcePath val sourcePath: FqName?
stub val stub: KotlinFileStub?
value val value: KtFile

Extension Functions

map fun <K : KtElement> Scope<K>.map(f: (K) -> K): Scope<K>
orEmpty fun <K : KtElement> Scope<K>?.orEmpty(): Scope<K>

Do you like Arrow?

Arrow Org
<