using idea and longevity together
If you are using IntelliJ IDEA with your longevity project, you will want to install the longevity IDEA plugin. The plugin is available from the JetBrains Plugins Repository, so you can install it just like any other IDEA plugin. Just search for “longevity” under Plugins in the Settings / Preferences Dialog.
Without the plugin, IDEA doesn’t know how to expand the longevity macro annotations, and
consequently shows error messages for primaryKey
and props
in an example like this:
@persistent[DomainModel]
case class User(username: Username, email: Email, fullName: FullName)
object User {
implicit val usernameKey = primaryKey(props.username)
}
The plugin helps IDEA understand what the annotation macro is doing, and makes error messages like this go away.
It seems that JetBrains is wisely skipping full-blown support for Scala macros in favor of supporting Scala.meta. See for example this blog entry. We plan on migrating longevity from Scala macros to Scala meta as soon as possible. But the Scala.meta feature set is not quite developed enough for our needs as of yet. We’re tracking progress on this front in this GitHub issue.