Documentation ¶
Index ¶
- Constants
- type DirectOrigin
- type LocalOrigin
- type MatchableOrigin
- type NoOriginFound
- type NoTargetFound
- type Origin
- type OriginConstraint
- type OriginConstraints
- type Origins
- type PathOrigin
- type Target
- func (r Target) Address(ctx context.Context, pos hcl.Pos) lang.Address
- func (ref Target) Copy() Target
- func (r Target) FriendlyName() string
- func (ref Target) IsConvertibleToType(typ cty.Type) bool
- func (target Target) Matches(origin MatchableOrigin) bool
- func (target Target) MatchesConstraint(ref schema.Reference) bool
- func (ref Target) MatchesScopeId(scopeId lang.ScopeId) bool
- func (r Target) TargetRange() (hcl.Range, bool)
- type TargetWalkFunc
- type Targets
- func (refs Targets) Copy() Targets
- func (refs Targets) InnermostAtPos(file string, pos hcl.Pos) (Targets, bool)
- func (r Targets) Len() int
- func (r Targets) Less(i, j int) bool
- func (refs Targets) Match(origin MatchableOrigin) (Targets, bool)
- func (targets Targets) MatchWalk(ctx context.Context, ref schema.Reference, prefix string, ...)
- func (refs Targets) OutermostInFile(file string) Targets
- func (r Targets) Swap(i, j int)
Constants ¶
View Source
const InfiniteDepth = -1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectOrigin ¶
type DirectOrigin struct { // Range represents a range of a local traversal, attribute, or an expression Range hcl.Range // TargetPath represents what (directory) Path does the origin targets TargetPath lang.Path // TargetRange represents which file and line the origin targets TargetRange hcl.Range }
DirectOrigin represents an origin which directly targets a file and doesn't need a matching target
func (DirectOrigin) Copy ¶
func (do DirectOrigin) Copy() Origin
func (DirectOrigin) OriginRange ¶
func (do DirectOrigin) OriginRange() hcl.Range
type LocalOrigin ¶
type LocalOrigin struct { // Addr describes the resolved address of the reference Addr lang.Address // Range represents the range of the traversal Range hcl.Range // Constraints represents any traversal expression constraints // for the attribute where the origin was found. // // Further matching against decoded reference targets is needed // for >1 constraints, which is done later at runtime as // targets and origins can be decoded at different times. Constraints OriginConstraints }
LocalOrigin represents a resolved reference origin (traversal) targeting a *local* attribute or a block within the same path
func TraversalToLocalOrigin ¶
func TraversalToLocalOrigin(traversal hcl.Traversal, cons OriginConstraints, allowSelfRefs bool) (LocalOrigin, bool)
func (LocalOrigin) Address ¶
func (lo LocalOrigin) Address() lang.Address
func (LocalOrigin) AppendConstraints ¶
func (lo LocalOrigin) AppendConstraints(oc OriginConstraints) MatchableOrigin
func (LocalOrigin) Copy ¶
func (lo LocalOrigin) Copy() Origin
func (LocalOrigin) OriginConstraints ¶
func (lo LocalOrigin) OriginConstraints() OriginConstraints
func (LocalOrigin) OriginRange ¶
func (lo LocalOrigin) OriginRange() hcl.Range
type MatchableOrigin ¶
type MatchableOrigin interface { Origin OriginConstraints() OriginConstraints AppendConstraints(OriginConstraints) MatchableOrigin Address() lang.Address }
type NoOriginFound ¶
type NoOriginFound struct{}
func (*NoOriginFound) Error ¶
func (*NoOriginFound) Error() string
type NoTargetFound ¶
type NoTargetFound struct{}
func (*NoTargetFound) Error ¶
func (*NoTargetFound) Error() string
type Origin ¶
type Origin interface { Copy() Origin OriginRange() hcl.Range // contains filtered or unexported methods }
type OriginConstraints ¶
type OriginConstraints []OriginConstraint
func (OriginConstraints) Copy ¶
func (roc OriginConstraints) Copy() OriginConstraints
type PathOrigin ¶
type PathOrigin struct { // Range represents a range of a local traversal or an attribute Range hcl.Range // TargetAddr describes the address of the targeted attribute or block TargetAddr lang.Address // TargetPath represents what Path does the origin target TargetPath lang.Path // Constraints represent any constraints to use when filtering // the targets within the destination Path Constraints OriginConstraints }
PathOrigin represents a resolved reference origin targeting an attribute or a block in a separate path
func (PathOrigin) Address ¶
func (po PathOrigin) Address() lang.Address
func (PathOrigin) AppendConstraints ¶
func (po PathOrigin) AppendConstraints(oc OriginConstraints) MatchableOrigin
func (PathOrigin) Copy ¶
func (po PathOrigin) Copy() Origin
func (PathOrigin) OriginConstraints ¶
func (po PathOrigin) OriginConstraints() OriginConstraints
func (PathOrigin) OriginRange ¶
func (po PathOrigin) OriginRange() hcl.Range
type Target ¶
type Target struct { // Addr represents the address of the target, as available // elsewhere in the configuration Addr lang.Address // LocalAddr represents the address of the target // as available *locally* (e.g. self.attr_name) LocalAddr lang.Address // TargetableFromRangePtr defines where the target is targetable from. // This is considered when matching the target against origin. // // e.g. count.index is only available within the body of the block // where count is declared (and extension enabled) TargetableFromRangePtr *hcl.Range // ScopeId provides scope for matching/filtering // (in addition to Type & Addr/LocalAddr). // // There should never be two targets with the same Type & address, // but there are contexts (e.g. completion) where we don't filter // by address and may not have type either (e.g. because targets // are type-unaware). ScopeId lang.ScopeId // RangePtr represents range of the whole attribute or block // or nil if the target is not addressable. RangePtr *hcl.Range // DefRangePtr represents a definition range, i.e. block header, // or an attribute name or nil if the target is not addressable // or when it represents multiple list, set or map blocks. // // This is useful in situation where a representative single-line // range is needed - e.g. to render a contextual UI element in // the editor near the middle of this range. DefRangePtr *hcl.Range Type cty.Type Name string Description lang.MarkupContent NestedTargets Targets }
func (Target) Address ¶
Address returns any of the two non-empty addresses depending on the provided context
func (Target) FriendlyName ¶
func (Target) Matches ¶
func (target Target) Matches(origin MatchableOrigin) bool
func (Target) TargetRange ¶
type TargetWalkFunc ¶
type Targets ¶
type Targets []Target
func (Targets) InnermostAtPos ¶
func (Targets) OutermostInFile ¶
Click to show internal directories.
Click to hide internal directories.