Skip to content

REPL completions for brackets and quotes. #17838

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

Closed
wants to merge 2 commits into from

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Aug 5, 2016

Trying to upstream a bit more from https://github.com/KristofferC/PimpMyREPL.jl

This adds some convenience bracket completions that are common in editors. I basically replicated the behaviour I get from my editor that I like.

Example:

@tkelman tkelman added the REPL Julia's REPL (Read Eval Print Loop) label Aug 5, 2016
@yuyichao
Copy link
Contributor

yuyichao commented Aug 5, 2016

FWIW, this is one of the Jupyter notebook features I hate the most...... (p.s. the other one being the multiple input cursor...)

@KristofferC
Copy link
Member Author

KristofferC commented Aug 5, 2016

Hah! Hmm, maybe make it optional then... I like it because it makes is easy to balance brackets.

@yuyichao
Copy link
Contributor

yuyichao commented Aug 5, 2016

And a little more detail about why I hate this feature, (just tried it again to remind myself about it).

When the input is (()<cursor>) (with possibly more stuff between the opening parenthesis), typing <backspace>) will end up net deleting a ) and move the cursor after the (originallly) second closing parenthesis. I've got countless number of parenthesis mismatch after editing a cell because of this.

@KristofferC
Copy link
Member Author

KristofferC commented Aug 5, 2016

So it is just the "only move to the right if matching right bracket"-part you dont like? However, it would be annoying if f, (, x, ) turned into f(x)) so they sort of tie together.

@yuyichao
Copy link
Contributor

yuyichao commented Aug 5, 2016

only move to the right if matching right bracket

Yes, that's the main reason. I can easily imagine that a different heuristic can be annoy in other cases though.

Since this is strictly a negative feature for me (I always type matching parentheses/quotes), it'll be pretty hard to implement this that doesn't get in my way from time to time. On the other hand, I agree this is a nice feature and I'll be happy as long as there's a way to turn it off (I'm ok with this being the default if more people like it that way).

@KristofferC
Copy link
Member Author

Ok, I will make sure it is easy to enable/disable and then we can think about what should be default.

@KristofferC KristofferC force-pushed the kc/bracket_completion branch from e3ab24a to 292e57d Compare August 5, 2016 16:01
@KristofferC
Copy link
Member Author

Ok, pushed new version with a function to disable it + NEWS entry.

@KristofferC
Copy link
Member Author

Also this is only for the Julia REPL now. I could make it the default fall back for all REPLs, not sure what is best.

@KristofferC KristofferC force-pushed the kc/bracket_completion branch from 292e57d to ee8bfc5 Compare August 5, 2016 17:03
@KristofferC
Copy link
Member Author

The emoji competition suggests that maybe this should be off by default :P

end

# Similar to above but with quotation marks that need to be handled a bit differently
for v in ['\"', '\'']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should matching also apply to back ticks?

@KristofferC
Copy link
Member Author

This seems to generally not be very desired and is already implemented in a package so probably not needed in the default Base REPL.

@KristofferC KristofferC closed this Oct 8, 2016
@ararslan ararslan deleted the kc/bracket_completion branch February 22, 2017 18:24
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