feat(repl): evaluate Scala worksheets with the REPL - #27007
warcholjakub wants to merge 35 commits into
Conversation
36d6906 to
4925315
Compare
| settings(commonJavaSettings). | ||
| settings( | ||
| versionScheme := Some("semver-spec"), | ||
| ) |
There was a problem hiding this comment.
Wasn't sure whether to add MiMa here.
0ecbad3 to
c225648
Compare
|
Do we have a spec or documentation somewhere of what worksheets are and how they should behave? |
Not sure. The main goal of this was to replace mdoc in Metals, so I designed it as closely to mdoc as I could. With a few exceptions ofc. Yeah, but besides that I don't think there's any spec. |
I would say the spec will be the interfaces that we brought over from mdoc. We can iterate on them for sure, but the main goal is to have an easy way of evaluating whole code snippets. Would also reduce the reliance on compiler internals we have in mdoc. |
|
In that case I'll let someone familiar with mdoc review this... the concept looks OK to me, the idea of doing it on top of the REPL is fine, but I've never used worksheets (my bad!) so I don't know what the code should or shouldn't do in the first place. |
c225648 to
e008a1d
Compare
I will review it next week (I am a bit sick this week, so trying to avoid anything that requires too much thinking.). Overall, we also wanted to have it on top of REPL to allow for incremental reevaluation, so we would also only evaluate statements starting from the one that changes. With mdoc it would be quite hard and repl is perfect for that. |
e008a1d to
94b7a1c
Compare
|
this seems to hand a lot of the responsibilities to the scala 3 repo. Is it better to provide a minimal interface that stays binary compatible (or even a java interface) and the rest is kept in metals? having said that, it would be interesting to see if there is a common core that works for both worksheet and something like a notebook (preferrably reactive like https://github.com/bishabosha/notebook.sc) |
That would defeat the purpose of the PR. Currently maintaining worksheet is problematic because it heavily interacts with compiler internals. Any larger changes cause problems. Releasing for each version of the compiler separately is also causing a large maintenance burden.
That was also an idea we had to make it easier to implement notebook functionality. |
|
Also it's not new to have worksheets in the compiler, that was already done in the previous language server. |
Adds a worksheet evaluator that's built on the REPL.
Have you relied on LLM-based tools in this contribution?
Yes, and I checked the output by reading and understanding the code.
How was the solution tested?
New automated tests (including the issue's reproducer, if applicable)