You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
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.
If I am correct you can just provide any filename ending with “.kts”. It is not needed that the file really exists. Problem with having both a filename and script property was that they could be inconsistent, like file “something.kt” with “script = true”.
However in my personal opinion, I think this is not ideal because passing a file path suggests that some IO might occur. In cases like mine where I am just formatting a string snippet of kts code with no associated file or project, this doesn't make sense. The function KtLintRuleEngine.format says '.editorconfig' files on the path are taken into account but this is not desirable for cases where snippets of kotlin code existing outside any file or project are being linted or formated.
The text was updated successfully, but these errors were encountered:
changed the title
Migrating from 0.47.1 to 0.48.0 for formating ".kts" strings (non-files) is confusingDec 20, 2022