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 starting range in REPLCompletions #49547

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Fix starting range in REPLCompletions #49547

merged 1 commit into from
Apr 28, 2023

Conversation

Keno
Copy link
Member

@Keno Keno commented Apr 27, 2023

The new completion for var" fields (#49294) failed when the var" was at the end of the completion query, e.g. in WeirdNames().var". This is because we have the following behavior:

julia> findprev(==('x'), "x", 1)
1

julia> findprev(==('x'), "x", 2)

REPLCompletions attempt to find . starting after the var", which in this case is at the end of the string. Of course, the index was probably off by one anyway, because
we didn't want to match var"., but nevertheless, I find this behavior surprising (ref also [1]).
For now, fix this by starting the search before the var", but we may want to revisit the findprev behavior also.

[1] https://github.com/JuliaLang/julia/pull/35742/files#r420945975

The new completion for `var"` fields (#49294) failed
when the `var"` was at the end of the completion query,
e.g. in `WeirdNames().var"`. This is because we have the
following behavior:

```
julia> findprev(==('x'), "x", 1)
1

julia> findprev(==('x'), "x", 2)
```

REPLCompletions attempt to find `.` starting after the `var"`,
which in this case is at the end of the string. Of course,
the index was probably off by one anyway, because
we didn't want to match `var".`, but nevertheless,
I find this behavior surprising (ref also [1]).
For now, fix this by starting the search before the `var"`,
but we may want to revisit the `findprev` behavior also.

[1] https://github.com/JuliaLang/julia/pull/35742/files#r420945975
@giordano giordano added REPL Julia's REPL (Read Eval Print Loop) bugfix This change fixes an existing bug labels Apr 27, 2023
@Keno Keno merged commit 645f7af into master Apr 28, 2023
@Keno Keno deleted the kf/fix49294 branch April 28, 2023 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants