Skip to content

Commit 9cee77b

Browse files
committed
Revert Avoid non actionable edits
1 parent 450cfdc commit 9cee77b

1 file changed

Lines changed: 18 additions & 39 deletions

File tree

server/src/formatting/longLines.ts

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -661,59 +661,38 @@ const formatLongLinesArrayValue = (
661661
widthToPrefix(settings, propertyNameWidth + 4),
662662
);
663663

664-
let lastToken = otherItem?.firstToken.prevToken;
665-
666-
if (!lastToken) {
667-
lastToken = value.lastToken;
668-
while (lastToken.pos.line === lastToken.nextToken?.pos.line) {
669-
lastToken = lastToken.nextToken;
670-
}
671-
}
672-
const lineLength =
673-
indent.replaceAll('\t', ' '.repeat(settings.tabSize)).length +
674-
lastToken.pos.colEnd -
675-
value.firstToken.pos.col;
676-
677664
return [
678665
genFormattingDiagnostic(
679666
FormattingIssues.LONG_LINE_WRAP,
680667
value.firstToken.fsPath,
681668
toPosition(value.firstToken, false),
682669
{
683-
edit:
684-
lineLength <= settings.wordWrapColumn
670+
edit: [
671+
TextEdit.replace(
672+
Range.create(
673+
toPosition(value.firstToken.prevToken!),
674+
toPosition(value.firstToken, false),
675+
),
676+
`\n${indent}`,
677+
),
678+
...(otherItem // wrap other item up to recursively align using least line possible
685679
? [
686680
TextEdit.replace(
687681
Range.create(
688682
toPosition(
689-
value.firstToken.prevToken!,
683+
getFirstToken(otherItem)
684+
.prevToken!,
685+
),
686+
toPosition(
687+
getFirstToken(otherItem),
688+
false,
690689
),
691-
toPosition(value.firstToken, false),
692690
),
693-
`\n${indent}`,
691+
' ',
694692
),
695-
...(otherItem // wrap other item up to recursively align using least line possible
696-
? [
697-
TextEdit.replace(
698-
Range.create(
699-
toPosition(
700-
getFirstToken(
701-
otherItem,
702-
).prevToken!,
703-
),
704-
toPosition(
705-
getFirstToken(
706-
otherItem,
707-
),
708-
false,
709-
),
710-
),
711-
' ',
712-
),
713-
]
714-
: []),
715693
]
716-
: [],
694+
: []),
695+
],
717696
codeActionTitle: `Move ...${value.toString()}... to a new line`,
718697
},
719698
toPosition(value.lastToken),

0 commit comments

Comments
 (0)