Syntax highlighting for scala.html and routes files in IntelliJ / Play framework - intellij-idea

I am new to both IntelliJ and the Play framework. I noticed that after installing IntelliJ and importing my first Play application, syntax highlighting is not working properly for both *.scala.html files and the routes files. I was able to modify the settings for the *.scala.html files to have them recognized as Scala files, but this isn't actually correct because the scala templating system is not pure Scala.
Here's a screenshot, in case it helps:
In the official Play video tutorials there seems to be a special syntax highlighting setting for these template files, but I don't know how to add this to IntelliJ. Here's a screenshot from this tutorial and how I would like the syntax highlighting to look:
Also, I couldn't find any solution for the routes file. Any help would be most appreciated!"
P.S. I enabled the Vim emulator during installation of IntelliJ. I don't know if this had any effect on the syntax highlighting defaults...

Playframework full support in only available in IntelliJ ultimate edition a commercial one.
Community edition (free version) that you probably are using doesn't have any support for playframework it only supports Scala (language).
Routes and *.scala.html files are part of the framework not the language.
You may like to purchase IntelliJ ultimate edition or would like to go for Scala IDE (based on eclipse) which is an open source IDE for java and scala, it seems to have full support for play 2.x.

For *scala.html syntax highlighting
Preferences > Plugins > Install Jetbrains plugin...
Then install the Scala plugin
Restart IntelliJ and syntax highlighting should work.
For routing file highlighting
Preferences > Editor > File Types
Under the registered patterns for HTML Routing Support For Play 2 Framework if *.routes isn't already there, add it. Or add however you plan on naming your routes files.

Related

How to properly import a Play 2+ project in IntelliJ 14+ with all integrated features (run, debug, test)?

I work on a Java based Play! project for severals months now and I'd like to import it completely in IntelliJ, meaning being able to run, compile, test and debug from IntelliJ, without the need to use the command line.
According to this post from Jetbrain, it seems to be possible, if I quote the article it says clearly : "Now you don’t need to switch between IntelliJ IDEA and Play console anymore. Everything is available right from your favorite IDE.", but I can't figure out a way to achieve this for now, even if I follow the tutorial provided by Jetbrains.
Here are the steps I've been throught :
Open my fav IDE IntelliJ ;)
Go to the project list window.
Import project
Import from external model and choose SBT as suggested in Jetbrains tutorial.
option "Use auto import" checked, option "create directories for empty content roots automatically" checked. Project SDK Java 1.7
Global sbt settings : JVM From project JDK.
Finish
By now, if I try to make the project and launch it from IntelliJ, I'll get scala compiling errors related to routes object. Thanks to this post, we can understand that this happens because scala routes are located to specific folders that needs to be included in IntelliJ sources settings for this project. So next step was :
File -> Project Structure -> Modules
Add target/scala-2.10/classes:target/scala-2.10/resources_managed:target/scala-2.10/src_managed as sources folders.
But my problem remains the same, routes object being unrecognized.
Notes : I have no scala facets in my project structure configuration nor can add one.
IntelliJ provides integrated support for the Play Framework for Scala and Java. Support is currently only available in IntelliJ Ultimate Edition (see the Frameworks and Technology section).
Assuming Ultimate Edition, the setup for Play is incredibly easy. Simply create a new project by importing build.sbt, then choose Add Framework Support and choose Play 2.
Once complete, you can start and stop Play using the Play 2 Run/Debug configuration. No command line necessary.
Here is a more in depth look at IntelliJ's Play project configuration.
You could try the command play idea if you are using play or activator idea if you are using activator. That will do the magic.

Difference between WebStorm and PHPStorm

I'm choosing an IDE for web development and I would like to know what the differences between WebStorm and PHPStorm are.
I couldn't find any major points on JetBrains' website and even Google didn't help that much.
All I know now is that PHPStorm doesn't support JS like WebStorm, but is able to due to plugins. Is this the only difference?
I couldn't find any major points on JetBrains' website and even Google didn't help that much.
You should train your search-fu twice as harder.
FROM: http://www.jetbrains.com/phpstorm/
NOTE: PhpStorm includes all the functionality of WebStorm (HTML/CSS Editor, JavaScript Editor) and adds full-fledged support for PHP and Databases/SQL.
Their forum also has quite few answers for such question.
Basically: PhpStorm = WebStorm + PHP + Database support
WebStorm comes with certain (mainly) JavaScript oriented plugins bundled by default while they need to be installed manually in PhpStorm (if necessary).
At the same time: plugins that require PHP support would not be able to install in WebStorm (for obvious reasons).
P.S.
Since WebStorm has different release cycle than PhpStorm, it can have new JS/CSS/HTML oriented features faster than PhpStorm (it's all about platform builds used).
For example: latest stable PhpStorm is v7.1.4 while WebStorm is already on v8.x. But, PhpStorm v8 will be released in approximately 1 month (accordingly to their road map), which means that stable version of PhpStorm will include some of the features that will only be available in WebStorm v9 (quite few months from now, lets say 2-3-5) -- if using/comparing stable versions ONLY.
UPDATE (2016-12-13):
Since 2016.1 version PhpStorm and WebStorm use the same version/build numbers .. so there is no longer difference between the same versions: functionality present in WebStorm 2016.3 is the same as in PhpStorm 2016.3 (if the same plugins are installed, of course).
Everything that I know atm. is that PHPStorm doesn't support JS part like Webstorm
That's not correct (your wording). Missing "extra" technology in PhpStorm (for example: node, angularjs) does not mean that basic JavaScript support has missing functionality. Any "extras" can be easily installed (or deactivated, if not required).
UPDATE (2016-12-13):
Here is the list of plugins that are bundled with WebStorm 2016.3 but require manual installation in PhpStorm 2016.3 (if you need them, of course):
Cucumber.js
Dart
EditorConfig
EJS
Handelbars/Mustache
Java Server Pages (JSP) Integration
Karma
LiveEdit
Meteor
PhoneGap/Cordova Plugin
Polymer & Web Components
Pug (ex-Jade)
Spy-js
Stylus support
Yeoman
Essentially, PHPStorm = WebStorm + PHP, SQL and more.
BUT (and this is a very important "but") because it is capable of parsing so much more, it quite often fails to parse Node.js dependencies, as they (probably) conflict with some other syntax it is capable of parsing.
The most notable example of that would be Mongoose model definition, where WebStorm easily recognizes mongoose.model method, whereas PHPStorm marks it as unresolved as soon as you connect Node.js plugin.
Surprisingly, it manages to resolve the method if you turn the plugin off, but leave the core modules connected, but then it cannot be used for debugging. And this happens to quite a few methods out there.
All this goes for PHPStorm 8.0.1, maybe in later releases this annoying bug would be fixed.
There is actually a comparison of the two in the official WebStorm FAQ. However, the version history of that page shows it was last updated December 13, so I'm not sure if it's maintained.
This is an extract from the FAQs for reference:
What is WebStorm & PhpStorm?
WebStorm & PhpStorm are IDEs (Integrated Development Environment)
built on top of JetBrains IntelliJ platform and narrowed for web
development.
Which IDE do I need?
PhpStorm is designed to cover all needs of PHP developer including
full JavaScript, CSS and HTML support. WebStorm is for hardcore
JavaScript developers. It includes features PHP developer normally
doesn’t need like Node.JS or JSUnit. However corresponding plugins can
be installed into PhpStorm for free.
How often new vesions (sic) are going to be released?
Preliminarily, WebStorm and PhpStorm major updates will be available
twice in a year. Minor (bugfix) updates are issued periodically as
required.
snip
IntelliJ IDEA vs WebStorm features
IntelliJ IDEA remains JetBrains' flagship product and IntelliJ IDEA
provides full JavaScript support along with all other features of
WebStorm via bundled or downloadable plugins. The only thing missing
is the simplified project setup.
PhpStorm supports all the features of WebStorm but some are not bundled so you might need to install the corresponding plugin for some framework via Settings > Plugins > Install JetBrains Plugin.
Official comment - jetbrains.com
I use IntelliJ Idea, PHPStorm, and WebStorm. I thought WebStorm would be sufficient for PHP coding, but in reality it's great for editing but doesn't feel like it real-time-error-checks PHP as well as PHPStorm. This is just an observation, coming from a regular user of a JetBrains products.
If you're a student try taking advantage of the free license while attending school; it gives you a chance to explore different JetBrains IDE... Did I mention CLion? =]
In my own experience, even though theoretically many JetBrains products share the same functionalities, the new features that get introduced in some apps don't get immediately introduced in the others. In particular, IntelliJ IDEA has a new version once per year, while WebStorm and PHPStorm get 2 to 3 per year I think. Keep that in mind when choosing an IDE. :)

Eclipse plugin for play 2

I am a beginner with Play2 framework and Scala.
Is there any eclipse play 2 plugin available?
If yes, then please provide me the link for the same. I am used to Eclipse and have never used Scala before;hence in a confusion like how and where to start from. Looking at the Play2 Doc, sems like working in command prompt IDE which is very difficult (though I have tried yet)
Please let me know the eclipse plugin for Play2 or some other IDE helpful for this.
Regards,
There in no plugin as such for Eclipse.
Play! framework has nice set of tools for doing tasks such as following
creating new play project
running the project
deployment of the application
doing the continuous testing mode etc
Trust me, once you start using this, you gonna love it.
Beside you do not require any experience in Scala, as for Play framework you can use Java language, if you are comfortable with it (you can choose Java template while creating new Play project )
and also you can use IDE for syntax highlighting , code completion etc
I had a brief try of Play development using Eclipse and the Scala Plugin. I personally found it awkward and not terribly helpful. (The errors which the IDE reported were not always the same as the ones that the Play compiler reported, for example.)
I’ve had a lot more joy using the Intellij IDEA IDE, with its Scala plugin. As with Eclipse the current version of IDEA does not have specific support for Play Framework 2, but it does have specific support for Scala.
The next version of Intellij IDEA, v12, will have explicit support for Play Framework 2: http://www.jetbrains.com/idea/nextversion/index.html#Frameworks_Support (but only in the paid-for ‘Ultimate’ edition, not in the free ‘Community’ edition).

Is there an eclipse plugin for Play2?

I know there is one for play1, but I don't find any for play2.
I hope the plugin can compile the templates to scala code automatically. It's not convenient now.
I just came across Scala IDE Play2 plugin for Eclipse Indigo/Juno and Scala IDE. The current features are
Syntax Highlighting (routes and templates)
Code completion (templates)
Formatter (routes)
Hyperlinking (routes and templates)
Note that hyperlinking to Java files is not supported for now. Also there are some limitations for the code completion feature, just take some time to read the doc. I didn't try it myself as I'm not working with Play2 right now, but thought it might be helpful for someone.
Edit: This answer is outdated. A Play Eclipse plugin has been written, as #Baztoune says.
There is no Play 2 plugin for Eclipse at the time I’m writing these lines. However, there is an eclipsify sbt command, provided by the Play 2 sbt plugin, which is able to generate an Eclipse project from a Play 2 application.
You won’t get syntax highlighting, contextual completion or code navigation inside Play 2 templates, but you can have them to be automatically compiled when saved by using the ~run sbt command (instead of just run). Check the Eclipse “General −> Workspace −> Refresh using native hooks or polling” option is enabled so it will take compiled templates changes into account.
Yes, here's how to get started:
Find the correct update site for your version of Eclipse from http://scala-ide.org/download/current.html.
In Eclipse go to Help->Install New Software. Use the update site from above to locate Scala related plugins.
Install both the Scala IDE for Eclipse plugin and the Play2 support in Scala IDE plugin. Note that the Play2 support in Scala IDE plugin is listed under the Scala IDE plugins checkbox.
I was unable to get this working at all starting from bare Eclipse, as many sources have suggested doing. The problem seems to be incompatible dependencies that only show up after much wasted time. The Scala IDE route eliminated this problem.
Yes. That's Scala IDE.
Update Site for Eclipse Juno and Kepler: http://download.scala-ide.org/sdk/e38/scala210/stable/site
Install with the following features:
Scala IDE for Eclipse
Scala IDE Plugins (incubation)
I use Scala IDE from http://scala-ide.org/ , then eclipsify my play2 project and import.
It works like a charm: it compiles my scala/java code.
You can get more details at this URL http://scala-ide.org/docs/tutorials/play20scalaide20/index.html

Getting auto-completion to work in an IDE using Coffeescript and external Javascript libraries such as jQuery

I would like to ask how other more experienced Coffeescript developers are using their respective IDE's or editors with auto-complete when developing modular libraries and / or referencing external Javascript libraries (jQuery, jQuery UI, RequireJS, Handlebars, ...).
As much as I've tried various IDE's and plug-ins for Coffeescript, none of these seem to support auto-completion when the project consists of several script files. For example: in Visual Studio I can add a commented directive such as /// <reference path="/js/jquery.js" />. I'd need something similar for Coffeescript.
I have tried following without success:
Visual Studio with Web Workbench by Mindscape
Netbeans with dstepanov's Coffeescript plug-in
Aptana with the Coffeescript ruble
Further, I am aware of Jetbrain's WebStorm 3.x support for Coffeescript, unfortunately, my evaluation period expired before I realized I'd need this feature - can anyone confirm that setting the Javascript / Coffeescript Usage Scope works as expected with auto-complete?
So effectively what I am asking: is there an IDE or plug-in, commercial or otherwise, enabling auto-complete for Coffeescript libraries spanning multiple files?
Hate to answer my own question, but after giving JetBrains WebStorm 3.0.2 another demo run on another box, I figured it worked best and does have 'smarter than average' auto-complete for coffeescript projects. It simply loads all coffeescript files in to a global auto-complete context and you can add external libs (cs or js) as well using the project's scope settings. Could be better, but for now I cannot find any other IDE or tool running on PC or Linux, OSS or paid, that tops WebStorm and I don't have the fortunes to explore OSX alleys.
I am sure future tools, plugins, IDE's will pop up for various platforms that do offer great coffeescript module management and proper contextual auto-completion in the editor. So please, do keep the suggestions coming.
Thanks!
I personnaly use Kdevelop. I can't remember if I installed a plugins or something to get it work with coffeescript.
But it works very well, the highlighting colors are pretty, when ctrl+d it add coffeescript commentary and so on.
Also I do make compilation directly in KDevleop.
Well also it's free, I am using it on linux debian but I think it works on most platforms.
Check it there : http://kdevelop.org/