Synchronizing editor/repository after psi changes



My plugin does some code modifications via PSI only (in effect converting from a custom logging solution to log4j).
It more or less works, but there is a little issue:
I call replace() on a PsiMethodCallExpression. After that the file is marked red in the editor, though it still compiles fine.
When loading the project for the next time I get this exception:

2005-02-17 13:32:38,156 ERROR - impl.RepositoryElementsManager - Error synchronizing psi and repository in file: C:\Stephen\idea-sandbox\projects\logtest\src\Baa.java repositoryElementType: FIELD psiParent: PsiClass:Baa
java.lang.ArrayIndexOutOfBoundsException: 0

I guess I am missing something very basic here, like having to call some kind of commmit/update/synchronize method?!

Other changes worked fine, though...

1 comment
Comment actions Permalink

You probably produce wrong PSI structure. Unfortunately our PSI is not
typesafe to guarantee you can't go wrong. Please post the code you use to
modify PSI to see if it is really the source of the problem.

Eugene.

"Stephen Kelvin" <mail@gremlin.info> wrote in message
news:30651922.1108649901725.JavaMail.itn@is.intellij.net...

>

My plugin does some code modifications via PSI only (in effect converting

from a custom logging solution to log4j).

It more or less works, but there is a little issue:
I call replace() on a PsiMethodCallExpression. After that the file is

marked red in the editor, though it still compiles fine.

When loading the project for the next time I get this exception:

>

2005-02-17 13:32:38,156 ERROR - impl.RepositoryElementsManager -

Error synchronizing psi and repository in file:
C:\Stephen\idea-sandbox\projects\logtest\src\Baa.java repositoryElementType:
FIELD psiParent: PsiClass:Baa

java.lang.ArrayIndexOutOfBoundsException: 0

>

I guess I am missing something very basic here, like having to call some

kind of commmit/update/synchronize method?!
>

Other changes worked fine, though...



0

Please sign in to leave a comment.