semtok

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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
)

Jump to

Keyboard shortcuts

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