mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
trim expression text to avoid line breaks
This commit is contained in:
@@ -230,6 +230,10 @@ public class PsiExpressionTrimRenderer extends JavaRecursiveElementWalkingVisito
|
||||
public static String render(PsiExpression expression) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
expression.accept(new PsiExpressionTrimRenderer(buf));
|
||||
return buf.toString();
|
||||
final String text = buf.toString();
|
||||
int firstNewLinePos = text.indexOf('\n');
|
||||
String trimmedText = text.substring(0, firstNewLinePos != -1 ? firstNewLinePos : Math.min(100, text.length()));
|
||||
if (trimmedText.length() != text.length()) trimmedText += " ...";
|
||||
return trimmedText;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user