OhMyREPL.jl icon indicating copy to clipboard operation
OhMyREPL.jl copied to clipboard

Bracket completion doesn't play well with tab-completion

Open axsk opened this issue 1 year ago • 8 comments

When typing include("myf<tab> this ends up with include("myfile.jl"")

Supposedly typing " adds the first closing ", and tab completion the second.

axsk avatar Dec 09 '23 12:12 axsk

Not quite the same, but when having include("myfile.jl in the REPL and typing " it results in "". Here context lookup would be nice to not close the " automatically, and I suppose similar for brackets..

axsk avatar Dec 09 '23 12:12 axsk

I have also been having this issue after installing Julia 1.10. This works as expected in 1.9. Doesn't seem to matter whether OhMyREPL is loaded at startup or later.

mihrits avatar Jan 04 '24 09:01 mihrits

I'm having the same issue. Furthermore, after autocompletion by tabbing the cursor is on the extraneous quotation mark. Pressing delete removes BOTH quotation marks on the right. Then if I type a quotation mark to close the string, two appear again! To remove the extraneous quotation mark, I need to press the right arrow key and then delete.

scheinerman avatar Jan 17 '24 22:01 scheinerman

I have also been having this issue after installing Julia 1.10. This works as expected in 1.9. Doesn't seem to matter whether OhMyREPL is loaded at startup or later.

Yes, this is not an OhMyREPL issue, but a Julia 1.10 issue.

chriselrod avatar Feb 21 '24 04:02 chriselrod

I have also been having this issue after installing Julia 1.10. This works as expected in 1.9. Doesn't seem to matter whether OhMyREPL is loaded at startup or later.

Yes, this is not an OhMyREPL issue, but a Julia 1.10 issue.

Assume there is a file foo.jl on disk:

include("foo<TAB

produces a repeated " at the end:

include("foo.jl"")

This behavior was not present in previous Julia versions.

I switched off OhMyREPL by starting Julia with julia --startup-file=no and the problem does not happen for me (using version 1.10.1). Tab completion works fine. But if I allow OhMyREPL either via my startup.jl or by using OhMyREPL, the problem persists. So, at least for me, this does seem to be an OhMyREPL issue.

scheinerman avatar Feb 22 '24 15:02 scheinerman

I get the problem with --startup=no on Julia 1.10.

I think the confusion is because OhMyREPL automatically closes quotes, i.e. if | is your cursor, you get

julia> include(|

type "

julia> include("|"

i.e., it adds a closing quote for you automatically. You can disable this behavior with

enable_autocomplete_brackets(false)

Julia 1.10 introduced the problem that \tab completion automatically closes the quote. So if you have "foo\tab, you get "foo.jl". If you already had a close-quote, you now have two close quotes.

The bad interaction with OhMyREPL.jl is that it adds a close quote, so now you basically always have "foo\tab" -> "foo.jl"". If you already have that closing quote for other reasons, you'll still get the annoying double-close on Julia 1.10.

chriselrod avatar Feb 22 '24 18:02 chriselrod

I think the way many editors handle this is that when you type the final " it replaces the one that's already there. Not sure what the full logic is, but I believe that's what many seem to do.

StefanKarpinski avatar May 31 '24 19:05 StefanKarpinski

I think the way many editors handle this is that when you type the final " it replaces the one that's already there. Not sure what the full logic is, but I believe that's what many seem to do.

OhMyREPL already does that.

KristofferC avatar Aug 05 '24 12:08 KristofferC