Documentation
¶
Overview ¶
Package target provides definition and reference information for a function-hcl module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SchemaForRelativeTraversal ¶
func SchemaForRelativeTraversal(root *schema.AttributeSchema, traversal hcl.Traversal) (ret *schema.AttributeSchema)
SchemaForRelativeTraversal returns the child schema implied by the root schema and the supplied traversal. The traversal does not have to be a relative traversal; an absolute one is also ok. It returns an unknown schema if a schema could not be found.
func SubSchema ¶
func SubSchema(s *schema.AttributeSchema, path ...string) *schema.AttributeSchema
SubSchema returns a known schema at the supplied path relative to the supplied root schema. It returns an unknown schema if one could not be found.
Types ¶
type Node ¶
type Node struct {
Name string // the name using which the node is referenced
IsContainer bool // container node that has an implied schema of "any object"
Schema *schema.AttributeSchema // the schema for non-container nodes
NameRange hcl.Range // the range where the name of the node is declared
Definition hcl.Range // the range where the node is defined
Children []*Node // the child nodes of this one.
}
Node represents a specific leaf or intermediate target in a target tree.
func (*Node) AsSchema ¶
func (n *Node) AsSchema() *schema.AttributeSchema
type ReferenceMap ¶
ReferenceMap provides mappings between definitions and references in both directions.
func BuildReferenceMap ¶
func BuildReferenceMap(files map[string]*hcl.File, targets *Targets) *ReferenceMap
BuildReferenceMap builds the reference map for a module.
func (*ReferenceMap) FindDefinitionFromReference ¶
FindDefinitionFromReference returns the definition range for a reference range that includes the supplied position.
func (*ReferenceMap) FindReferencesFromDefinition ¶
FindReferencesFromDefinition returns reference ranges for a definition range that includes the supplied position.
type Targets ¶
type Targets struct {
CompositeSchema *schema.AttributeSchema // the schema used for the composite or nil
// contains filtered or unexported fields
}
Targets provides a mechanism to find all accessible symbols at a given position. It contains a global tree for references that are accessible globally (e.g. file-scoped variables, req.composite etc.) and stores extra information for block scoped locals, self aliases for resources and collections. Given a position in a file, these extras allow construction of a "visible" tree that contains all accessible references from that position.
func BuildTargets ¶
func BuildTargets(files map[string]*hcl.File, dyn ourschema.DynamicLookup, compositeSchema *schema.AttributeSchema) *Targets
BuildTargets builds targets for a module.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a tree of nodes accessible in a given scope.
func (*Tree) AsSchema ¶
func (t *Tree) AsSchema() *schema.AttributeSchema
AsSchema returns the contents of the tree as an attribute schema of a top-level object that represents the tree as a whole.