Replacing of PsiFile
Hello,
I'm working on alternative formatter and often I need to replace some of PsiElements by new ones created from text.
I do it by replace() method of PsiElement.
But I have faced a problem in case of PsiFile. My plugin fails in SharedImplUtil.doReplace() by assert LOG.assertTrue(treeParent != null).
What do I do wrong?
With what name do I need create new PsiFile to replace old one? With the same?
Anton
Please sign in to leave a comment.
Replacing an entire PsiFile is not an operation that was considered meanigful when designing our PSI API. Why don't you modify the document text instead?
Thank you!