Showing posts with label code editor. Show all posts
Showing posts with label code editor. Show all posts

Tuesday, June 03, 2014

Proper build.sbt Settings for Play 2.2 and IntelliJ

I came across a bug today that cause IntelliJ 13.1 to act strangely when passing Java objects to Scala templates.










For example the snippet:
public static Result login() {
 ok(login.render(Form.form(Login.class)));
}

will compile and run, but IntelliJ will flag it as an error because it says that it found a play.data.Form object when the Scala template was expecting a play.api.data.Form object. Now that's just the tip of the iceberg, I even found that in some cases my routes (for redirects within the controller) were flagged as unresolvable objects.

Fear not, for the solution is simple. Your build.sbt file will look like this when Play generates the project:
name := "testapp"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache
)  

play.Project.playJavaSettings

Simply change it as follows:

import play.Project._

name := "testapp2"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache
)     

playJavaSettings

Run the following commands:
play clean
play compile

And voila! Those nasty red squiggly lines are gone.

Bug notes


This bug was present in the following software and their versions:

IntelliJ IDEA version: 13.1 IU-135.475
Play Framework version: 2.2.1 - 2.2.3
Play 2.0 plugin version: 0.33.404
Scala plugin version: 0.33.403

Friday, July 29, 2011

Venturing Into Vim

So I heard that there's this new code editor out, and it's been out for about three decades now... so I guess when I say new I mean new to me.

As an aspiring Ruby on Rails developer, I looked around to see what was the best code editor I can/should use for handling the development of a RoR web application. The vote went almost unanimously to Vim - a minimalist as (according to its veterans) extremely powerful code editor.

So this week I took a journey into Vim land to see what all the buzz was about and boy was it a rough one. Vim is not Notepad++, Komodo Edit or any other code editor that you've used before, and that's a key concept to remember when learning to use Vim, because operating as you did in your previous editors will send you into a mad swirling fit of rage and confusion.

Vim is it's own beast. The fact that you have to press a key before entering text and press another key when you've finished entering text should tell you a lot.

After a week of use, though, I must say that I chose wisely in the investment of my time and I would like to encourage my fellow coders to do the same. Get in the know with this great (yet sometimes frustrating) piece of software; it's powerful, simple and fast.

There isn't an opinion of Vim that wasn't stated by Jeffrey Way over at his blog, so I'll leave it up to you do some further reading.


Happy Vimming!