KristofferC / OhMyREPL.jl

Syntax highlighting and other enhancements for the Julia REPL
https://kristofferc.github.io/OhMyREPL.jl/latest/
Other
746 stars 57 forks source link

Bracket completion doesn't play well with tab-completion #334

Open axsk opened 6 months ago

axsk commented 6 months ago

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 6 months ago

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

mihrits commented 6 months ago

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.

scheinerman commented 5 months ago

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.

chriselrod commented 4 months ago

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.

scheinerman commented 4 months ago

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.

chriselrod commented 4 months ago

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.

StefanKarpinski commented 1 month ago

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.