Adding empty line before PsiField

已回答

Hello,

what is the best way to add a blank line before a PsiField?
My class is structured like this:

@Annotation

public static Type FIELD;

No blank line between the annotation and the field, but when adding a new PsiField after the current last one, there is no blank line between them. Making the user change the code style is not an option, since this formatting is only used in specific classes.

Can I somehow add a blank line or change the code style temporarily after adding the new PsiField?

0

Hi Batuhan,

Try creating whitespaces with:

PsiParserFacade.getInstance(project).createWhiteSpaceFromText("\n\n")

and add/insert it between annotation and field.

0

请先登录再写评论。