Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Apr 3, 2023
1 parent cc1de18 commit b7a73a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions decoder/expr_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ func (fe functionExpr) CompletionAtPos(ctx context.Context, pos hcl.Pos) []lang.
return []lang.Candidate{}
}
prefixLen := pos.Byte - eType.Traversal.SourceRange().Start.Byte
prefix := eType.Traversal.RootName()[0:prefixLen]

return fe.matchingFunctions(prefix, eType.Range())
rootName := eType.Traversal.RootName()
if prefixLen <= len(rootName) {
prefix := rootName[0:prefixLen]
return fe.matchingFunctions(prefix, eType.Range())
}

return []lang.Candidate{}
case *hclsyntax.FunctionCallExpr:
if eType.NameRange.ContainsPos(pos) {
prefixLen := pos.Byte - eType.NameRange.Start.Byte
Expand Down

0 comments on commit b7a73a0

Please sign in to comment.