filesystem

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package filesystem implements a virtual filesystem which reflects the needs of both the language server and the HCL parser.

- creates in-memory files based on data received from the language client - allows updating in-memory files via diffs received from the language client - maintains file metadata (e.g. version, or whether it's open by the client)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDocumentMetadata added in v0.6.0

func NewDocumentMetadata(dh DocumentHandler, content []byte) *documentMetadata

func NewFilesystem

func NewFilesystem() *fsystem

func URIFromPath added in v0.2.0

func URIFromPath(path string) string

Types

type Document added in v0.6.0

type Document interface {
	DocumentHandler
	Text() ([]byte, error)
	Lines() source.Lines
	Version() int
}

type DocumentChange added in v0.6.0

type DocumentChange interface {
	Text() string
	Range() hcl.Range
}

type DocumentChanges added in v0.6.0

type DocumentChanges []DocumentChange

type DocumentHandler added in v0.6.0

type DocumentHandler interface {
	URI() string
	FullPath() string
	Dir() string
	Filename() string
}

type DocumentNotOpenErr added in v0.6.0

type DocumentNotOpenErr struct {
	DocumentHandler DocumentHandler
}

func (*DocumentNotOpenErr) Error added in v0.6.0

func (e *DocumentNotOpenErr) Error() string

type DocumentStorage added in v0.6.0

type DocumentStorage interface {
	// LS-specific methods
	CreateDocument(DocumentHandler, []byte) error
	CreateAndOpenDocument(DocumentHandler, []byte) error
	GetDocument(DocumentHandler) (Document, error)
	CloseAndRemoveDocument(DocumentHandler) error
	ChangeDocument(VersionedDocumentHandler, DocumentChanges) error
}

type Filesystem

type Filesystem interface {
	DocumentStorage

	// direct FS methods
	ReadFile(name string) ([]byte, error)
	ReadDir(name string) ([]os.FileInfo, error)
	Open(name string) (tfconfig.File, error)
}

type MetadataAlreadyExistsErr added in v0.6.0

type MetadataAlreadyExistsErr struct {
	DocumentHandler DocumentHandler
}

func (*MetadataAlreadyExistsErr) Error added in v0.6.0

func (e *MetadataAlreadyExistsErr) Error() string

type UnknownDocumentErr added in v0.6.0

type UnknownDocumentErr struct {
	DocumentHandler DocumentHandler
}

func (*UnknownDocumentErr) Error added in v0.6.0

func (e *UnknownDocumentErr) Error() string

type VersionedDocumentHandler added in v0.6.0

type VersionedDocumentHandler interface {
	DocumentHandler
	Version() int
}

Jump to

Keyboard shortcuts

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