Hello, I hope this is an ok place to ask a migrati...
# ktlint
m
Hello, I hope this is an ok place to ask a migration question. I am trying to upgrade from 0.47.1 to 0.48.0. I am usiing the API to format the code contained in strings (no files). I used to use this for
.kts
kotlin code:
Copy 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:
Copy code
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.