I have an action in my plugin that gets input from the user and eventually adds annotation (with the user input as the value) to the element under the caret (only if this element is instance of PsiMethod or PsiClass).
I'm doing it this way:
final PsiAnnotation annotationFromText = JavaPsiFacade.getElementFactory(getProject()).createAnnotationFromText(sb.toString(), parent);
It works but it adds one line gap between the annotated method (or class) to the annotation which is a little weird...
Am I doing something wrong? How can i avoid this?