Skip to content
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

fix completion that resulted in startpos of 0 for `\\ #52009

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

IanButterworth
Copy link
Sponsor Member

@IanButterworth IanButterworth commented Nov 3, 2023

Fixes #51985

I'm not sure of the correctness of this fix.
Seems to have been introduced by 2d68286 cc. @c42f

Also fixes/tidies the keymap error show.
Now (without the fix)

julia> `\\
┌ Error: Error in REPL keymap
│ BoundsError: attempt to access 3-codeunit String at index [0:3]
│ Stacktrace:
│   [1] checkbounds
│     @ Base ./strings/basic.jl:214 [inlined]
│   [2] getindex
│     @ Base ./strings/string.jl:481 [inlined]
│   [3] complete_line(c::REPL.REPLCompletionProvider, s::REPL.LineEdit.PromptState, mod::Module)
│     @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:562
│   [4] check_for_hint(s::REPL.LineEdit.MIState)
│     @ REPL.LineEdit ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:384
│   [5] (::REPL.LineEdit.var"#139#195")(s::REPL.LineEdit.MIState, data::Any, c::Union{Char, SubString{String}, String})
│     @ REPL.LineEdit ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2494
│   [6] #invokelatest#2
│     @ Base ./essentials.jl:929 [inlined]
│   [7] invokelatest
│     @ Base ./essentials.jl:926 [inlined]
│   [8] (::REPL.LineEdit.var"#27#28"{REPL.LineEdit.var"#139#195", String})(s::Any, p::Any)
│     @ REPL.LineEdit ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:1678
│   [9] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│     @ REPL.LineEdit ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2815
│  [10] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│     @ REPL.LineEdit ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2717
│  [11] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│     @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1352
│  [12] (::REPL.var"#64#70"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│     @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:401
└ @ REPL.LineEdit /Users/ian/Documents/GitHub/julia/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2818
julia>

was

julia> `\\┌ Error: Error in the keymap
│   exception = (BoundsError("`\\\\", 0:3), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x00007fc132a83da8, Ptr{Nothing} @0x00007fc132a62997, Ptr{Nothing} @0x00007fc14a6c9a9e, Ptr{Nothing} @0x00007fc132b7b744, Ptr{Nothing} @0x00007fc132ad156e, Ptr{Nothing} @0x00007fc14a6c9a9e, Ptr{Nothing} @0x00007fc14a6db07d, Ptr{Nothing} @0x00007fc132b70b6c, Ptr{Nothing} @0x00007fc132ad8446, Ptr{Nothing} @0x00007fc14a6c9a9e, Ptr{Nothing} @0x00007fc132b083f0, Ptr{Nothing} @0x00007fc132ab1b20, Ptr{Nothing} @0x00007fc1329bcd5e, Ptr{Nothing} @0x00007fc14a6c9a9e, Ptr{Nothing} @0x00007fc132a779ee, Ptr{Nothing} @0x00007fc132a856cd, Ptr{Nothing} @0x00007fc132a58636, Ptr{Nothing} @0x00007fc14a6c9a9e, Ptr{Nothing} @0x00007fc14a6f0bb1])
└ @ REPL.LineEdit /home/vtjnash/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2817

@IanButterworth IanButterworth added the REPL Julia's REPL (Read Eval Print Loop) label Nov 3, 2023
@KristofferC KristofferC added the backport 1.10 Change should be backported to the 1.10 release label Nov 3, 2023
@IanButterworth
Copy link
Sponsor Member Author

Failures indicate this isn't the fix, but at least it shows where the issue is. I'm going to have to pass the ball here. I don't understand the intention here enough.

@IanButterworth IanButterworth marked this pull request as draft November 3, 2023 16:12
stdlib/REPL/src/LineEdit.jl Outdated Show resolved Hide resolved
@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 3, 2023

relatedly, if you have a file named $, then typing " then $ then <tab> results in:

julia> \$"

@vtjnash vtjnash marked this pull request as ready for review November 3, 2023 21:14
@KristofferC KristofferC mentioned this pull request Nov 6, 2023
39 tasks
@vtjnash vtjnash force-pushed the ib/completion_fix branch 2 times, most recently from 1efde32 to f844e21 Compare November 14, 2023 20:01
@vtjnash vtjnash added merge me PR is reviewed. Merge when all tests are passing and removed merge me PR is reviewed. Merge when all tests are passing labels Nov 14, 2023
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Nov 15, 2023
@vtjnash vtjnash merged commit 5edcdc5 into JuliaLang:master Nov 15, 2023
5 of 8 checks passed
@IanButterworth IanButterworth deleted the ib/completion_fix branch November 15, 2023 19:16
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Nov 16, 2023
KristofferC pushed a commit that referenced this pull request Nov 27, 2023
Fixes #51985

Ensure that the REPL completions escape and unescape text correctly,
using the correct functions, and accounting for exactly what the user
has currently typed.

The old broken method is left around for Pkg, since it has an
over-reliance on it returning incorrect answers. Once Pkg is fixed, we
can delete that code.

Co-authored-by: Jameson Nash <[email protected]>
(cherry picked from commit 5edcdc5)
KristofferC added a commit that referenced this pull request Dec 2, 2023
Backported PRs:
- [x] #51213 <!-- Wait for other threads to finish compiling before
exiting -->
- [x] #51520 <!-- Make allocopt respect the GC verifier rules with non
usual address spaces -->
- [x] #51598 <!-- Use a simple error when reporting sysimg load
failures. -->
- [x] #51757 <!-- fix parallel peakflop usage -->
- [x] #51781 <!-- Don't make pkgimages global editable -->
- [x] #51848 <!-- allow finalizers to take any locks and yield during
exit -->
- [x] #51847 <!-- add missing wait during Timer and AsyncCondition close
-->
- [x] #50824 <!-- Add some aliasing warnings to docstrings for mutating
functions in Base -->
- [x] #51885 <!-- remove chmodding the pkgimages -->
- [x] #50207 <!-- [devdocs] Improve documentation about building
external forks of LLVM -->
- [x] #51967 <!-- further fix to the new promoting method for
AbstractDateTime subtraction -->
- [x] #51980 <!-- macroexpand: handle const/atomic struct fields
correctly -->
- [x] #51995 <!-- [Artifacts] Pass artifacts dictionary to
`ensure_artifact_installed` dispatch -->
- [x] #52098 <!-- Fix errors in `sort` docstring -->
- [x] #52136 <!-- Bump JuliaSyntax to 0.4.7 -->
- [x] #52140 <!-- Make c func `abspath` consistent on Windows. Fix
tracking path conversion. -->
- [x] #52009 <!-- fix completion that resulted in startpos of 0 for `\\
-->
- [x] #52192 <!-- cap the number of GC threads to number of cpu cores
-->
- [x] #52206 <!-- Make have_fma consistent between interpreter and
compiled -->
- [x] #52027 <!-- fix Unicode.julia_chartransform for Julia 1.10 -->
- [x] #52217 <!-- More helpful error message for empty `cpu_target` in
`Base.julia_cmd` -->
- [x] #51371 <!-- Memoize `cwstring` when used for env lookup /
modification on Windows -->
- [x] #52214 <!-- Turn Method Overwritten Error into a PrecompileError
-- turning off caching -->
- [x] #51895 <!-- Devdocs on fixing precompile hangs, take 2 -->
- [x] #51596 <!-- Reland "Don't mark nonlocal symbols as hidden"" -->
- [x] #51834 <!-- [REPLCompletions] allow symbol completions within
incomplete macrocall expression -->
- [x] #52010 <!-- Revert "Support sorting iterators (#46104)" -->
- [x] #51430 <!-- add support for async backtraces of Tasks on any
thread -->
- [x] #51471 <!-- Fix segfault if root task is NULL -->
- [x] #52194 <!-- Fix multiversioning issues caused by the parallel llvm
work -->
- [x] #51035 <!-- refactor GC scanning code to reflect jl_binding_t are
now first class -->
- [x] #52030 <!-- Bump Statistics -->
- [x] #52189 <!-- codegen: ensure i1 bool is widened to i8 before
storing -->
- [x] #52228 <!-- Widen diagonal var during `Type` unwrapping in
`instanceof_tfunc` -->
- [x] #52182 <!-- jitlayers: replace sharedbytes intern pool with one
that respects alignment -->

Contains multiple commits, manual intervention needed:
- [ ] #51092 <!-- inference: fix bad effects for recursion -->

Non-merged PRs with backport label:
- [ ] #52196 <!-- Fix creating custom log level macros -->
- [ ] #52170 <!-- fix invalidations related to `ismutable` -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
@KristofferC KristofferC removed the backport 1.10 Change should be backported to the 1.10 release label Dec 2, 2023
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.

typing "`\\" crashes the REPL immediately
4 participants