- Notifications
You must be signed in to change notification settings - Fork46
A library providing automated refactoring support for Scala.
License
scala-ide/scala-refactoring
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Scala Refactoring Library implements IDE independent refactoring supportfor Scala. It is currently used by bothENSIMEandScalaIDE and supports Scala-2.10 and Scala-2.11.
We are always looking for helping hands. As you may have already found out,there are quite a few bugs to work on. Pull requests are usually reviewed andmerged quickly, and we try to help new contributors wherever we can. We arecurrently focusing our efforts on
- Rename
- Organize Imports
- Add Import
- Move Class
All other refactorings, like
- Extract Method
- Extract Value
- Extract Trait
- Inline Local
- Merge Parameter Lists
- Split Parameter Lists
- Change Parameter Order
are effectively unmaintained. If you are particularly fond of an operation fromthis list, this might be a very good place to start contributing!
Refactorings are implemented on top ofASTsfrom the Scala Presentation Compiler. If you plan to work on the library, youshould definitely take a look atMirko Stockers Master Theses.Although somewhat outdated, this document is very helpful forunderstanding the inner workings of the library. Another thing to look at isthepresentation about the Refactoring Library givenby@mlangc atScalaSphere. The slides are availablehere.
All changes to the library are expected to be thoroughly covered by unit tests,unless there is a very good reason for violating this rule. Often however, youalso want to see the effect of your changes in an interactive environment. Ifyou are usingScalaIDE Nightly Builds, thereare two ways to run the IDE with your custom modifications, both with theirown drawbacks and advantages:
You can run ScalaIDE from within Eclipse, as outlinedhere.TheEquinox Weaving Launcherwill automatically pick up the local version of the Refactoring Library, ifthe library is properly configured as an Eclipse project.
Advantages:
- Fast turnaround
- Works even if your changes break binary compatibility
- The only option if the IDE and the Refactoring Library are modified together
Disadvantages:
- Not suitable if you want to see the effect of your changes in a production environment
You can patch yourScalaIDE Nightly installationwith a local build of the refactoring library, generated with
$ sbt package
. Take a look atpatch-ide.bash to seehow this is done.Advantages:
- Perfect for testing the effects of your changes in a production environment
Disadvantages:
- Slow turnaround
- Works only if binary compatibility is maintained
- Might break your Eclipse installation if you aren't careful
Unfortunately the typechecked ASTs the library gets from the Scala PresentationCompiler don't always provide enough information to properly performrefactorings. In these cases the library has to extract the missing informationfrom the source code under consideration. Often this is more tricky than youmight initially think. Using the APIs centered aroundSourceWithMarkershould make your life a lot easier in these cases.
Make sure toswitch to DebugTracingwhen debugging the library. Sometimes it is useful to redirect tracing outputto a file. This can be done by setting the system propertyscala.refactoring.traceFile
.
Use$ sbt package
to build the library for Scala-2.11, or$ sbt +package
tobuild it both for Scala-2.11 and Scala-2.10.
In order to publish sbt is used. The project is cross compiled against Scala 2.10and 2.11. To test a release run sbt and type:
> + publishLocalSigned
If everything looks good the release can be uploaded:
> + publishSigned
For the upload the file~/.m2/credentials
is needed. It should contain:
realm=Sonatype Nexus Repository Managerhost=oss.sonatype.orguser=USERNAMEpassword=PASSWORD
whereUSERNAME
andPASSWORD
are the ones from the Sonatype account, which has thenecessary permissions to do a publish.
The project is licensed under the Scala license, see the LICENSE file for details.
About
A library providing automated refactoring support for Scala.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.