Cherish your packages

After the introduction of chained package clauses in Scala 2.8 we have the ability to rewrite “package foo.bar” as “package foo; package bar” in order to automatically import all “foo” package entities (so, these two declarations are not equivalent).

Scala plugin used to flatten packagings structure on moving or copying classes, but now there’s a better algorithm, that preserves desired package chaining. Let’s consider the following example:

If we move that class to “foo.other.name” package we will get the following:

In addition to explicit package chaining we can specify a base package in a module facet:

After that, all packages that start with the base prefix will be chained automatically.

Moreover, there’s a warning about the lack of chaining at the base level:

We can use a build-in “quick fix” to split that declaration automatically:

We can also split and join such lines using Smart Enter (Ctrl + Shift + Enter) and Join Lines (Ctrl + Shift + J) actions. Here’s how it works:

After Ctrl + Shift + Enter we will get:

Then we may join the packages again with Ctrl + Shift + J:

P.S. Thanks to Jason Zaugg for some of these features

About Pavel Fatin

Programming enthusiast, technology advocate. IntelliJ Scala plugin developer at JetBrains, https://pavelfatin.com
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Cherish your packages

  1. We invite everyone to join us at our vape fair in Texas on 27 April 2017. Whether you are an artisan e-liquid brand name wanting to promote your e-juice line, a vaper who wishes to taste some exceptional gourmet e-juices and mingle with like-minded vapers or a e-cig shop planning to stock unique vaping products, this vape show is superb for you. At Vapor Dynasty Exhibition in Texas, we will be bringing all the main players in the vape marketplace covering all of USA and from abroad. Our spaces are going pretty fast. To reserve your place at this amazing vape show in Texas, simply follow this web link: http://tx.vapordynastyexpo.com/exhibit/ We look forward to welcoming you! We present some of our exhibitors below: Founding Fathers Liquid, Big Top Ejuice, MissDemeanor Elixirs, KING’S CROWN , STRAIGHT OUTTA E-JUICE, Red Rooster, Stache ride, Vapor Villa, Milkshake Liquids,Proper, Slam Cake Vapes, Ace of Vapes, Smoke N Mist

Leave a Reply

Your email address will not be published. Required fields are marked *