Documentation
¶
Index ¶
- Variables
- func AsHCLSyntaxBlock(block *hcl.Block) (*hclsyntax.Block, error)
- func PosInLabels(b *hclsyntax.Block, pos hcl.Pos) bool
- type Attribute
- type Block
- type BlockType
- type BlockTypes
- type CompletionCandidate
- type CompletionCandidates
- type ConfigBlock
- type Label
- type LabelSchema
- type Markdown
- type MarkupContent
- type ParsedLabel
- type Parser
- type PlainText
- type TextEdit
- type TokenAtPosLooker
- type UnknownProviderErr
Constants ¶
This section is empty.
Variables ¶
var EmptyConfigErr = &emptyCfgErr{}
Functions ¶
func PosInLabels ¶ added in v0.3.0
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
func (*Attribute) IsComputedOnly ¶
func (*Attribute) IsDeclared ¶
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
PosInAttributeValue(pos hcl.Pos) bool
Attributes() map[string]*Attribute
BlockTypes() map[string]*BlockType
}
Block represents a decoded HCL block (by a Parser) which keeps track of the related schema
func ParseBlock ¶
func ParseBlock(tBlock ihcl.TokenizedBlock, schema *tfjson.SchemaBlock) Block
ParseBlock parses HCL block's tokens 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) PosInAttributeValue ¶ added in v0.5.3
func (*BlockType) ReachedMaxItems ¶
func (*BlockType) Schema ¶
func (b *BlockType) Schema() *tfjson.SchemaBlockType
type BlockTypes ¶
func (BlockTypes) AddBlock ¶
func (bt BlockTypes) AddBlock(name string, block *hclsyntax.Block, typeSchema *tfjson.SchemaBlockType)
type CompletionCandidate ¶ added in v0.2.0
type CompletionCandidate interface {
Label() string
Detail() string
Documentation() MarkupContent
Snippet() TextEdit
PlainText() TextEdit
}
CompletionCandidate represents a candidate for completion loosely reflecting lsp.CompletionItem
type CompletionCandidates ¶ added in v0.2.0
type CompletionCandidates interface {
List() []CompletionCandidate
Len() int
IsComplete() bool
}
CompletionCandidates represents a list of candidates for completion loosely reflecting lsp.CompletionList
type ConfigBlock ¶
type ConfigBlock interface {
CompletionCandidatesAtPos(pos hcl.Pos) (CompletionCandidates, error)
Name() string
BlockType() string
Labels() []*ParsedLabel
}
ConfigBlock implements an abstraction above HCL block which provides any LSP capabilities (e.g. completion)
type LabelSchema ¶ added in v0.2.0
type LabelSchema []Label
type Markdown ¶ added in v0.3.0
type Markdown string
Markdown represents markdown formatted markup content for the LSP.
type MarkupContent ¶ added in v0.3.0
type MarkupContent interface {
// TODO: eventually will need to propapate Kind here once the LSP
// protocol types we use support it
Value() string
}
MarkupContent reflects lsp.MarkupContent
type ParsedLabel ¶ added in v0.3.0
func LabelAtPos ¶ added in v0.3.0
func LabelAtPos(labels []*ParsedLabel, pos hcl.Pos) (*ParsedLabel, bool)
func ParseLabels ¶ added in v0.3.0
func ParseLabels(tBlock ihcl.TokenizedBlock, schema LabelSchema) []*ParsedLabel
ParseLabels parses HCL block's tokens based on LabelSchema, returning labels as a slice of *ParsedLabel
type Parser ¶
type Parser interface {
SetLogger(*log.Logger)
SetSchemaReader(schema.Reader)
SetProviderReferences(addrs.ProviderReferences)
BlockTypeCandidates(ihcl.TokenizedFile, hcl.Pos) CompletionCandidates
CompletionCandidatesAtPos(ihcl.TokenizedFile, hcl.Pos) (CompletionCandidates, error)
}
Parser implements a parser which can turn raw HCL block into ConfigBlock with the help of a schema reader
func FindCompatibleParser ¶
FindCompatibleParser finds a parser that is compatible with given Terraform version, so that it parses config accuretly
type PlainText ¶ added in v0.3.0
type PlainText string
PlainText represents plain text markup content for the LSP.
type TokenAtPosLooker ¶ added in v0.3.0
type UnknownProviderErr ¶ added in v0.6.0
type UnknownProviderErr struct{}
func (*UnknownProviderErr) Error ¶ added in v0.6.0
func (e *UnknownProviderErr) Error() string