Skip to content

Commit 87f1e1d

Browse files
committed
text
1 parent c618730 commit 87f1e1d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

palantir-java-format/src/main/java/com/palantir/javaformat/doc/Token.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public void add(DocBuilder builder) {
108108
@Override
109109
protected float computeWidth() {
110110
if (token.getTok().getOriginalText().startsWith(StringWrapper.TEXT_BLOCK_DELIMITER)) {
111-
// hack hack hack to not consider the size of the textBlock such that we won't break
111+
// Palantir-specific: The size of a text block should not impact line length. This ensures that methods
112+
// applied to text blocks remain on the same line and are not split into multiple lines.
112113
return StringWrapper.TEXT_BLOCK_DELIMITER.length();
113114
}
114115
return token.getTok().length();
@@ -129,7 +130,8 @@ public State computeBreaks(
129130
CommentsHelper commentsHelper, int maxWidth, State state, Obs.ExplorationNode observationNode) {
130131
String text = token.getTok().getOriginalText();
131132
if (token.getTok().getOriginalText().startsWith(StringWrapper.TEXT_BLOCK_DELIMITER)) {
132-
// hack hack hack to not consider the size of the textBlock such that we won't break
133+
// Palantir-specific: The size of a text block should not impact line length. This ensures that methods
134+
// applied to text blocks remain on the same line and are not split into multiple lines.
133135
return state.withColumn(state.column() + StringWrapper.TEXT_BLOCK_DELIMITER.length());
134136
}
135137
return state.withColumn(state.column() + text.length());

palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,6 @@ public Void visitLiteral(LiteralTree node, Void unused) {
16381638
token("-");
16391639
sourceForNode = sourceForNode.substring(1).trim();
16401640
}
1641-
16421641
token(sourceForNode);
16431642
return null;
16441643
}

0 commit comments

Comments
 (0)