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
请先登录再写评论。
Hi Dave,
Could you please verify and solve this problem? Attached you'll find my
config file.
--
Thanks in advance,
Tom
请先登录再写评论。
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
Psi structure should be updated by request like PsiDocumentManager.commitAllDocuments().
-
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"
So every plug-in, which uses the PSI-structure, should invoke
PsiDocumentManager.commitAllDocuments()?
Tom
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().
>>
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
I forgot the most important words before the question mark: "before doing
anything PSI-related".
Tom
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
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
OK, good! In that case, I'll wait for a new EAP build before I start worrying. :)
-Dave