Skip to content

Commit

Permalink
[#1347] Indent only TEMPLATE_ENTRY nodes immediately following a ne…
Browse files Browse the repository at this point in the history
…wline

### What's done:

 * Minor code clean-up.
  • Loading branch information
0x6675636b796f75676974687562 committed Jun 21, 2022
1 parent 826a25d commit 1591d9e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class IndentationRule(configRules: List<RulesConfig>) : DiktatRule(
actualIndent: Int
) {
val templateEntries = stringTemplate.getAllChildrenWithType(LITERAL_STRING_TEMPLATE_ENTRY)
val templateEntriesSize = templateEntries.size
val templateEntriesLastIndex = templateEntries.size - 1
var templateEntryFollowingNewline = false

templateEntries.forEachIndexed { index, templateEntry ->
Expand Down Expand Up @@ -321,7 +321,7 @@ class IndentationRule(configRules: List<RulesConfig>) : DiktatRule(
* This is the last string template fragment which is usually followed
* with the closing `"""` and the `.trimIndent()` or `.trimMargin(...)` call.
*/
index == templateEntriesSize - 1 -> {
index == templateEntriesLastIndex -> {
val lastRegularStringPart = templateEntries.last().firstChildNode as LeafPsiElement
lastRegularStringPart.checkRegularStringPart().apply {
val textWithoutIndent = text.trimStart()
Expand Down

0 comments on commit 1591d9e

Please sign in to comment.