{"library":"prettier-plugin-kotlin","title":"Prettier Kotlin Plugin","description":"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.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prettier-plugin-kotlin"],"cli":null},"imports":["prettier.config.js -> module.exports = { plugins: ['prettier-plugin-kotlin'] }","const prettier = require('prettier'); const code = prettier.format('fun main() {}', { parser: 'kotlin', plugins: [require('prettier-plugin-kotlin')] })","import prettier from 'prettier'; const code = await prettier.format('fun main() {}', { parser: 'kotlin', plugins: ['prettier-plugin-kotlin'] })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// Ensure prettier and prettier-plugin-kotlin are installed\n// npm install prettier prettier-plugin-kotlin\n\nimport prettier from 'prettier';\n\nconst code = `fun main(args: Array<String>) { println(\"Hello, World!\") }`;\n\nconst formatted = await prettier.format(code, {\n  parser: 'kotlin',\n  plugins: ['prettier-plugin-kotlin'],\n  tabWidth: 2,\n  semi: false\n});\n\nconsole.log(formatted);\n// Expected output:\n// fun main(args: Array<String>) {\n//   println(\"Hello, World!\")\n// }","lang":"typescript","description":"Demonstrates formatting a simple Kotlin function with Prettier using the Kotlin plugin in ESM mode.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}