Cannot perform operation. Too complex, sorry.

Hi,

I have created language support for a custom language. The files written in that language may contain references to Java packages. Creation and handling of those references works fine - including "Go To Declaration" and auto-completion.

As the last missing thing I have created an ElementManipulator for the PsiElement containing the reference. When I now try to rename a package - either in the Project View or directly on the reference, IDEA tells me "Cannot perform operation. Too complex, sorry!"

There is no Exception in the log file and neither is there one on the console. Any hint how to reduce the complexity of this operation would be helpful.

Cheers,
Robert

5 comments

Hello Robert,

does your implementation throw UnsupportedOperationExceptions anywhere? If yes, this could cause such "too complex" error messages. Just a guess...

Sascha

0

I got this exception from something I was trying to do also. Here is my post on what I thought was happening:

http://www.intellij.net/forums/thread.jspa?messageID=5201534??

I think I got it because I was unintentionally requesting what amounted to a refactoring be made to the PSI structure, specifically, a delete of a PSIElement.

I take this to mean that some modifications of PSIElements, while theoretically possible and logically reasonable are nonetheless too computationally complex to be serviced.

Since a graph backs the PSI (somewhere I presume) and perfectly reasonable questions directed at graphs are infamous for producing answers that are BigO polynomial, exponential and even factorial, (for instance, the traveling salesman problem) this seems to be their way of telling you the runtime for your request would not be reasonable. Too complex, sorry!

Message was edited by:
softwarevisualization

0

Thanks Sascha,

That was the cause. I enabled an Exception-breakpoint for UnsupportedOperationException and found out that PsiElementBase.replace(PsiElement) throws such an Exception. I wasn't aware of that. When I made my PsiElement inherit from ASTWrapperPsiElement I was pleased at how few methods I had to implement to make it work, but PsiElementBase has some nasty surprises with a bunch of methods throwing UnsupportedOperationException.
Anyways, thanks, after finding out the cause, it wasn't hard to implement replace() in a way that made the rename refactoring work.

Cheers,
Robert

0

Hi softwarevisualization ,

Fortunately that wasn't the cause here. In my case the message was misleading. I should have made it clear that a necessary method threw an UnsupportedOperationException.

Cheers,
Robert

0

Robert, Sascha,

This misleading catch for UnsupportedOperationException is removed in
IDEA trunk.

0

Please sign in to leave a comment.