Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize imports #46

Merged
merged 2 commits into from
Jan 28, 2017
Merged

Organize imports #46

merged 2 commits into from
Jan 28, 2017

Commits on Jan 27, 2017

  1. Organize imports with new patch system.

    Main changes:
    
    - Patch(from, to, replace) replaced with TokenPatch(token, newToken)
      with helpful combinators such as Add{Left,Right}
    - New high-level TreePatch datatype with can be converted to TokenPatch.
    - Implemented two tree patches, AddGlobalImport and RemoveGlobalImport.
    - Implemented OrganizeImport, which is a prerequisite to use import tree
      patches.
    - OrganizeImports
      - orders imports by configurable groups
      - removes unused imports using scalac -Ywarn-unused-import
        infrastructure. The implementation is requires hijacking a few
        private fields in g.analyzer using evil reflection hackery.
      - option to expand relative imports
      - handles renames
      - configurable "always used" to force keeping an import such as
        acyclic.file
    
    Known bugs:
    
    - introduces false import on non-existing cats.data.UUID in circe
    - makes an import unused by expanding relative imports to
      fully-qualified imports, requiring you to run scalafix
      twice to fully remove unused imports (e.g. in cats with
      -Ywarn-unused-import)
    - crashes on scala.meta parser bug (in akka), not scalafix problem
      really.
    
    Expand relative
    
    Test that patch is unchanged
    olafurpg committed Jan 27, 2017
    Configuration menu
    Copy the full SHA
    89fa904 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2017

  1. Clean up, refactor

    olafurpg committed Jan 28, 2017
    Configuration menu
    Copy the full SHA
    8aad921 View commit details
    Browse the repository at this point in the history