Matt Groth
12/20/2022, 6:05 PM.kts
kotlin code:
ExperimentalParams(
text = code,
script = true,
cb = { _: LintError, _: Boolean ->
}
But now that this is deprecated, its unclear how I would format kts
code. KtLintRuleEngine.format
internally creates a Code
instance as seen below:
public fun format(
code: String,
filePath: Path? = null,
callback: (LintError, Boolean) -> Unit = { _, _ -> },
): String =
format(
Code(
text = code,
fileName = filePath?.absolutePathString(),
),
callback,
)
The script
property of Code
is false by default. However, both the function above and the Code
class is internal. So I don’t know what the proper way is to format .kts
code strings since I can’t find a public property or argument for setting script
to true any more.