Refactoring code

Is refactoring going to implemented soon that works - such as rename package. Move class.

I had to move a primitive type class from one package to another, this involved a changes to 120 files.

I mainly had to fix this by hand and/or global replace for the imports. In old java this would have been one key shortcut.

It's getting quite painful.

Thanks
Graham

21 comments
Comment actions Permalink

I hope mostly painful was http://youtrack.jetbrains.com/issue/SCL-4613, which will be fixed in next plugin version (which I'll upload in 3-4 hours to plugin manager).

I'll go though all "move" issues in tracker, then we will be able to talk about is it usable or not (I hope it will be).

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

That would be a great help to our project !

Will try a move after updating the plugin and get back to you.

Thanks
Graham

0
Comment actions Permalink

Current issues.

1) Single import statement of moved item was not corrected. Was in the original package

I had

package x.y with classes A,B,C & x.y.z. with E,G and moved A, the file not corrected was E

2) Import with ._ for all items did not have a new import created for moved item

3) If I move A and had import of x.y.{A,B,C} the import is left as x.y.{B,C} and a new import for A is not created.
Occasionally saw the import left unchanged as x.y.{A,B,C}

A lot of the files were correctly changed, thanks.
Graham

0
Comment actions Permalink

I wasn't able to reproduce your problems, I probably need more complete examples.
Work for "Move" is still in progress, I think you can create new issues for it to our tracker after I consider "Move" more or less usable.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

I'll try and create some samples and put them in github.

0
Comment actions Permalink

It's better to use our main issue repository: http://youtrack.jetbrains.com/issues/SCL

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

You can check in complete projects to show the error ?

0
Comment actions Permalink

Yes I can, however possible problems was some general exception on objects and traits moving (in case of moving whole file with few classes), which wasn't fixed in 0.6.287. I'd suggest you to wait for 0.6.291, which will be available soon, and to try again, it seems it should help in your described three issues.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Still giving numerous issues after a move.

Will produce some testcase projects and get back to you.

Thanks

0
Comment actions Permalink

Sorry for the delay, struggling to reproduce it myself.

Happens on my large work project.
But trying to narrow down.

0
Comment actions Permalink

Though attempting a rename on a mac with plugin         0.6.320     gives

Error during dispatching of java.awt.event.KeyEvent[KEY_PRESSED,keyCode=117,keyText=F6,keyChar=Undefined keyChar,modifiers=⇧,extModifiers=⇧,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0] on frame1: Expected: class com.intellij.refactoring.rename.RenamePsiElementProcessor; Actual: class org.jetbrains.plugins.clojure.refactoring.rename.RenameClojureFileProcessor
java.lang.AssertionError: Expected: class com.intellij.refactoring.rename.RenamePsiElementProcessor; Actual: class org.jetbrains.plugins.clojure.refactoring.rename.RenameClojureFileProcessor
 at com.intellij.openapi.extensions.impl.ExtensionPointImpl.assertClass(ExtensionPointImpl.java:393)
 at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:231)
 at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:174)
 at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:105)
 at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:92)
 at com.intellij.refactoring.rename.RenamePsiElementProcessor.forElement(RenamePsiElementProcessor.java:110)
 at com.intellij.refactoring.rename.PsiElementRenameHandler.renameabilityStatus(PsiElementRenameHandler.java:112)
 at com.intellij.refactoring.rename.PsiElementRenameHandler.canRename(PsiElementRenameHandler.java:99)
 at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:80)
 at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:61)
 at com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:89)
 at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:561)
 at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:609)
 at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:464)
 at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:208)
 at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:479)
 at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:333)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

0
Comment actions Permalink

Rename was a conflict with the La clojure, not sure why it was being invoked.

0
Comment actions Permalink

Clojure rename will be fixed before IDEA 12 release. Before it you should disable "La Clojure" plugin to have rename working.

Best regards,
Alexander Podkhlayuzin.

0
Comment actions Permalink

Hi, as you have probably seen I've managed to isolate testcase for the issues we have. I believe this would cover all our problems.

They are

SCL-4975Rename refactor
SCL-4972Move refactor issue
SCL-4973Move refactor issue - import with {}

If these were fixed it would save our teams hours per week.

Thanks
Graham

0
Comment actions Permalink

Should I change these severity of these to Major - for us they are an enourmous issue.

For others I can imagine they wouldn't be.

0
Comment actions Permalink

I marked them to fix before IDEA 12 release (5 December). You shouldn't change severity for the issue (and I hope you can't do it).

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Hi, I see the bugs are fixed, thanks !

Will the be available in the next nightly post 0.6.340 ?

Thanks
Graham

0
Comment actions Permalink

We have some problems with build, so it will be available in next nightly build after we resolve these problems.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Yeah they have fixed our refactoring issues. Will be a great help !

Thanks
Graham

0
Comment actions Permalink

Thank you for information and bugreports.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.