Rearranger bug: keeps/doubles method separator comments

Hi Dave,

Could you please verify and solve this problem? Attached you'll find my
config file.

--
Thanks in advance,
Tom



Attachment(s):
rearranger.xml
9 comments
Comment actions Permalink

It might be possible, that it is IDEA's fault. Sometimes Rearranger
doubles the comments, sometimes not. But I have detected with my plug-ins,
that IDEA only seems to update the PSI-structure, when the file is safed,
not when it is modified. I've added issue IDEA-1410.

Tom

0
Comment actions Permalink

Psi structure should be updated by request like PsiDocumentManager.commitAllDocuments().

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

It might be possible, that it is IDEA's fault. Sometimes Rearranger
doubles the comments, sometimes not. But I have detected with my
plug-ins, that IDEA only seems to update the PSI-structure, when the
file is safed, not when it is modified. I've added issue IDEA-1410.

Tom



0
Comment actions Permalink

Psi structure should be updated by request like
PsiDocumentManager.commitAllDocuments().


So every plug-in, which uses the PSI-structure, should invoke
PsiDocumentManager.commitAllDocuments()?

Tom

0
Comment actions Permalink

Quite right.
This is mentioned in initial PSI documentation at http://www.intellij.org/twiki/bin/view/Main/PsiIntroduction

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

>> Psi structure should be updated by request like
>> PsiDocumentManager.commitAllDocuments().
>>

So every plug-in, which uses the PSI-structure, should invoke
PsiDocumentManager.commitAllDocuments()?

Tom



0
Comment actions Permalink

If I remember correctly
If Document changed as text commit required(commit regenerates PSI for document) if changes made using PSI it's not required.

Am I wrong?

TIA,
Dmitry

0
Comment actions Permalink

So every plug-in, which uses the PSI-structure, should invoke
PsiDocumentManager.commitAllDocuments()?


I forgot the most important words before the question mark: "before doing
anything PSI-related".

Tom

0
Comment actions Permalink

Hi Tom,

Your configuration file shows that there is no global comment pattern specified. This means that Rearranger will search for all comments that match the current Comment rules, remove those from the source, then do the rearrangement and regenerate comments.

In my experience, duplicated comments occur when a comment rule is changed and no global comment pattern was specified. The old comment does not match the new comment rule, so is not detected as a comment, and therefore not removed.

If you are changing your comment rules but want to remove the old comments, first generate a global comment pattern (there's a button to do it automatically for you). Then, change the rule, and rearrange. You can delete the global comment any time thereafter.

If this doesn't sound like your problem, I'll need some source code to operate on, in order to see which comments aren't being found (i.e. which ones are being duplicated).

I'm not sure what the rest of this thread was all about, but I am committing documents as the plugin rules said.
-Dave

0
Comment actions Permalink

Dave, thanks for your feed-back. I did not change anything in my Rearranger
options. The curious thing was, that the first invocation created the
doubled separator comments, the second invocation removed them (like it
should be). As mentioned in this thread, I'm sure, this is an IDEA problem,
because my own plug-in also show strange effects with builds 3290/3296. The
PSI-structure does not seem to be updated correctly, e.g. after removing a
redundant variable declaration.

Tom

0
Comment actions Permalink

OK, good! In that case, I'll wait for a new EAP build before I start worrying. :)

-Dave

0

Please sign in to leave a comment.