schema

package
v0.0.0-...-d90dc4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: MPL-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveSelfRefsFromContext

func ActiveSelfRefsFromContext(ctx context.Context) bool

func WithActiveSelfRefs

func WithActiveSelfRefs(ctx context.Context) context.Context

func WithPrefillRequiredFields

func WithPrefillRequiredFields(ctx context.Context, enabled bool) context.Context

Types

type AddrStep

type AddrStep interface {
	// contains filtered or unexported methods
}

type Address

type Address []AddrStep

func (Address) AttributeValidate

func (addr Address) AttributeValidate() error

func (Address) BlockValidate

func (addr Address) BlockValidate() error

func (Address) Copy

func (addr Address) Copy() Address

type AnyExpression

type AnyExpression struct {
	// OfType defines the type which the outermost expression is constrained to
	OfType cty.Type

	// SkipLiteralComplexTypes avoids descending into complex literal types, such as {} and [].
	// It might be required when AnyExpression is used in OneOf to avoid duplicates.
	SkipLiteralComplexTypes bool
}

AnyExpression represents any expression type convertible to the given data type (OfType).

For example function call returning cty.String complies with AnyExpression{OfType: cty.String}.

func (AnyExpression) ConstraintType

func (ae AnyExpression) ConstraintType() (cty.Type, bool)

func (AnyExpression) Copy

func (ae AnyExpression) Copy() Constraint

func (AnyExpression) EmptyCompletionData

func (ae AnyExpression) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (AnyExpression) FriendlyName

func (ae AnyExpression) FriendlyName() string

type AttrNameStep

type AttrNameStep struct{}

type AttrValueStep

type AttrValueStep struct {
	Name       string
	IsOptional bool
}

type AttributeAddrSchema

type AttributeAddrSchema struct {
	// Steps describes address steps used to describe the attribute as whole.
	// The last step would typically be AttrNameStep{}.
	Steps Address

	// FriendlyName is (optional) human-readable name of the *outermost*
	// expression interpreted as reference target.
	//
	// The name is used in completion item and in hover data.
	FriendlyName string

	// ScopeId defines scope of a reference to allow for more granular
	// filtering in completion and accurate matching, which is especially
	// important for type-less reference targets (i.e. AsReference: true).
	ScopeId lang.ScopeId

	// AsExprType defines whether the value of the attribute
	// is addressable as a matching literal type constraint included
	// in attribute Expr.
	//
	// cty.DynamicPseudoType (also known as "any type") will create
	// reference of the real type if value is present else cty.DynamicPseudoType.
	AsExprType bool

	// AsReference defines whether the attribute
	// is addressable as a type-less reference
	AsReference bool
}

func (*AttributeAddrSchema) Copy

type AttributeDependent

type AttributeDependent struct {
	Name string          `json:"name"`
	Expr ExpressionValue `json:"expr"`
}

AttributeDependent represents a pair of attribute name and value used to find a dependent body schema

type AttributeSchema

type AttributeSchema struct {
	Description  lang.MarkupContent
	IsRequired   bool
	IsOptional   bool
	IsDeprecated bool
	IsComputed   bool
	IsSensitive  bool

	// Constraint represents expression constraint e.g. what types of
	// expressions are expected for the attribute
	Constraint Constraint

	// DefaultValue represents default value which applies
	// if the attribute is not declared (e.g. when looking up
	// attribute-dependent body).
	DefaultValue Default

	// IsDepKey describes whether to use this attribute (and its value)
	// as key when looking up dependent schema
	IsDepKey bool

	// Address describes whether and how the attribute itself is targetable
	Address *AttributeAddrSchema

	// OriginForTarget describes whether the attribute is treated
	// as an origin for another target (e.g. module inputs,
	// or tfvars entires in Terraform)
	OriginForTarget *PathTarget

	// SemanticTokenModifiers represents the semantic token modifiers
	// to report for the attribute name
	// (in addition to any modifiers of any parent blocks)
	SemanticTokenModifiers lang.SemanticTokenModifiers

	// CompletionHooks represent any hooks which provide
	// additional completion candidates for the attribute.
	// These are typically candidates which cannot be provided
	// via schema and come from external APIs or other sources.
	CompletionHooks lang.CompletionHooks
}

AttributeSchema describes schema for an attribute

func (*AttributeSchema) Copy

func (as *AttributeSchema) Copy() *AttributeSchema

func (*AttributeSchema) Validate

func (as *AttributeSchema) Validate() error

type BlockAddrSchema

type BlockAddrSchema struct {
	// Steps describes address steps used to describe the attribute as whole.
	// The last step would typically be LabelStep{}.
	Steps Address

	// FriendlyName is (optional) human-readable name of the block as whole
	// interpreted as reference target.
	//
	// The name is used in completion item and in hover data.
	FriendlyName string

	// ScopeId defines scope of a reference to allow for more granular
	// filtering in completion and accurate matching, which is especially
	// important for type-less reference targets (i.e. AsReference: true).
	ScopeId lang.ScopeId

	// AsReference defines whether the block itself
	// is addressable as a type-less reference
	AsReference bool

	// BodyAsData defines whether the data in the block body
	// is addressable as cty.Object or cty.List(cty.Object),
	// cty.Set(cty.Object) etc. depending on block type
	BodyAsData bool

	// InferBody defines whether (static) Body's
	// blocks and attributes are also walked
	// and their addresses inferred as data
	InferBody bool

	// BodySelfRef instructs collection of reference
	// targets with an additional self.* LocalAddr and
	// makes those targetable by origins within the block body
	// via reference.Target.TargetableFromRangePtr.
	//
	// The targetting (matching w/ origins) is further limited by
	// BodySchema.Extensions.SelfRef, where only self.* origins
	// within a body w/ SelfRef:true will be collected.
	BodySelfRef bool

	// AsTypeOf makes the block addressable based on type
	// of an attribute
	AsTypeOf *BlockAsTypeOf

	// DependentBodyAsData defines whether the data in
	// the dependent block body is addressable as cty.Object
	// or cty.List(cty.Object), cty.Set(cty.Object) etc.
	// depending on block type
	DependentBodyAsData bool

	// InferDependentBody defines whether DependentBody's
	// blocks and attributes are also walked
	// and their addresses inferred as data
	InferDependentBody bool

	// DependentBodySelfRef instructs collection of reference
	// targets with an additional self.* LocalAddr and
	// makes those targetable by origins within the block body
	// via reference.Target.TargetableFromRangePtr.
	//
	// The targetting (matching w/ origins) is further limited by
	// BodySchema.Extensions.SelfRef, where only self.* origins
	// within a body w/ SelfRef:true will be collected.
	DependentBodySelfRef bool
}

func (*BlockAddrSchema) Copy

func (bas *BlockAddrSchema) Copy() *BlockAddrSchema

func (*BlockAddrSchema) Validate

func (bas *BlockAddrSchema) Validate() error

type BlockAsTypeOf

type BlockAsTypeOf struct {
	// AttributeExpr defines whether the block
	// is addressable as a particular type declared
	// directly as expression of the attribute
	AttributeExpr string
}

func (*BlockAsTypeOf) Copy

func (bato *BlockAsTypeOf) Copy() *BlockAsTypeOf

type BlockSchema

type BlockSchema struct {
	Labels []*LabelSchema
	Type   BlockType

	// SemanticTokenModifiers represents the semantic token modifiers
	// to report for the block's type and labels
	// (in addition to any modifiers of any parent blocks)
	SemanticTokenModifiers lang.SemanticTokenModifiers

	// Body represents the body within block
	// such as attributes and nested blocks
	Body *BodySchema

	// DependentBody represents any "dynamic parts" of the body
	// depending on SchemaKey (labels or attributes)
	DependentBody map[SchemaKey]*BodySchema

	Description  lang.MarkupContent
	IsDeprecated bool
	MinItems     uint64
	MaxItems     uint64

	Address *BlockAddrSchema
}

AttributeSchema describes schema for a block e.g. "resource" or "provider" in Terraform

func (*BlockSchema) Copy

func (bs *BlockSchema) Copy() *BlockSchema

func (*BlockSchema) Validate

func (bSchema *BlockSchema) Validate() error

type BlockType

type BlockType uint

BlockType tells a decoder how to interpret instance(s) of a block

Types reflect hcldec.Block*Spec types and terraform-json's SchemaNestingMode

const (
	BlockTypeNil BlockType = iota
	BlockTypeList
	BlockTypeMap
	BlockTypeObject
	BlockTypeSet
)

func (BlockType) GoString

func (t BlockType) GoString() string

func (BlockType) String

func (t BlockType) String() string

type BodyExtensions

type BodyExtensions struct {
	Count         bool // count attribute + count.index refs
	ForEach       bool // for_each attribute + each.* refs
	DynamicBlocks bool // dynamic "block-name" w/ content & for_each inside
	SelfRefs      bool // self.* refs
}

func (*BodyExtensions) Copy

func (be *BodyExtensions) Copy() *BodyExtensions

type BodySchema

type BodySchema struct {
	Blocks     map[string]*BlockSchema
	Attributes map[string]*AttributeSchema

	// AnyAttribute represents an attribute where a user can pick any arbitrary
	// name, but the attributes have the same schema
	// e.g. `required_providers` block in Terraform
	AnyAttribute *AttributeSchema
	IsDeprecated bool
	Detail       string
	Description  lang.MarkupContent

	// DocsLink represents a link to docs that will be exposed
	// as part of LinksInFile()
	DocsLink *DocsLink

	// HoverURL represents a URL that will be appended to the end
	// of hover data in HoverAtPos(). This can differ from DocsLink,
	// but often will match.
	HoverURL string

	// TargetableAs represents how else the body may be targeted
	// if not by its declarable attributes or blocks.
	TargetableAs Targetables

	// Targets represent a location targeted by the body; when used as a body
	// dependent on an attribute (e.g., Terraform module source)
	Targets *Target

	// ImpliedOrigins represent a list of origins we should revisit during
	// reference origin collection. For example, module outputs can be
	// referenced from still unknown locations during the build of the module
	// schema.
	ImpliedOrigins ImpliedOrigins

	// Extensions represents any HCL extensions supported in this body
	Extensions *BodyExtensions
}

BodySchema describes schema of a body comprised of blocks or attributes (if any), where body can be root or body of any block in the hierarchy.

func NewBodySchema

func NewBodySchema() *BodySchema

NewBodySchema creates a new BodySchema instance

func (*BodySchema) AttributeNames

func (as *BodySchema) AttributeNames() []string

func (*BodySchema) BlockTypes

func (as *BodySchema) BlockTypes() []string

func (*BodySchema) Copy

func (bs *BodySchema) Copy() *BodySchema

func (*BodySchema) ToHCLSchema

func (bs *BodySchema) ToHCLSchema() *hcl.BodySchema

func (*BodySchema) Validate

func (bs *BodySchema) Validate() error

type CompletionData

type CompletionData struct {
	NewText string

	// Snippet represents text to be inserted via text edits,
	// with snippet placeholder identifiers such as ${1} (if any) starting
	// from given nextPlaceholder (provided as arg to EmptyCompletionData).
	Snippet string

	TriggerSuggest  bool
	NextPlaceholder int
}

type Constraint

type Constraint interface {
	FriendlyName() string
	Copy() Constraint

	// EmptyCompletionData provides completion data in context where
	// there is no corresponding configuration, such as when the Constraint
	// is part of another and it is desirable to complete
	// the parent constraint as whole.
	EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData
	// contains filtered or unexported methods
}

type ConstraintWithHoverData

type ConstraintWithHoverData interface {
	// EmptyHoverData provides hover data in context where there is
	// no corresponding configuration, such as when the Constraint
	// is part of another and more detailed hover data is requested
	// for the parent.
	//
	// This enables e.g. rendering attributes under Object rather
	// than just "object".
	EmptyHoverData(nestingLevel int) *HoverData
}

type Constraints

type Constraints struct {
	ScopeId lang.ScopeId
	Type    cty.Type
}

type Default

type Default interface {
	// contains filtered or unexported methods
}

type DefaultValue

type DefaultValue struct {
	Value cty.Value
}

type DependencyKey

type DependencyKey interface {
	// contains filtered or unexported methods
}

DependencyKey represents a key used to find a dependent body schema

type DependencyKeys

type DependencyKeys struct {
	Labels     []LabelDependent     `json:"labels,omitempty"`
	Attributes []AttributeDependent `json:"attrs,omitempty"`
}

DependencyKeys represent values of labels or attributes on which BodySchema depends on.

e.g. resource or data block in Terraform

func (DependencyKeys) MarshalJSON

func (dk DependencyKeys) MarshalJSON() ([]byte, error)
type DocsLink struct {
	URL     string
	Tooltip string
}

func (*DocsLink) Copy

func (dl *DocsLink) Copy() *DocsLink

type ExpressionValue

type ExpressionValue struct {
	Static  cty.Value
	Address lang.Address
}

ExpressionValue represents static value or a reference used to find a dependent body schema

func (ExpressionValue) MarshalJSON

func (ev ExpressionValue) MarshalJSON() ([]byte, error)

type FunctionSignature

type FunctionSignature struct {
	// Description is an optional human-readable description
	// of the function.
	Description string

	Detail string

	// ReturnType is the ctyjson representation of the function's
	// return types based on supplying all parameters using
	// dynamic types. Functions can have dynamic return types.
	ReturnType cty.Type

	// Params describes the function's fixed positional parameters.
	Params []function.Parameter

	// VarParam describes the function's variadic
	// parameter if it is supported.
	VarParam *function.Parameter
}

func (*FunctionSignature) Copy

type HoverData

type HoverData struct {
	Content lang.MarkupContent
}

type ImpliedOrigin

type ImpliedOrigin struct {
	OriginAddress lang.Address

	TargetAddress lang.Address
	Path          lang.Path
	Constraints   Constraints
}

func (ImpliedOrigin) Copy

func (io ImpliedOrigin) Copy() ImpliedOrigin

type ImpliedOrigins

type ImpliedOrigins []ImpliedOrigin

type Keyword

type Keyword struct {
	// Keyword defines the literal keyword
	Keyword string

	// Name overrides friendly name of the constraint
	Name string

	// Description defines description of the keyword
	Description lang.MarkupContent
}

Keyword represents a keyword, represented as hcl.Traversal of a single segment.

func (Keyword) Copy

func (k Keyword) Copy() Constraint

func (Keyword) EmptyCompletionData

func (k Keyword) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (Keyword) FriendlyName

func (k Keyword) FriendlyName() string

type LabelDependent

type LabelDependent struct {
	Index int    `json:"index"`
	Value string `json:"value"`
}

LabelDependent represents a pair of label index and value used to find a dependent body schema

type LabelSchema

type LabelSchema struct {
	Name        string
	Description lang.MarkupContent

	// SemanticTokenModifier represents the semantic token modifier
	// (if any) to report for the label (in addition to any block modifiers)
	SemanticTokenModifiers lang.SemanticTokenModifiers

	// IsDepKey describes whether to use this label as key
	// when looking up dependent schema
	IsDepKey bool

	// In cases where label's IsDepKey=true any DependentKey label values
	// within Blocks's DependentBody can be used for completion
	// This enables such behaviour.
	Completable bool
}

LabelSchema describes schema for a label on a particular position

func (*LabelSchema) Copy

func (ls *LabelSchema) Copy() *LabelSchema

type LabelStep

type LabelStep struct {
	Index uint
}

type List

type List struct {
	// Elem defines constraint to apply to each item
	Elem Constraint

	// Description defines description of the whole list (affects hover)
	Description lang.MarkupContent

	// MinItems defines minimum number of items (affects completion)
	MinItems uint64

	// MaxItems defines maximum number of items (affects completion)
	MaxItems uint64
}

List represents a list, equivalent of hclsyntax.TupleConsExpr interpreted as list, i.e. ordering of item (which are all of the same type) matters.

func (List) ConstraintType

func (l List) ConstraintType() (cty.Type, bool)

func (List) Copy

func (l List) Copy() Constraint

func (List) EmptyCompletionData

func (l List) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (List) EmptyHoverData

func (l List) EmptyHoverData(nestingLevel int) *HoverData

func (List) FriendlyName

func (l List) FriendlyName() string

type LiteralType

type LiteralType struct {
	Type cty.Type

	// SkipComplexTypes avoids descending into complex literal types, such as {} and [].
	// It might be required when LiteralType is used in OneOf to avoid duplicates.
	SkipComplexTypes bool
}

LiteralType represents literal type constraint e.g. any literal string ("foo"), number (42), etc.

Non-literal expressions (even if these evaluate to the given type) are excluded.

Complex types are supported, but dedicated List, Set, Map and other types are preferred, as these can convey more details, such as description, unlike e.g. LiteralType{Type: cty.List(...)}.

func (LiteralType) ConstraintType

func (lt LiteralType) ConstraintType() (cty.Type, bool)

func (LiteralType) Copy

func (lt LiteralType) Copy() Constraint

func (LiteralType) EmptyCompletionData

func (lt LiteralType) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (LiteralType) EmptyHoverData

func (lt LiteralType) EmptyHoverData(nestingLevel int) *HoverData

func (LiteralType) FriendlyName

func (lt LiteralType) FriendlyName() string

func (LiteralType) Validate

func (lt LiteralType) Validate() error

type LiteralValue

type LiteralValue struct {
	Value cty.Value

	// IsDeprecated defines whether the value is deprecated
	IsDeprecated bool

	// Description defines description of the value
	Description lang.MarkupContent
}

LiteralValue represents a literal value, as defined by Value with additional metadata.

func (LiteralValue) ConstraintType

func (lv LiteralValue) ConstraintType() (cty.Type, bool)

func (LiteralValue) Copy

func (lv LiteralValue) Copy() Constraint

func (LiteralValue) EmptyCompletionData

func (lv LiteralValue) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (LiteralValue) EmptyHoverData

func (lv LiteralValue) EmptyHoverData(nestingLevel int) *HoverData

func (LiteralValue) FriendlyName

func (lv LiteralValue) FriendlyName() string

type Map

type Map struct {
	// Elem defines constraint to apply to each item of the map
	Elem Constraint

	// Name overrides friendly name of the constraint
	Name string

	// Description defines description of the whole map (affects hover)
	Description lang.MarkupContent

	// MinItems defines minimum number of items (affects completion)
	MinItems uint64

	// MaxItems defines maximum number of items (affects completion)
	MaxItems uint64

	// AllowInterpolatedKeys determines whether the key names can be
	// interpolated (true) or static (literal strings only).
	AllowInterpolatedKeys bool
}

Map represents a map, equivalent of hclsyntax.ObjectConsExpr interpreted as map, i.e. with items of unknown keys and same value types.

func (Map) ConstraintType

func (m Map) ConstraintType() (cty.Type, bool)

func (Map) Copy

func (m Map) Copy() Constraint

func (Map) EmptyCompletionData

func (m Map) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (Map) EmptyHoverData

func (m Map) EmptyHoverData(nestingLevel int) *HoverData

func (Map) FriendlyName

func (m Map) FriendlyName() string

type Object

type Object struct {
	// Attributes defines names and constraints of attributes within the object
	Attributes ObjectAttributes

	// Name overrides friendly name of the constraint
	Name string

	// Description defines description of the whole object (affects hover)
	Description lang.MarkupContent

	// AllowInterpolatedKeys determines whether the attribute names can be
	// interpolated (true) or static (literal strings only).
	AllowInterpolatedKeys bool
}

Object represents an object, equivalent of hclsyntax.ObjectConsExpr interpreted as object, i.e. with items of known keys and different value types.

func (Object) ConstraintType

func (o Object) ConstraintType() (cty.Type, bool)

func (Object) Copy

func (o Object) Copy() Constraint

func (Object) EmptyCompletionData

func (o Object) EmptyCompletionData(ctx context.Context, placeholder int, nestingLevel int) CompletionData

func (Object) EmptyHoverData

func (o Object) EmptyHoverData(nestingLevel int) *HoverData

func (Object) FriendlyName

func (o Object) FriendlyName() string

type ObjectAttributes

type ObjectAttributes map[string]*AttributeSchema

func (ObjectAttributes) Copy

type OneOf

type OneOf []Constraint

OneOf represents multiple constraints where any one of them is acceptable.

func (OneOf) ConstraintType

func (o OneOf) ConstraintType() (cty.Type, bool)

func (OneOf) Copy

func (o OneOf) Copy() Constraint

func (OneOf) EmptyCompletionData

func (o OneOf) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (OneOf) FriendlyName

func (o OneOf) FriendlyName() string

func (OneOf) Validate

func (o OneOf) Validate() error

type PathTarget

type PathTarget struct {
	Address     Address
	Path        lang.Path
	Constraints Constraints
}

func (*PathTarget) Copy

func (pt *PathTarget) Copy() *PathTarget

type Reference

type Reference struct {
	// OfScopeId defines scope of a type-less reference
	OfScopeId lang.ScopeId

	// OfType defines the type of a type-aware reference
	OfType cty.Type

	// Name overrides friendly name of the constraint
	Name string

	// Address (if not nil) makes the reference
	// itself addressable and provides scope
	// for the decoded reference.
	//
	// Only one of Address or OfScopeId/OfType can be declared
	Address *ReferenceAddrSchema
}

Reference represents a reference (equivalent of hcl.Traversal), i.e. the dot-separated address such as var.foobar of a given scope (type-less) or type (type-aware).

func (Reference) Copy

func (ref Reference) Copy() Constraint

func (Reference) EmptyCompletionData

func (ref Reference) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (Reference) FriendlyName

func (ref Reference) FriendlyName() string

func (Reference) Validate

func (ref Reference) Validate() error

type ReferenceAddrSchema

type ReferenceAddrSchema struct {
	ScopeId lang.ScopeId
}

func (*ReferenceAddrSchema) Copy

type Schema

type Schema interface {
	// contains filtered or unexported methods
}

Schema represents any schema (e.g. attribute, label, or a block)

type SchemaKey

type SchemaKey string

SchemaKey represents marshalled DependencyKeys which can be created using NewSchemaKey()

func NewSchemaKey

func NewSchemaKey(keys DependencyKeys) SchemaKey

NewSchemaKey creates a marshalled form of DependencyKeys to be used inside a map of BlockSchema's DependentBody

type Set

type Set struct {
	// Elem defines constraint to apply to each item
	Elem Constraint

	// Description defines description of the whole list (affects hover)
	Description lang.MarkupContent

	// MinItems defines minimum number of items (affects completion)
	MinItems uint64

	// MaxItems defines maximum number of items (affects completion)
	MaxItems uint64
}

Set represents a set, equivalent of hclsyntax.TupleConsExpr interpreted as set, i.e. ordering of items (which are all of the same type) does not matter.

func (Set) ConstraintType

func (s Set) ConstraintType() (cty.Type, bool)

func (Set) Copy

func (s Set) Copy() Constraint

func (Set) EmptyCompletionData

func (s Set) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (Set) EmptyHoverData

func (s Set) EmptyHoverData(nestingLevel int) *HoverData

func (Set) FriendlyName

func (s Set) FriendlyName() string

type StaticStep

type StaticStep struct {
	Name string
}

type Target

type Target struct {
	Path  lang.Path
	Range hcl.Range
}

func (*Target) Copy

func (t *Target) Copy() *Target

type Targetable

type Targetable struct {
	Address      lang.Address
	ScopeId      lang.ScopeId
	AsType       cty.Type
	IsSensitive  bool
	FriendlyName string
	Description  lang.MarkupContent

	NestedTargetables Targetables
}

func (*Targetable) Copy

func (tb *Targetable) Copy() *Targetable

type Targetables

type Targetables []*Targetable

func NestedTargetablesForValue

func NestedTargetablesForValue(address lang.Address, scopeId lang.ScopeId, val cty.Value) Targetables

func (Targetables) Len

func (ts Targetables) Len() int

func (Targetables) Less

func (ts Targetables) Less(i, j int) bool

func (Targetables) Swap

func (ts Targetables) Swap(i, j int)

type Tuple

type Tuple struct {
	// Elems defines constraints to apply to each individual item
	// in the same order they would appear in the tuple
	Elems []Constraint

	// Description defines description of the whole tuple (affects hover)
	Description lang.MarkupContent
}

Tuple represents a tuple, equivalent of hclsyntax.TupleConsExpr interpreted as tuple, i.e. collection of items where each one is of different type.

func (Tuple) ConstraintType

func (t Tuple) ConstraintType() (cty.Type, bool)

func (Tuple) Copy

func (t Tuple) Copy() Constraint

func (Tuple) EmptyCompletionData

func (t Tuple) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (Tuple) EmptyHoverData

func (t Tuple) EmptyHoverData(nestingLevel int) *HoverData

func (Tuple) FriendlyName

func (t Tuple) FriendlyName() string

type TypeAwareConstraint

type TypeAwareConstraint interface {
	ConstraintType() (cty.Type, bool)
}

TypeAwareConstraint represents a constraint which may be type-aware. Most constraints which implement this are always type-aware, but for some this is runtime concern depending on the configuration.

This makes it comparable to another type for conformity during completion and it enables collection of type-aware reference target, if the attribute itself is targetable as type-aware.

type TypeDeclaration

type TypeDeclaration struct {
}

TypeDeclaration represents a type declaration as interpreted by HCL's ext/typeexpr package, i.e. declaration of cty.Type in HCL

func (TypeDeclaration) Copy

func (td TypeDeclaration) Copy() Constraint

func (TypeDeclaration) EmptyCompletionData

func (td TypeDeclaration) EmptyCompletionData(ctx context.Context, nextPlaceholder int, nestingLevel int) CompletionData

func (TypeDeclaration) FriendlyName

func (td TypeDeclaration) FriendlyName() string

type Validatable

type Validatable interface {
	Validate() error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL