Skip to content

Commit

Permalink
Introduce PathContext to TypeDeclaration
Browse files Browse the repository at this point in the history
This is required in order to recover bytes of incomplete configuration during completion.
  • Loading branch information
radeksimko committed Mar 9, 2023
1 parent 5f18287 commit b8ecaa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions decoder/expr_type_declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
)

type TypeDeclaration struct {
expr hcl.Expression
cons schema.TypeDeclaration
expr hcl.Expression
cons schema.TypeDeclaration
pathCtx *PathContext
}

func (td TypeDeclaration) CompletionAtPos(ctx context.Context, pos hcl.Pos) []lang.Candidate {
Expand Down
5 changes: 3 additions & 2 deletions decoder/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ func newExpression(pathContext *PathContext, expr hcl.Expression, cons schema.Co
}
case schema.TypeDeclaration:
return TypeDeclaration{
expr: expr,
cons: c,
expr: expr,
cons: c,
pathCtx: pathContext,
}
case schema.Keyword:
return Keyword{
Expand Down

0 comments on commit b8ecaa4

Please sign in to comment.