Scala Worksheet: instant evaluation

Posted on by Alexander Podkhalyuzin

More than year ago we implemented first version of Scala Worksheet. It had convenient interface, but it was possible to make coffee, while worksheet would finish evaluation, so it was almost unusable.

Now, in Scala plugin of versions 0.30.383 and 0.32.550, Scala Worksheet supports almost instant evaluation (don’t forget to use Ctrl + Alt + W shortcut):

http://www.youtube.com/watch?v=ZyV54GSAqkI

Additionally your evaluation results will be saved even on the IDE restart until you will clean it or re-evaluate.

We are also planning to add highlighting for the output, so any suggestion are welcome as it’s not obvious how to do it.

Enjoy!

Comments below can no longer be edited.

29 Responses to Scala Worksheet: instant evaluation

  1. Marius-Andrei Danila says:

    February 17, 2014

    Hello,

    Great to see that worksheets are properly supported in Intellij. However, I cannot manage to make it work.

    I have created a SBT project, then a new worksheet. After inserting some code and pressing “Evaluate worksheet” nothing happens. Syntax & error highlighting work fine, but no results appear in the right panel.

    I am doing something wrong?

    • Alexander Podkhalyuzin says:

      February 17, 2014

      Do you use compile server?

      Right now if you disable compile server, progress bar will not work for worksheet running.

      Best regards,
      Alexander Podkhalyuzin.

      • Marius-Andrei Danila says:

        February 17, 2014

        Thanks for the quick response.

        I have disabled “Run compile server (in external build mode)”, but the behavior is the same. It appears to process things for just a little bit, but no results are shown

        • Alexander Podkhalyuzin says:

          February 19, 2014

          This problem was fixed in 0.30.385 and 0.32.558. Sorry for inconveniences

      • Adam Warski says:

        February 17, 2014

        Same for me, I have compile server enabled, but when I press evaluate, for a short time I can see in the bottom status bar “Worksheet test.sc compilation” and nothing else happens (no results).

        I’m using the latest OSX, Idea 13.0.2 on JDK 1.6.0_35

        • Alexander Podkhalyuzin says:

          February 17, 2014

          Did previous version of Worksheet work for you?

        • Alexander Podkhalyuzin says:

          February 19, 2014

          This problem was Linux specific and fixed in 0.30.385 and 0.32.558. Sorry for inconveniences.

  2. Heiko says:

    February 17, 2014

    It has become so fast, you even can’t see the results 😉

    I’m on OS X, Idea 13.0.2, Java 7. The previous plugin worked (slowly), now evaluation doesn’t take place or at least doesn’t show up.

    • Pavel Fatin says:

      February 17, 2014

      We’re going to look into this. Here’s a corresponding issue in YouTrack (to monitor the progress).

    • Alexander Podkhalyuzin says:

      February 19, 2014

      This problem was Linux specific and fixed in 0.30.385 and 0.32.558. Sorry for inconveniences.

  3. Anil says:

    February 17, 2014

    I have Idea 13.0.2, Java 7. After pressing compile.. compile result doesn’t show up. Please fix.

  4. Richard says:

    February 17, 2014

    Same here. I am on Windows 7, Idea 13.0.2, Java 7 and 30.383 does not work. I went back to 29.464 and it is working again.

    • Alexander Podkhalyuzin says:

      February 19, 2014

      This problem was fixed in 0.30.385 and 0.32.558. Sorry for inconveniences.

  5. Igor Kolomiets says:

    February 17, 2014

    Ура! Наконец. Спасибо.

  6. Alex says:

    February 18, 2014

    Scala worksheet works really faster with scala plugin v0.30.383 (project jdk 1.6.0_45, bundled idea jre 1.7) but IDEA scala compiler fails with the same error as already submitted here: http://youtrack.jetbrains.com/issue/SCL-6687

    • Alex says:

      February 18, 2014

      But it works if ‘Run compile server (in external build mode)’ is unchecked.
      IDEA CE 13.0.2

      • Alex says:

        February 19, 2014

        …and it works with compile server enabled with compile server jdk 1.7.0_51

  7. Max says:

    February 21, 2014

    Can you explain me why the scala worksheet has a different behavior to the scala ide?

  8. Paul says:

    March 24, 2014

    I have the same issue.

    How can I install newer version of plugin via intelliJ plugin downloads ? Scala plugin version available is 0.26.361 right now. And if I try to load the plugin from the disk, I get an error (incompitable to current version error)

  9. Angel says:

    May 15, 2014

    I have just used it and if I have a worksheet that contains a lot of code that does not generate any output, the editor won’t allow me to scroll down and see my code.

  10. BIBHASH ROY says:

    November 22, 2015

    Few days ago, my scala worksheet used to be interactive – meaning, on writing a line of code, it will automatically compile and the results used to be printed on the right pane. Now this is no more happening and I have to click the green button for evaluating the worksheet – why this is happening?

    • Dmitry Naydanov says:

      November 27, 2015

      Hello,

      Do you use the same worksheet as few days before, with ‘Interactive mode’ setting checked? Also, do you use compiler server? Do you have other problems with compilation?

      Best regards,
      Dmitry Naydanov

      • Bibhash Roy says:

        November 27, 2015

        How to set Scala worksheet to interactive mode – do I need to configure settings? If yes, please let me know how to do it. I do not understand it how the behavior got changed – now I have to press the green (“evaluate worksheet”) button always to execute code and get results.

  11. Misha says:

    August 21, 2016

    Hello there,

    I am able to see instant evaluation when I include my code in a singleton object.
    However, when I include the object inside a package like so:

    package ABC {

    object BLAH {
    ….
    }

    }

    then I no longer see anything evaluated on the right hand side of my Scala Worksheet.
    I am new to Scala, so I’m not sure what I am doing wrong…

    Thanks in advance!

    • Craig says:

      September 2, 2016

      I’m having the same problem. I’ve previously been using Eclipse, but wanted to try IntelliJ for a course I’m doing (it’s used in part of the course). But since it doesn’t currently work, back to Eclipse.

  12. Alex Tah says:

    November 6, 2016

    is it possible to get the evaluated output to be placed right in the code window, and next to the relevant line of code (as in Eclipse), rather than a separate tab to the right?

  13. Alexander Podkhalyuzin says:

    November 9, 2016

    The main idea behind separate tab is not to change user file at all. If you have any problems with tab synchronization or something else, please report it in our issue tracker. IntelliJ IDEA also recently supported inline hints (with no file change), so probably we will reuse this functionality for worksheets when it will support multiline hints.