Prettier plugin for Kotlin language formatting. v2.1.0 (latest) ditched the original JS-based printer in favor of kastree's Kotlin Writer, a significant breaking change from v1.x. The parser (kotato) is alpha-stage, based on kastree, and can parse most Kotlin code but has performance issues. Release cadence is irregular with long gaps. Key differentiator: integrates Kotlin formatting into Prettier's ecosystem, allowing uniform code style across JS/TS/CSS/Kotlin projects. Lacks stable and full Kotlin grammar support; not recommended for production.
npm install prettier-plugin-kotlinVerified import paths — ran on the pinned version, not inferred.
Demonstrates formatting a simple Kotlin function with Prettier using the Kotlin plugin in ESM mode.
Reformat all Kotlin files with the new plugin version. Review diff of formatted files for regressions.
For production, use kotlinc or ktlint. Only use this plugin for experimental or simple projects.
Restart VSCode after installing plugin. Set 'prettier.requireConfig': false if needed. See https://github.com/prettier/prettier-vscode/issues/395
Update to version 2.1.0: npm install prettier-plugin-kotlin@latest
Run 'npm install --dev prettier prettier-plugin-kotlin' in your project root.
Simplify the code or fix syntax errors. For advanced features, use ktlint instead.
Update both prettier and prettier-plugin-kotlin to latest: npm install prettier@latest prettier-plugin-kotlin@latest