File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2567,6 +2567,12 @@ class CodeFormatter {
2567
2567
std::pair<LineRange, std::string> indent (unsigned LineIndex,
2568
2568
FormatContext &FC,
2569
2569
StringRef Text) {
2570
+ if (FC.IsInStringLiteral ()) {
2571
+ return std::make_pair (
2572
+ LineRange (LineIndex, 1 ),
2573
+ swift::ide::getTextForLine (LineIndex, Text, /* Trim*/ false ).str ());
2574
+ }
2575
+
2570
2576
if (FC.isExact ()) {
2571
2577
StringRef Line = swift::ide::getTextForLine (LineIndex, Text, /* Trim*/ true );
2572
2578
StringBuilder Builder;
@@ -2575,12 +2581,6 @@ class CodeFormatter {
2575
2581
return std::make_pair (LineRange (LineIndex, 1 ), Builder.str ().str ());
2576
2582
}
2577
2583
2578
- if (FC.IsInStringLiteral ()) {
2579
- return std::make_pair (
2580
- LineRange (LineIndex, 1 ),
2581
- swift::ide::getTextForLine (LineIndex, Text, /* Trim*/ false ).str ());
2582
- }
2583
-
2584
2584
// Take the current indent position of the context, then add the number of
2585
2585
// indents specified.
2586
2586
auto LineAndColumn = FC.indentLineAndColumn ();
Original file line number Diff line number Diff line change @@ -287,6 +287,12 @@ let s = """
287
287
c
288
288
"""
289
289
290
+ print ( """
291
+ foo {
292
+ bar()
293
+ }
294
+ """ )
295
+
290
296
291
297
// Interpolations shouldn't change how multiline strings are handled.
292
298
//
You can’t perform that action at this time.
0 commit comments