Skip to content

Commit 4b4c96c

Browse files
Nivaldo Bondançafacebook-github-bot
authored andcommitted
Handle multiline strings inside of chained calls
Summary: Noticed that some multiline strings were not formatted and the common thing about them was that they were nested inside of other `QualifiedExpression`s. The fix is a simple one-liner. Reviewed By: cortinico Differential Revision: D81201748 fbshipit-source-id: be59518987efc7aa774f05b3ae48326fbc735f0a
1 parent 5c46e27 commit 4b4c96c

4 files changed

Lines changed: 312 additions & 253 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
1717

1818
### Fixed
1919
- Do not apply special format handling of multiline strings with template expressions in them (https://github.com/facebook/ktfmt/issues/556)
20+
- Make sure that we handle nested expressions for special format handling of multiline strings
2021

2122

2223
## [0.57]

core/src/main/java/com/facebook/ktfmt/format/MultilineStringFormatter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class MultilineStringFormatter(val continuationIndentSize: Int) {
135135
file.accept(
136136
object : KtTreeVisitorVoid() {
137137
override fun visitQualifiedExpression(expression: KtQualifiedExpression) {
138+
super.visitQualifiedExpression(expression)
138139
val receiver = expression.receiverExpression
139140
if (receiver !is KtStringTemplateExpression) return
140141
val isDollarString = receiver.text.startsWith("$$")

0 commit comments

Comments
 (0)