Adding empty line before PsiField

Answered

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
1 comment

Hi Batuhan,

Try creating whitespaces with:

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

and add/insert it between annotation and field.

0

Please sign in to leave a comment.