1. Tony Sloane
  2. ScalaWorksheet
  3. Issues


Issue #5 open

ScalaWorkSheet doesn't work on Windows

created an issue

Using SublimeText3

Tried Windows 8 and 7 with same result.

Open a scala file temp2.scala. Type Alt-u to run show_scala_worksheet. I get the scala prompt. Now when I save the scala file I get

Error:MoveFileEx(D:\ws.subl29.tmp,D:\ws\temp2.scala) failed, Access is denied

Note: On the command shell I can run scala file.scala and it works fine. Note: I have permissions to create directories and files

Comments (12)

  1. Tony Sloane repo owner

    Thanks for the report. We are Mac users here so it's possible that no-one has been using the plugin on Windows. I will try to find some time to set up ST3 on Windows and try it myself.

  2. Tony Sloane repo owner

    I am able to reproduce this problem. It is due to the fact that the plugin runs the Scala REPL using a command of the form

    scala < file.scala

    where file.scala is the file that contains your code.

    On OS X and other Unix systems this command causes the REPL to evaluate the code in file.scala as if you had typed it interactively.

    Unfortunately, on Windows the 'scala' command runs, but none of the input from the file is passed to the REPL process. Hence the REPL just sits there waiting for input.

    I believe that the error you are seeing is a follow-on from the fact that nothing actually gets executed. At least we need to fix that problem, before we can see if there is a file problem too.

    I'm investigating a fix. It may well be a limitation of the 'scala' command on Windows.

  3. babusri reporter

    Yes. Actually I should have mentioned that. Though the REPL prompt shows up, nothing happens when you type some expressions like 2+2. But the error message was about error moving a file and I was wondering why a file move was happening.

  4. Tony Sloane repo owner

    The reason for the file error is still not clear to me. The plugin doesn't actually move files around.

    I definitely would not expect the REPL prompt window to let you enter expressions and evaluate them. It's not intended for that. It just shows the output of the REPL, but doesn't allow input to be sent to the REPL.

    Nevertheless, the main issue is that on Windows the code is never actually sent to the REPL for evaluation. It seems to be a bug with the way input is handled either by the scala batch script or the REPL itself. Still investigating...

  5. babusri reporter

    Tony, I found another plugin called sublime-worksheet and when I tried it I got the same error. I reported it and was told to try after turning atomic_save off. I did and that plugin worked fine. Then I tried your plugin and I don't get that error anymore. But it doesn't work. I just see the repl-prompt. When I keep entering alt-w I get a dialog which says "Scala Worksheet error: Newline needed at end of file"


  6. Tony Sloane repo owner

    Yep, it does seem that the atomic_save issue is your MoveFile problem. I will see if the Scala Worksheet can do anything about that but at least you have a workaround.

    Regarding just seeing the REPL prompt, that doesn't surprise me. The main issue described above has not been fixed so the REPL sees no input from your file, hence it is just waiting for interactive input which it can never receive since it's running in the background. We have made some progress on this issue. It appears to be a bug in the JLine library that is used by the Scala REPL. I'll post here when I have more news.

    The "Newline needed at end of file" error is a condition that the worksheet imposes, otherwise the last line of the input cannot be processed by the REPL. Just make sure that there is complete line at the end.

  7. Tony Sloane repo owner

    Some progress is being made... It seems that setting


    causes JLine to use a console that does see redirected standard input. I've put that change in the plugin. That should mean that the plugin will work on Windows.

    However, it doesn't work still, because the Scala version of JLine doesn't honour this property properly (https://issues.scala-lang.org/browse/SI-7061). We will need to wait until that is fixed or backported to Scala 2.10. There doesn't appear to be a work-around.

  8. Tony Sloane repo owner

    Scala 2.11 now uses a version of JLine that is compatible with this worksheet plugin. I have tested this with 2.11.0-M5.

    For now 2.10 will still not work, but I will investigate whether it is feasible to backport the JLine version change to 2.10.x and then get that accepted by the Scala folks.

    In the meantime please use 2.11.

  9. Log in to comment