aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorCarmi Grushko <carmi@fb.com>2020-08-20 08:29:11 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2020-08-20 08:30:09 -0700
commit944f445e052e698cba27378ce7ae3936762dd4ad (patch)
treeb3d216925d27acf2869c4b8267ac1355bc8048f9 /README.md
parentd1f72ac1ac079a1e9ce0cd6bc2185aab1172ef7b (diff)
downloadktfmt-944f445e052e698cba27378ce7ae3936762dd4ad.tar.gz
Add a section about the new IntelliJ plugin
Reviewed By: hick209 Differential Revision: D23239659 fbshipit-source-id: 326669633c7b442d997ab32a443a72b619fd5913
Diffstat (limited to 'README.md')
-rw-r--r--README.md24
1 files changed, 23 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9d4ae7f..bd6c122 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,28 @@ For comparison, the same code formatted by [`ktlint`](https://github.com/pintere
## Using the formatter
+### IntelliJ, Android Studio, and other JetBrains IDEs
+
+<iframe frameborder="none" width="245px" height="48px" src="https://plugins.jetbrains.com/embeddable/install/14912"></iframe>
+
+A
+[ktfmt IntelliJ plugin](https://plugins.jetbrains.com/plugin/14912-ktfmt)
+is available from the plugin repository. To install it, go to your IDE's
+settings and select the `Plugins` category. Click the `Marketplace` tab, search
+for the `ktfmt` plugin, and click the `Install` button.
+
+The plugin will be disabled by default. To enable it in the current project, go
+to `File→Settings...→ktfmt Settings` (or `IntelliJ
+IDEA→Preferences...→Editor→ktfmt Settings` on macOS) and
+check the `Enable ktfmt` checkbox. (A notification will be
+presented when you first open a project offering to do this for you.)
+
+To enable it by default in new projects, use `File→New Project Settings→Preferences for new Projects→Editor→ktfmt Settings`.
+
+When enabled, it will replace the normal `Reformat Code` action, which can be
+triggered from the `Code` menu or with the Ctrl-Alt-L (by default) keyboard
+shortcut.
+
### from the command-line
[Download the formatter](https://github.com/facebookincubator/ktfmt/releases)
@@ -37,7 +59,7 @@ java -jar /path/to/ktfmt-<VERSION>-jar-with-dependencies.jar [--dropbox-style] [
formatting (apart from `--dropbox-style`). This is a deliberate design decision to unify our code
formatting on a single format.*
-## using [Spotless](https://github.com/diffplug/spotless)
+### using [Spotless](https://github.com/diffplug/spotless)
On Gradle: https://github.com/diffplug/spotless/tree/main/plugin-gradle#ktfmt
On Maven: https://github.com/diffplug/spotless/tree/main/plugin-maven#ktfmt