package semtok

import "cuelang.org/go/internal/golangorgx/gopls/protocol/semtok"

The semtok package provides an encoder for LSP's semantic tokens.

Index

Functions

func Encode

func Encode(
	tokens []Token,
	noStrings, noNumbers bool,
	types, modifiers []string) []uint32

Encode returns the LSP encoding of a sequence of tokens. The noStrings, noNumbers options cause strings, numbers to be skipped. The lists of types and modifiers determines the bitfield encoding.

Types

type Token

type Token struct {
	Line, Start uint32
	Len         uint32
	Type        TokenType
	Modifiers   []string
}

A Token provides the extent and semantics of a token.

type TokenType

type TokenType string
const (
	TokNamespace TokenType = "namespace"
	TokType      TokenType = "type"
	TokInterface TokenType = "interface"
	TokTypeParam TokenType = "typeParameter"
	TokParameter TokenType = "parameter"
	TokVariable  TokenType = "variable"
	TokMethod    TokenType = "method"
	TokFunction  TokenType = "function"
	TokKeyword   TokenType = "keyword"
	TokComment   TokenType = "comment"
	TokString    TokenType = "string"
	TokNumber    TokenType = "number"
	TokOperator  TokenType = "operator"
	TokMacro     TokenType = "macro" // for templates
)

Source Files

semtok.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
8 hours ago

Tools for package owners.