Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea Scala files not available in 'New' context menu

I am new to both IntelliJ and Scala. I am attending the course "Functional Programming Principles in Scala" on Coursera. I downloaded the zip file for the sample assignment, which contained a sample Scala project.

I imported the project successfully (I guess) in IntelliJ. However, when I right-click on a package in the project explorer, there are no Scala-related templates. I can only select "New Java class", XML files and some forms.

Does anyone know why this happens and if there is another way to create a new Scala class or object from a template?

Thanks.

like image 470
Zoltán Avatar asked Jun 01 '14 21:06

Zoltán


People also ask

Why Scala class is not showing in IntelliJ?

On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.

How do I enable Scala in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.

How do I add Scala framework support in IntelliJ?

To add Scala support to existing module:Right-click the module in Project View, choose “Add Framework Support…” Check “Scala” in technologies list (unavailable if module has Scala facet attached) Provide a path to Scala installation (if not detected)


1 Answers

Yes, you need to make the scala directory a source directory (in Menu / Project structure / Modules ) but I also had to do the following:

  1. Still in Project Structure goto Global libraries.
  2. Select Scala SDK.
  3. Right click the Scala SDK and Add to module...

Now my context menu gives me New / Scala class and so on.

like image 114
Anders Eriksson Avatar answered Nov 15 '22 19:11

Anders Eriksson