Skip to content

Commit b686a1c

Browse files
committed
docs: start documenting idea usage
1 parent 412430d commit b686a1c

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

plugin-gradle/README.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Spotless supports all of Gradle's built-in performance features (incremental bui
5555
- [Requirements](#requirements)
5656
- [Linting](#linting)
5757
- **Languages**
58-
- [Java](#java) ([google-java-format](#google-java-format), [eclipse jdt](#eclipse-jdt), [clang-format](#clang-format), [prettier](#prettier), [palantir-java-format](#palantir-java-format), [formatAnnotations](#formatAnnotations), [cleanthat](#cleanthat))
58+
- [Java](#java) ([google-java-format](#google-java-format), [eclipse jdt](#eclipse-jdt), [clang-format](#clang-format), [prettier](#prettier), [palantir-java-format](#palantir-java-format), [formatAnnotations](#formatAnnotations), [cleanthat](#cleanthat), [IntelliJ IDEA](#intellij-idea))
5959
- [Groovy](#groovy) ([eclipse groovy](#eclipse-groovy))
6060
- [Kotlin](#kotlin) ([ktfmt](#ktfmt), [ktlint](#ktlint), [diktat](#diktat), [prettier](#prettier))
6161
- [Scala](#scala) ([scalafmt](#scalafmt))
@@ -65,7 +65,7 @@ Spotless supports all of Gradle's built-in performance features (incremental bui
6565
- [FreshMark](#freshmark) aka markdown
6666
- [Flexmark](#flexmark) aka markdown
6767
- [Antlr4](#antlr4) ([antlr4formatter](#antlr4formatter))
68-
- [SQL](#sql) ([dbeaver](#dbeaver), [prettier](#prettier))
68+
- [SQL](#sql) ([dbeaver](#dbeaver), [prettier](#prettier), [IntelliJ IDEA](#intellij-idea))
6969
- [Maven POM](#maven-pom) ([sortPom](#sortpom))
7070
- [Typescript](#typescript) ([tsfmt](#tsfmt), [prettier](#prettier), [ESLint](#eslint-typescript), [Biome](#biome))
7171
- [Javascript](#javascript) ([prettier](#prettier), [ESLint](#eslint-javascript), [Biome](#biome))
@@ -78,6 +78,7 @@ Spotless supports all of Gradle's built-in performance features (incremental bui
7878
- [clang-format](#clang-format)
7979
- [eclipse web tools platform](#eclipse-web-tools-platform)
8080
- [Biome](#biome) ([binary detection](#biome-binary), [config file](#biome-configuration-file), [input language](#biome-input-language))
81+
- [IntelliJ IDEA](#intellij-idea)
8182
- **Language independent**
8283
- [Generic steps](#generic-steps)
8384
- [License header](#license-header) ([slurp year from git](#retroactively-slurp-years-from-git-history))
@@ -198,6 +199,7 @@ spotless {
198199
eclipse() // has its own section below
199200
prettier() // has its own section below
200201
clangFormat() // has its own section below
202+
idea() // has its own section below
201203
202204
formatAnnotations() // fixes formatting of type annotations, see below
203205
@@ -754,6 +756,7 @@ spotless {
754756
755757
dbeaver() // has its own section below
756758
prettier() // has its own section below
759+
idea() // has its own section below
757760
}
758761
}
759762
```
@@ -1581,9 +1584,42 @@ The following languages are currently recognized:
15811584
* `ts?` -- TypeScript, with or without JSX, depending on the file extension
15821585
* `json` -- JSON
15831586

1587+
## IntelliJ IDEA
1588+
1589+
[homepage](https://www.jetbrains.com/idea/). [changelog](https://www.jetbrains.com/idea/whatsnew/).
1590+
1591+
`IntelliJ IDEA` is a powerful IDE for java, kotlin and many more languages. There are [specific variants](https://www.jetbrains.com/products/) for almost any modern language
1592+
and a plethora of [plugins](https://plugins.jetbrains.com/).
1593+
1594+
Spotless provides access to IntelliJ IDEA's command line formatter.
1595+
1596+
1597+
```gradle
1598+
spotless {
1599+
format 'myFormatter', {
1600+
// you have to set the target manually
1601+
target 'src/main/**/*.java','jbang/*.java'
1602+
1603+
idea()
1604+
.codeStyleSettingsPath('/path/to/config') // if you have custom formatting rules, see below for how to get them
1605+
.withDefaults(true) // Use the default code style settings when the code style is not defined for a file type (default: true)
1606+
1607+
// if idea is not on your path, you must specify the path to the executable
1608+
idea().binaryPath('/path/to/idea')
1609+
}
1610+
}
1611+
```
1612+
1613+
### How to generate code style settings files
1614+
TODO
1615+
1616+
### Limitations
1617+
- Currently, only IntelliJ IDEA is supported - none of the other jetbrains IDE. Consider opening a PR if you want to change this.
1618+
- Launching IntelliJ IDEA from the command line is pretty expensive and as of now, we do this for each file. If you want to change this, consider opening a PR.
1619+
15841620
## Generic steps
15851621
1586-
[Prettier](#prettier), [eclipse wtp](#eclipse-web-tools-platform), and [license header](#license-header) are available in every format, and they each have their own section. As mentioned in the [quickstart](#quickstart), there are a variety of simple generic steps which are also available in every format, here are examples of these:
1622+
[Prettier](#prettier), [eclipse wtp](#eclipse-web-tools-platform), [IntelliJ IDEA](#intellij-idea) and [license header](#license-header) are available in every format, and they each have their own section. As mentioned in the [quickstart](#quickstart), there are a variety of simple generic steps which are also available in every format, here are examples of these:
15871623
15881624
```gradle
15891625
spotless {

0 commit comments

Comments
 (0)