in simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFoldingBuilder.java [76:107]
public String getPlaceholderText(@NotNull ASTNode node) {
if (node.getPsi() instanceof PsiLiteralExpression psiLiteralExpression) {
String text = PsiLiteralUtil.getStringLiteralContent(psiLiteralExpression);
if (text == null) {
return null;
}
String key = text.substring(SimpleAnnotator.SIMPLE_PREFIX_STR.length() +
SimpleAnnotator.SIMPLE_SEPARATOR_STR.length());
SimpleProperty simpleProperty = ContainerUtil.getOnlyItem(
SimpleUtil.findProperties(psiLiteralExpression.getProject(), key)
);
if (simpleProperty == null) {
return StringUtil.THREE_DOTS;
}
String propertyValue = simpleProperty.getValue();
// IMPORTANT: keys can come with no values, so a test for null is needed
// IMPORTANT: Convert embedded \n to backslash n, so that the string will look
// like it has LF embedded in it and embedded " to escaped "
if (propertyValue == null) {
return StringUtil.THREE_DOTS;
}
return propertyValue
.replaceAll("\n", "\\n")
.replaceAll("\"", "\\\\\"");
}
return null;
}