how to change content for PsiDocTag
Hi I have a method like this one, and I want to modify the content for the @should tag.
/**
* @should zas
*/
void b() {
}
It becomes
/**
* @should new content
*/
void b() {
}
How could I get this? I'm trying something like but it isn't very user pleasnt because it disorders tags.
PsiDocTag newVerifiesDocTag = JavaPsiFacade.getElementFactory(tag.getProject()).createDocTagFromText("@" + tag.getName() + " " + newContents);
PsiDocComment containingComment = tag.getContainingComment();
containingComment.deleteChildRange(tag, tag);
containingComment.add(newVerifiesDocTag);
Please sign in to leave a comment.
Hello Jaime,
Try the replace() method instead of deleteChildRange() and add()?
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"