Documentation
¶
Overview ¶
Package semantic provides semantic token analysis for syntax highlighting.
It generates semantic tokens following the LSP specification, enabling editors to provide accurate syntax highlighting based on the semantic meaning of code elements rather than just lexical patterns.
Package semantic provides semantic token support for LSP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Legend ¶
Legend describes available token types and modifiers.
func DefaultLegend ¶
func DefaultLegend() *Legend
DefaultLegend returns the standard legend for our semantic tokens.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider computes semantic tokens for a file.
func NewProvider ¶
func NewProvider(symbols *index.SymbolIndex) *Provider
NewProvider creates a semantic tokens provider.
func (*Provider) TokensFull ¶
TokensFull returns all semantic tokens for a file.
type Token ¶
type Token struct {
Span diag.Span
Type TokenType
Modifiers TokenModifier
}
Token represents a single semantic token.
type TokenModifier ¶
type TokenModifier uint32
TokenModifier represents semantic token modifiers as a bitmask.
const ( ModDeclaration TokenModifier = 1 << iota ModDefinition ModReadonly ModStatic ModDeprecated ModAbstract ModAsync ModModification ModDocumentation ModDefaultLibrary // Custom modifiers for Lua ModPure // function is pure (no side effects) ModEscapes // variable escapes its scope ModUnused // variable is unused ModMutable // variable is mutated )