Skip to content

Conversation

KristofferC
Copy link
Member

This ports the bracket completion feature from OhMyREPL (https://kristofferc.github.io/OhMyREPL.jl/latest/features/bracket_complete/) to the Julia REPL. It is disabled by default because I am not sure if this is an obvious feature that everyone wants to have.

This feature looks in practice like:

Screen.Recording.2025-10-15.at.13.19.42.mov

With this and #59819 all features (excpet perhaps a good API for https://kristofferc.github.io/OhMyREPL.jl/latest/features/prompt/) have been ported to the Julia REPL and OhMyREPL can be deprecated.

@KristofferC KristofferC added the REPL Julia's REPL (Read Eval Print Loop) label Oct 15, 2025
@PallHaraldsson
Copy link
Contributor

I tried this now (with OhMyREPL) and I think you should rather have it on by default! Just as people my overlook enabling (and install OhMyREPL before), I think people will simply welcome this and could then disable if not.

@StevenWhitaker
Copy link

not sure if this is an obvious feature that everyone wants to have

I am one of those people that does not want this feature enabled by default. I think for IDEs it can make sense to enable by default, but I don't interact with a terminal-based REPL like I do an IDE.

@tecosaur
Copy link
Member

I don't interact with a terminal-based REPL like I do an IDE.

As someone who does tend to use the REPL a bit like a mini-IDE, I'd be interested to know what the usecase that's hurt by this being enabled is, if you're interested in elaborating.

@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Oct 16, 2025

Right; @StevenWhitaker, please try "using OhMyREPL". I though it might interfere, but realized you can overwrite the ) it generates, i.e. type as you would usually, seemingly (I've yet to test it extensively, even though I knew of the package from way back, before its name change...), I think it should bother no one if enabled. At least then can be disabled. That way won't be overlooked.

@KristofferC KristofferC force-pushed the kc/bracket_complete branch 2 times, most recently from 6266cac to 6f38ab3 Compare October 16, 2025 11:31
@StevenWhitaker
Copy link

@tecosaur if I am typing directly into the REPL, it is going to be a single (possibly long) line; if it's anything more than that, I press Alt-e and now I'm in an editor, not the REPL. If I want easy cursor movements, code movements, jump to matching bracket, etc., I will use an editor. As a result, I expect the REPL not to do IDE-like things.

Now, as for bracket completion specifically, in other settings (though I can't remember the details at the moment), there have been times where I type a bracket, only to delete it, but it doesn't delete the auto-added closing bracket (that wouldn't be there otherwise) so I have to interrupt my train of thought to delete it. Granted, it's not a huge inconvenience, but still, it was inconvenient enough that I remember having the issue.

Example below. In this example, | shows the position of my cursor, brackets afterward have been autocompleted.

julia> sum([1, 2|]) # Oh, wait, I want a `Tuple` instead.
julia> sum(|]) # Delete stuff.
julia> sum((1, 2|)]) # Try to run, but wait, it errors because of the extra `]` (that I didn't add!).

I know in this simple case bracket autocompletion tools typically automatically remove the ], but I've also seen situations where it fails and it's kind of annoying.

It's also a mental burden not knowing if I can press ), or if I have to use the right arrow key to navigate past the parenthesis to keep typing. Again, typically tools make it so you can just press ), but, also again, I've experienced cases where it fails and I end up with an extra closing bracket.

@PallHaraldsson I did try OhMyREPL.jl a few years ago, but I actually disabled bracket completion. I don't remember why, though, maybe it was related to what I mentioned above.

@KristofferC KristofferC changed the title add support (disabled by default) for automatic bracket completion in REPL input add support for automatic bracket completion in REPL input Oct 17, 2025
@KristofferC
Copy link
Member Author

@StevenWhitaker I agree that it is annoying when it doesn't work as expected.

I've thought a bit, and I think having it on by default in the beginning has to be done exactly in order to find out issues where it misbehaves. Based on feedback we can then later take stock of what should be done for the actual release.

@StevenWhitaker
Copy link

@KristofferC that make sense.

Also, to be clear, it's not like I'll stop using Julia if this feature is on by default 😂 I just saw there was a comment in favor of having it on by default, so I wanted to raise awareness that there is at least one person who prefers otherwise. And if all the kinks get ironed out, I might change my mind 😄

@KristofferC KristofferC merged commit 810a1bd into master Oct 17, 2025
5 of 7 checks passed
@KristofferC KristofferC deleted the kc/bracket_complete branch October 17, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

REPL Julia's REPL (Read Eval Print Loop)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants