Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

A library providing automated refactoring support for Scala.

License

NotificationsYou must be signed in to change notification settings

scala-ide/scala-refactoring

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.

Information for Contributors

Help Needed

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!

Overall Architecture

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.

Testing

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

Internals

Parsing Scala Source Code

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.

Tracing

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.

Building

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.

Publishing

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.

License

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

Stars

Watchers

Forks

Packages

No packages published

Contributors23

Languages


[8]ページ先頭

©2009-2025 Movatter.jp