JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

Autocomplete problem in output cell. #1099

Open garazha-ilya opened 9 months ago

garazha-ilya commented 9 months ago

Autocompletion works well, but errors inside output cell occured every time.

  1. The output of versioninfo() :

Julia Version 1.9.3 Commit bed2cd540a1 (2023-08-24 14:43 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake) Threads: 1 on 8 virtual cores

  1. How you installed Julia
wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.4-linux-x86_64.tar.gz
tar zxvf julia-1.9.4-linux-x86_64.tar.gz
  1. A minimal working example (MWE), also known as a minimum reproducible example: using Pkg; Pkg.add("IJulia"); using IJulia; notebook()

Settings -> Settings Editor -> Code Completion -> Enable autocompletion -> true

In first evaluation (Shift + Enter) everything works fine, but after second evaluation of the same code occurs error message:

image

If autocompletion is disabled, then everything works normal.

KERNEL EXCEPTION
BoundsError: attempt to access empty String at index [1:40]

Stacktrace:
 [1] checkbounds
   @ ./strings/basic.jl:216 [inlined]
 [2] getindex(s::String, r::UnitRange{Int64})
   @ Base ./strings/string.jl:276
 [3] complete_request(socket::ZMQ.Socket, msg::Msg)
   @ IJulia ~/.julia/packages/IJulia/Vo51o/src/handlers.jl:115
 [4] #invokelatest#2
   @ ./essentials.jl:819 [inlined]
 [5] invokelatest
   @ ./essentials.jl:816 [inlined]
 [6] eventloop(socket::ZMQ.Socket)
   @ IJulia ~/.julia/packages/IJulia/Vo51o/src/eventloop.jl:8
 [7] (::IJulia.var"#15#18")()
   @ IJulia ./task.jl:514
stevengj commented 9 months ago

My version of Jupyter doesn't have a "Code completion" option in the "Settings" menu:

image

How did you get this? I just did a fresh install from Conda.

stevengj commented 9 months ago

It sounds like Jupyter might sending IJulia an invalid completion request message on your machine. You could verify this by setting IJulia.verbose = true, which causes every message from Jupyter to be printed in the terminal. Look for something like:

RECEIVED IPython Msg [ idents b9b9f847-93ce-492c-a345-333b8a8ec0e0 ] {
  parent_header = Dict{String, Any}(),
  header = Dict{String, Any}("msg_id" => ....),
  metadata = Dict{String, Any}(),
  content = Dict{String, Any}("cursor_pos" => ...., "code" => ".....")
}
garazha-ilya commented 9 months ago

My version of Jupyter doesn't have a "Code completion" option in the "Settings" menu: image How did you get this? I just did a fresh install from Conda.

On main menu:

image

I install Jupyter notebook via Ijulia instructions: https://github.com/JuliaLang/IJulia.jl -> Quick start -> using IJulia; notebook()

garazha-ilya commented 9 months ago

After adding something stranger happens: image

Now, in the end of the line, after pressing Tab, displays a lot of completion. Also, I don't understand, where the Terminal and command IJulia.verbose = true should be started and typed in?

image