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

Tab expansion of NamedTuple fails on 1.10.0-beta2 #51194

Closed
jaakkor2 opened this issue Sep 5, 2023 · 3 comments · Fixed by #51366
Closed

Tab expansion of NamedTuple fails on 1.10.0-beta2 #51194

jaakkor2 opened this issue Sep 5, 2023 · 3 comments · Fixed by #51366
Labels
bisect wanted regression Regression in behavior compared to a previous version REPL Julia's REPL (Read Eval Print Loop)

Comments

@jaakkor2
Copy link
Contributor

jaakkor2 commented Sep 5, 2023

This worked on 1.9, does not on 1.10.0-beta2.

A = (; foo=2, bar=3), and then type A.foo + A.b<TAB>. bar does not get expanded.

@gbaraldi gbaraldi added the REPL Julia's REPL (Read Eval Print Loop) label Sep 5, 2023
@oscardssmith
Copy link
Member

Interestingly for regular structs (e.g. complex numbers) this still works.

@oscardssmith
Copy link
Member

Pretty sure the bisect will find #49206 but would be good to be sure.

@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Sep 6, 2023
@Liozou
Copy link
Member

Liozou commented Sep 24, 2023

Fix is up at #51366. The symptoms are a bit misleading but this issue actually has nothing to do with NamedTuple vs regular structs, it is only due to the completion of arguments of infix operator (the + here) which has been buggy since #49294.

KristofferC pushed a commit that referenced this issue Oct 12, 2023
Fix #51194

This PR fixes a regression introduced in
#49294, so I believe it should be
backported to v1.10.
In the current code, completion of `qux(foo, bar.` is detected by
parsing `foo(qux, bar` as an incomplete expression, and then looking for
the sub-expression to complete (here, `bar.`). This approach fails
however for infix calls, since completing `foo + bar.` starts by parsing
`foo + bar`, which is a complete call expression, and so the code
behaves as if completing `(foo + bar).` instead of `bar.`. This leads to
the current problematic behaviour:
```julia
julia> Complex(1, 3) + (4//5).#TAB
im
re
```
which would be correct for `(Complex(1, 3) + (4//5)).#TAB`, but here we
expect
```julia
julia> Complex(1, 3) + (4//5).#TAB
den
num
```

This PR fixes that by trying to detect infix calls. In the long term,
all this ad-hoc and probably somewhat wrong string processing should be
replaced by proper use of `JuliaSyntax` (as mentioned in
#49294 (comment),
#50817 (comment)
and probably other places), but for now at least this fixes the
regression.
KristofferC pushed a commit that referenced this issue Oct 12, 2023
Fix #51194

This PR fixes a regression introduced in
#49294, so I believe it should be
backported to v1.10.
In the current code, completion of `qux(foo, bar.` is detected by
parsing `foo(qux, bar` as an incomplete expression, and then looking for
the sub-expression to complete (here, `bar.`). This approach fails
however for infix calls, since completing `foo + bar.` starts by parsing
`foo + bar`, which is a complete call expression, and so the code
behaves as if completing `(foo + bar).` instead of `bar.`. This leads to
the current problematic behaviour:
```julia
julia> Complex(1, 3) + (4//5).#TAB
im
re
```
which would be correct for `(Complex(1, 3) + (4//5)).#TAB`, but here we
expect
```julia
julia> Complex(1, 3) + (4//5).#TAB
den
num
```

This PR fixes that by trying to detect infix calls. In the long term,
all this ad-hoc and probably somewhat wrong string processing should be
replaced by proper use of `JuliaSyntax` (as mentioned in
#49294 (comment),
#50817 (comment)
and probably other places), but for now at least this fixes the
regression.

(cherry picked from commit e949236)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bisect wanted regression Regression in behavior compared to a previous version REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants