From adbbc3d60dad9cb18faa88d97e1f0a747dce65d1 Mon Sep 17 00:00:00 2001 From: abosch Date: Wed, 7 Jun 2017 20:46:50 +0200 Subject: [PATCH] Fix regression for spacing around else keyword --- .../shyiko/ktlint/ruleset/standard/SpacingAroundKeywordRule.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundKeywordRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundKeywordRule.kt index dd0c575374..560e50d7c0 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundKeywordRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundKeywordRule.kt @@ -46,7 +46,8 @@ class SpacingAroundKeywordRule : Rule("keyword-spacing") { node.nextLeaf()?.delete() } } - } else if (noLFBeforeSet.contains(node.elementType)) { + } + if (noLFBeforeSet.contains(node.elementType)) { val prevLeaf = PsiTreeUtil.prevLeaf(node) if (prevLeaf is PsiWhiteSpaceImpl && prevLeaf.textContains('\n') && (node.elementType != ELSE_KEYWORD || node.parent !is KtWhenEntry) &&