Documentation
¶
Overview ¶
Package document encapsulates processing for HCL text documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyChanges ¶
ApplyChanges applies the supplied changes to the text supplied.
func ByteOffsetForPos ¶
ByteOffsetForPos returns the byte offset for the supplied position or an error if such a position could not be found in the supplied lines.
func IsNotFound ¶
IsNotFound returns true if the supplied error refers to a missing document.
Types ¶
type Change ¶
Change represents an edit where a specific range in a document is substituted with specific text. When no range is present, a full document change is assumed.
type DirHandle ¶
type DirHandle struct {
URI string
}
DirHandle represents a directory location
This may be received via LSP from the client (as URI) or constructed from a file path on OS FS.
func DirHandleFromPath ¶
DirHandleFromPath creates a DirHandle from a given path.
dirPath is expected to be a directory path (rather than document). It is however outside the scope of the function to verify this is actually the case or whether the directory exists.
func DirHandleFromURI ¶
DirHandleFromURI creates a DirHandle from a given URI.
dirUri is expected to be a directory URI (rather than document). It is however outside the scope of the function to verify this is actually the case or whether the directory exists.
type Document ¶
type Document struct {
Dir DirHandle // the directory where the doc lives.
Filename string // the file name.
ModTime time.Time // last modified time.
LanguageID string // language ID as supplied by the language client.
Version int // document version used to ensure edits are in sequence.
Text []byte // the text of the document as a byte slice.
Lines []source.Line // text separated into lines to enable byte offset computation for position conversions.
}
Document represents a text document of interest.
type Handle ¶
Handle represents a document location
This may be received via LSP from the client (as URI) or constructed from a file path on OS FS.
func HandleFromPath ¶
HandleFromPath creates a Handle from a given path.
docPath is expected to be a document path (rather than dir). It is however outside the scope of the function to verify this is actually the case or whether the file exists.
func HandleFromURI ¶
HandleFromURI creates a Handle from a given URI.
docURI is expected to be a document URI (rather than dir). It is however outside the scope of the function to verify this is actually the case or whether the file exists.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package diff provides facilities to represent the differences between two document texts as a sequence of document.Change records.
|
Package diff provides facilities to represent the differences between two document texts as a sequence of document.Change records. |
|
Package source provides facilities to represent text documents as a sequence of lines.
|
Package source provides facilities to represent text documents as a sequence of lines. |
|
Package store implements a store for HCL documents open in the editor and tracks unsaved changes for each of them.
|
Package store implements a store for HCL documents open in the editor and tracks unsaved changes for each of them. |