Best way to modify PsiElement text

Hi,

I have a JavaScript string literal PsiElement. I want to modify the text somehow. I guess either by creating a new PsiElement and replacing the old one or somehow modifying it in-place.

What is the best way to either modify it or create a new PsiElement to replace with?

1 comment
Comment actions Permalink

Every PsiElement has a replace(PsiElement) method which you can use to replace it with another. Note: the return value of replace(PsiElement) is the *inserted* element. Make sure you use that if you want to make more modifications.

0

Please sign in to leave a comment.