Documentation ¶
Overview ¶
Package template contains code for dealing with templates
Index ¶
- Variables
- func Completion(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) (*protocol.CompletionList, error)
- func Definition(snapshot *cache.Snapshot, fh file.Handle, loc protocol.Position) ([]protocol.Location, error)
- func Diagnostics(snapshot *cache.Snapshot) map[protocol.DocumentURI][]*cache.Diagnostic
- func DocumentSymbols(snapshot *cache.Snapshot, fh file.Handle) ([]protocol.DocumentSymbol, error)
- func Highlight(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) ([]protocol.DocumentHighlight, error)
- func Hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) (*protocol.Hover, error)
- func References(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, ...) ([]protocol.Location, error)
- func SemanticTokens(ctx context.Context, snapshot *cache.Snapshot, spn protocol.DocumentURI) (*protocol.SemanticTokens, error)
- type All
- type Parsed
- func (p *Parsed) FindLiteralBefore(pos int) (int, int)
- func (p *Parsed) FromPosition(x protocol.Position) int
- func (p *Parsed) LineCol(x int) (uint32, uint32)
- func (p *Parsed) Position(pos int) protocol.Position
- func (p *Parsed) Range(x, length int) protocol.Range
- func (p *Parsed) RuneCount(l, s, e uint32) uint32
- func (p *Parsed) SymsAtPos(pos int) []symbol
- func (p *Parsed) TokenSize(t Token) (int, error)
- func (p *Parsed) Tokens() []Token
- func (p *Parsed) WriteNode(w io.Writer, n parse.Node)
- type Token
Constants ¶
This section is empty.
Variables ¶
var ( Left = []byte("{{") Right = []byte("}}") )
Functions ¶
func Completion ¶
func Definition ¶
func Definition(snapshot *cache.Snapshot, fh file.Handle, loc protocol.Position) ([]protocol.Location, error)
Definition finds the definitions of the symbol at loc. It does not understand scoping (if any) in templates. This code is for definitions, type definitions, and implementations. Results only for variables and templates.
func Diagnostics ¶
func Diagnostics(snapshot *cache.Snapshot) map[protocol.DocumentURI][]*cache.Diagnostic
Diagnostics returns parse errors. There is only one per file. The errors are not always helpful. For instance { {end}} will likely point to the end of the file.
func DocumentSymbols ¶
DocumentSymbols returns a hierarchy of the symbols defined in a template file. (The hierarchy is flat. SymbolInformation might be better.)
func References ¶
func SemanticTokens ¶
func SemanticTokens(ctx context.Context, snapshot *cache.Snapshot, spn protocol.DocumentURI) (*protocol.SemanticTokens, error)
Types ¶
type All ¶
type All struct {
// contains filtered or unexported fields
}
All contains the Parse of all the template files
type Parsed ¶
type Parsed struct { ParseErr error // contains filtered or unexported fields }
func (*Parsed) FindLiteralBefore ¶
FindLiteralBefore locates the first preceding string literal returning its position and length in buf or returns -1 if there is none. Assume double-quoted string rather than backquoted string for now.
func (*Parsed) FromPosition ¶
FromPosition translates a protocol.Position into an offset into the template
func (*Parsed) LineCol ¶
LineCol converts from a 0-based byte offset to 0-based line, col. col in runes