lang

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyConfigErr = &emptyCfgErr{}

Functions

func AsHCLSyntaxBlock

func AsHCLSyntaxBlock(block *hcl.Block) (*hclsyntax.Block, error)

func ParserSupportsTerraform

func ParserSupportsTerraform(v string) error

Types

type Attribute

type Attribute struct {
	// contains filtered or unexported fields
}

func (*Attribute) IsComputedOnly

func (a *Attribute) IsComputedOnly() bool

func (*Attribute) IsDeclared

func (a *Attribute) IsDeclared() bool

func (*Attribute) Range

func (a *Attribute) Range() hcl.Range

func (*Attribute) Schema

func (a *Attribute) Schema() *tfjson.SchemaAttribute

type Block

type Block interface {
	BlockAtPos(pos hcl.Pos) (Block, bool)
	Range() hcl.Range
	PosInBody(pos hcl.Pos) bool
	PosInAttribute(pos hcl.Pos) bool
	Attributes() map[string]*Attribute
	BlockTypes() map[string]*BlockType
}

Block implements an abstraction above HCL block and both tfjson's SchemaBlock & SchemaBlockType

func ParseBlock

func ParseBlock(block *hclsyntax.Block, schema *tfjson.SchemaBlock) Block

ParseBlock parses HCL configuration based on tfjson's SchemaBlock and keeps hold of all tfjson schema details on block or attribute level

type BlockType

type BlockType struct {
	BlockList []Block
	// contains filtered or unexported fields
}

func (*BlockType) BlockAtPos

func (b *BlockType) BlockAtPos(pos hcl.Pos) (Block, bool)

func (*BlockType) PosInAttribute

func (b *BlockType) PosInAttribute(pos hcl.Pos) bool

func (*BlockType) ReachedMaxItems

func (b *BlockType) ReachedMaxItems() bool

func (*BlockType) Schema

func (b *BlockType) Schema() *tfjson.SchemaBlockType

type BlockTypes

type BlockTypes map[string]*BlockType

func (BlockTypes) AddBlock

func (bt BlockTypes) AddBlock(name string, block *hclsyntax.Block, typeSchema *tfjson.SchemaBlockType)

type ConfigBlock

type ConfigBlock interface {
	CompletionItemsAtPos(pos hcl.Pos) (lsp.CompletionList, error)
	Name() string
	BlockType() string
}

type Parser

type Parser interface {
	SetLogger(*log.Logger)
	SetCapabilities(lsp.TextDocumentClientCapabilities)
	SetSchemaReader(schema.Reader)
	ParseBlockFromHCL(*hcl.Block) (ConfigBlock, error)
}

func FindCompatibleParser

func FindCompatibleParser(v string) (Parser, error)

FindCompatibleParser finds a parser that is compatible with given Terraform version, so that it parses config accuretly

Jump to

Keyboard shortcuts

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