Description
After reading several issues about code formatting support (#29, #303, #304), I think it might be feasible to just make a configurable subprocess command and launch it when code formatting is triggered, in the following steps (to be completed):
- Fix the default formatting style (of the plugin and of the codebase): Fix code formatting with
ktfmt
(fixes #304) #330. - Add option to customize formatting: TODO.
This proposal is made with the following considerations in mind:
-
There are various ways of formatting a Kotlin codebase. Apart from the
ktlint
vs.ktfmt
debate, each has different installation options (for just Gradle for example, there are existing Gradle plugins likektlint-gradle
andktfmt-gradle
, and there's alsospotless
). -
This has been done in similar projects. For example,
rust-analyzer
simply launchesrustfmt
to handle this. -
However, given the fact that there is no
rustfmt
equivalent in the Kotlin world, and that some might want to use this plugin without an explicit per-project formatter config, it's acceptable to keep the embedktfmt
as the default formatter.
What do you think of this idea? :)