Skip to content

Commit

Permalink
decoder: Add support for TypeDeclaration as Constraint (#183)
Browse files Browse the repository at this point in the history
* Introduce PathContext to TypeDeclaration

This is required in order to recover bytes of incomplete configuration during completion.

* decoder: Implement completion for TypeDeclaration

* decoder: Implement hover for TypeDeclaration

* add tests

---------

Co-authored-by: James Pogran <[email protected]>
  • Loading branch information
radeksimko and jpogran authored Mar 22, 2023
1 parent 8544b6d commit 7d15ebe
Show file tree
Hide file tree
Showing 8 changed files with 2,369 additions and 20 deletions.
23 changes: 5 additions & 18 deletions decoder/expr_type_declaration.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
package decoder

import (
"context"

"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/schema"
"github.com/hashicorp/hcl/v2"
)

type TypeDeclaration struct {
expr hcl.Expression
cons schema.TypeDeclaration
}

func (td TypeDeclaration) CompletionAtPos(ctx context.Context, pos hcl.Pos) []lang.Candidate {
// TODO
return nil
}

func (td TypeDeclaration) HoverAtPos(ctx context.Context, pos hcl.Pos) *lang.HoverData {
// TODO
return nil
expr hcl.Expression
cons schema.TypeDeclaration
pathCtx *PathContext
}

func (td TypeDeclaration) SemanticTokens(ctx context.Context) []lang.SemanticToken {
// TODO
return nil
func isTypeNameWithElementOnly(name string) bool {
return name == "list" || name == "set" || name == "map"
}
Loading

0 comments on commit 7d15ebe

Please sign in to comment.