-
Notifications
You must be signed in to change notification settings - Fork 14
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
REPL: Improved REPL #325
Comments
+1 for incorporating Ammonite, this is a fantastic tool. |
As long as we keep the performance smooth! |
in the REPL, enter a Tab will display all the available names imported in the scope which makes a lot troubles in some case,for example,when pasting codes with tab as indent from editors like vim even in the :paste mode ,the screen if full of unexpected names. |
In Python you can investigate any object foo (type, object in a global variable, built-in function, etc.) using foo to see what the thing evaluates to, type(foo) to show its type, dir(foo) to tell you the methods you can call on it, and help(foo) to get the built-in documentation. You can even do things like help("re") to find out the documentation on the package named re (which holds regular-expression objects and methods), even though there isn't an object associated with it.Can scala REPL does things like this ? |
@yinshurman about tab, are you using a recent version with scala/bug#9336 ? That enables the kludge in jline; but maybe it could do more in paste mode. |
I'm use scala of version 2.11.7 |
This should be fixed in 2.11.11. For some of the equivalent commands from
python try :help
…On Fri, May 5, 2017 at 02:18 yinshurman ***@***.***> wrote:
I'm use scala of version 2.11.7
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#325 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFjy2auJXjsXDbeB30GHg3aySAuhPRpks5r2ulegaJpZM4MRr8R>
.
|
It's fixed by add a tip "Display all 435 possibilities? (y or n)" every time you enter a tab. |
It's a nice consequence of English pronunciation that a windowing REPL or |
The plan is to first split the current repl into:
The api exposed by the compiler should also support other shells, such as ammonite / spark notebooks. Eventually, maybe we can support connecting to this repl compiler instance using the language server protocol (as in scala/scala3#2195) I've just started hacking on this in my WIP branch: https://github.com/scala/scala/compare/2.13.x...adriaanm:repl-modularize?expand=1 |
scala/scala#5903 takes the first steps towards splitting the REPL into a shell (UI) component and a compiler to support evaluating expressions and definitions + auto-completion (similar to the presentation compiler). The idea is that there could be multiple front-ends (the default, ammonite, spark worksheets,...) that all use the same underling compiler for consistent evaluation and type checking semantics. Also, the default shell will likely use jline3, which has better support multi-line editing, highlighting, parsing as you type, etc. |
By the way, we're currently not planning to backport the REPL work to 2.12. Please target 2.13.x for any PR that changes the REPL (or, please fix it first in 2.13 and backport to 2.12). We are open to discussing a backport of the rework, though -- especially if someone's interested to contribute it :-) (A backport would have to be more careful not to break anyone currently embedding the 2.12 repl). Finally, we'd love to hear feedback on the interface proposed in scala/scala#5903 from anyone embedding the REPL. |
Another wishlist item that was in part prototyped in REPLs of yore would some features that exploit the runtime types and reflection.
An unrelated feature that I think would be beneficial would be a UI to show the expected type at the cursor. Maybe use this to filter or prioritize autocomplete suggestions. I prototyped this in my last round of REPL renovations, but didn't follow through. |
One more wishlist item for power mode: a version of You can simulate this at the moment with a macro and a backchannel:
|
that's beautiful |
is there a "plugin loading mechanism for REPL", with a stable API and proper documentation/example, "through which one can add new inbuilt commands(colon commands) to REPL" , say ":my_new_command" , just like the inbuilt commands ":help" , ":paste" etc. |
Other than that, no. So, no. |
REPL should clip my stackoverflows for me. Give me a
|
See also scala/scala#6382 |
jline3 upgrade split off to https://github.com/scala/scala-dev/issues/535 (and scheduled for 2.13.0-RC1) |
Here's a test case that shows the inefficiency of the current wrapper schemes that require wrapper nesting proportional to the length of the REPL session. https://gist.github.com/ad2505e99fc4084e4f9e79aa5b147aad We should revive scala/scala@2.13.x...adriaanm:repl-wrappers to address that problem. In that branch, the test above fails suggesting an unwanted semantic change:
|
I wanted the nesting level import to compile a directory as a single compilation unit, where files are not just concatenated, but each file is in a magic nesting block. (That requires both increasing and decreasing, for entering and leaving the block.) I think REPL lines should compile to functions, taking values instead of importing them. That would be closer to the scripting environment, where contexts maintain bindings. |
@dwijnand currently this is on the 2.13.2 milestone. is there anything here that 1) is crucial for 2.13.2 but 2) isn't already covered by existing PRs/issues that are already milestoned 2.13.2? |
@SethTisue definitely #325 (comment) (self-deprecation) @dwijnand What's going on? Are you the person tasked with getting jline 3 over the goal line, or something else? From the outside, it's hard to know if it's worth touching anything in that area for obvious reasons (merge conflicts rather than personality conflicts). |
That's me (and it's literally the top item in my queue at present, other than making sure all our 2.13.2 ducks are in a line generally). ...but perhaps Dale will help also, depending on how much else he has going on. (He's up to speed now on REPL stuff, having just gotten scala/scala#8712 over the 2.12.x finish line, though merging it onto 2.13 is still in process.)
Mm hmm. It makes sense to hold off a bit on anything that's likely to more-than-trivially merge-conflict with the JLine 3 work and the class-based changes. |
I think we're using this ticket as a proxy for "let's not forget about the REPL" issue, every release. So with the class-based changes and hopefully the JLine 3 upgrade, both targeting 2.13.2, this one can be pushed to .3.
@som-snytt Would you benefit from having a, let's say, every-two-week video call? Might help on a regular basis touch base on things that slip or that we forget to communicate clearly. Seth's on JLine 3 duty. But my branch-merging of class-based hit merge conflicts. Not a huge amount, but enough to likely incur another rebase push on the JLine 3 upgrade. I'm happy to do that rebase, btw, to help the cause (and b/c I have a good tooling setup for rebases, and b/c I know what the cause of the rebase). Oh than that, I don't have any work coming up for the REPL, so no potential future conflicts from me (both merge conflicts and personality conflicts). |
The JLine 3 upgrade is progressing well at scala/scala#8036 and https://github.com/scala/scala-dev/labels/t%3Ajline3 . There are separate tickets and we'd love to have contributors tackle any of them. In general, further REPL improvements are a likely area of focus for us in 2020. (It stalled somewhat in 2019, but only because we had to focus on getting 2.13.0 and 2.13.1 out the door. That's done now.) |
I did a little Twitter poll at https://twitter.com/SethTisue/status/1255633365232840704 unscientific results: "add dependencies live" is the clear winner, but also the most ambitious as it involves bringing in coursier as a dependency. it might best be tackle-able in combination with replacing our current start scripts with coursier-based ones (as @lrytz observed) it was nice to see the other two choices I gave, which are easier, both got a good amount of support in the replies there was interest in displaying type names in their shortest reachable form, as Ammonite already does:
so I think that should be on the short list as well. |
An intermediate solution would be to require |
@SethTisue I think showing scaladoc in REPL is, in the minds of the beginner coders that I'm teaching, the most important feature on your Twitter poll short-list. (The other features in the REPL upgrade already in there are really great for beginners as well, like multi line editing. 👍 🥇 ) |
This ticket has grown stale, so I'm replacing it with #754 For the record, the big improvements that have already landed are:
|
Here are some ideas for improving the repl:
StealIncorporate the improvements already implemented in the Ammonite REPL:More ideas / requirements:
The text was updated successfully, but these errors were encountered: