You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reference completion often includes trailing dot, which is the step separator. The trailing dot is not included in the AST by HCL, which we already account for in the obvious cases:
// account for trailing character(s) which doesn't appear in AST
// such as dot, opening bracket etc.
editRng.End=pos
}
prefixRng:= hcl.Range{
Filename: eType.Range().Filename,
Start: eType.Range().Start,
End: pos,
}
prefix:=string(prefixRng.SliceBytes(file.Bytes))
However we do not seem to account for similar cases involving references with trailing dot inside complex types (list, set, map, maybe object as well):
Debugging Details
For list specifically I was able to narrow down the codepath to this condition, which compares the element range with the given position, which is not contained (it's off by one due to the dot that isn't included in the range):
The only extra complexity is that we'd have to pass around those recovered bytes (maybe as prefix?) in addition to the AST (hcl.Expression) between all expression types.
The text was updated successfully, but these errors were encountered:
Context
Reference completion often includes trailing dot, which is the step separator. The trailing dot is not included in the AST by HCL, which we already account for in the obvious cases:
hcl-lang/decoder/expr_reference_completion.go
Lines 71 to 82 in bd545f4
However we do not seem to account for similar cases involving references with trailing dot inside complex types (list, set, map, maybe object as well):
Debugging Details
For list specifically I was able to narrow down the codepath to this condition, which compares the element range with the given position, which is not contained (it's off by one due to the dot that isn't included in the range):
hcl-lang/decoder/expr_list_completion.go
Lines 77 to 79 in bd545f4
It is likely that other complex types have the same root cause.
Proposal
Fix the bug by providing completion of nested references after the trailing dot.
Ideas
We could leverage the recovery mechanism to recover the whole expression:
hcl-lang/decoder/expression.go
Lines 226 to 253 in bd545f4
The only extra complexity is that we'd have to pass around those recovered bytes (maybe as prefix?) in addition to the AST (
hcl.Expression
) between all expression types.The text was updated successfully, but these errors were encountered: