code_formatting.md: external formatter

This commit is contained in:
Yann Cébron 2021-10-06 15:12:19 +02:00
parent 656787f40e
commit 32c18364a8
2 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,9 @@ _Early Access Program_ (EAP) releases of upcoming versions are available [here](
### IntelliJ Platform 2021.3
External code formatter tools API
: Allows integration of standalone tools like `shfmt`: [External Code Formatter](code_formatting.md#external-code-formatter).
Simplified API for `CustomComponentAction`
: Use new method `updateCustomComponent(Component, Presentation)` to synchronize given Presentation and component state.

View File

@ -1,6 +1,6 @@
[//]: # (title: Code Formatter)
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
The IntelliJ Platform includes a powerful framework for implementing custom language formatters.
In this framework, the plugin specifies the *constraints* on the spacing between different syntax elements.
@ -75,3 +75,12 @@ The return value of `createIndentOptions()` determines the default indent size.
Allows custom languages to provide user-configurable arrangement/grouping rules for element types supported by language plugin.
Rules can be refined via modifiers and name, ordering can be applied additionally.
Please see [`Rearranger`](upsource:///platform/code-style-api/src/com/intellij/psi/codeStyle/arrangement/Rearranger.java) and related for JavaDoc.
### External Code Formatter
_2021.3_
Register `com.intellij.formatting.service.AsyncDocumentFormattingService` implementation in extension point `com.intellij.formattingService` to invoke external formatter instead of IDE's builtin formatter.
**Example**:
`com.intellij.sh.formatter.ShExternalFormatter` from _Shell Script_ plugin