KristofferC/OhMyREPL.jl

Bracket completion doesn't play well with tab-completion

Opened this issue ยท 9 comments

axsk commented

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

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

axsk commented

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..

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.

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.

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.

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.

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.

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.

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.

A quick fix for this is to add the following to your startup.jl (in the function called by atreplinit()):

    # quickfix for path completion issue (don't add closing quotes)
    @eval REPL.REPLCompletions close_path_completion(d, ps, s, p) = false