complete-prefix
short-circuits too eagerly when deciding whether to return only record field names
#1742
Labels
complete-prefix
short-circuits too eagerly when deciding whether to return only record field names
#1742
A fuller test for the current behavior is at: https://github.com/ncik-roberts/merlin/tree/complete-prefix-record-field-test
complete-prefix
is used for autocompletion. One decision it makes is whether to return only record field names and nothing else. This issue describes a case wherecomplete-prefix
decides too eagerly that it should only return record field names, when actually a record field name could never work. The suggestion I make is that merlin avoid the overeager short-circuiting here.Example
Let's take this program as an running example:
Current behavior
complete-prefix
resultsfield
O
Outer
Outer.
Outer.field
Outer.I
Outer.Inner
The specific heuristic that Merlin uses is:
The second bullet point is overeager. It makes merlin return
Outer.field
as the only completion candidate for the prefixOuter.
, even thoughOuter.field
will never type-check:It would be better to not short-circuit here and provide
Outer.Inner
as a completion candidate. I propose this behavior:Proposed behavior
complete-prefix
resultsfield
O
Outer
Outer.
Outer.field
,Outer.Inner
Outer.I
Outer.Inner
It would be even better to not return
Outer.field
in theOuter.
case, but I expect this to be somewhat harder to implementAdditional example
Similar concerns apply to record field projection:
This has an identical "Current behavior"/"Proposed behavior" to the above.
The text was updated successfully, but these errors were encountered: