Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE: Statements in top-level objects in a worksheet should be executed and their output displayed on the side #5400

Closed
smarter opened this issue Nov 6, 2018 · 2 comments

Comments

@smarter
Copy link
Member

smarter commented Nov 6, 2018

In the Eclipse worksheet, wrapping a statement in an object does not change the fact that it gets executed when the worksheet is run, but in our current worksheet support, the only output we see is // defined object Foo

@Duhemm
Copy link
Contributor

Duhemm commented Nov 7, 2018

I think I don't understand this issue.

This is what happens in Eclipse when I create an object in the worksheet:

object myworksheet {
  println("Hello, world!")                        //> Hello, world!
  object O {
    println("Hello from O")
  }
  println("Goodbye!")                             //> Goodbye!
}

This is running Scala IDE 4.7.0 with Scala 2.12.3.

The "equivalent" worksheet in Dotty IDE would be:

println("Hello, world!")                        //> Hello, world!
object O {
  println("Hello from O")
}                                               //> defined object O
println("Goodbye!")                             //> Goodbye!

In Dotty IDE, the worksheet is implicitly wrapped in an object. It is done implicitly, because unlike Scala IDE, we don't have a wizard that will create the structure of the worksheet for the user.

Are you suggesting that we should detect whether the user is doing the wrapping by himself?

@smarter
Copy link
Member Author

smarter commented Nov 8, 2018

Ah I see, I got confused by the top-level object in the Eclipse worksheet. I guess it's not worth the extra complexity to handle more.

@smarter smarter closed this as completed Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants