metamodel

package
v0.0.0-...-ec16dcc Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package metamodel parses and represents the LSP meta-model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enumeration

type Enumeration struct {
	Documentation string              `json:"documentation"`
	Name          string              `json:"name"`
	Type          *Type               `json:"type"`
	Members       []EnumerationMember `json:"values"`
}

Enumeration defines a named enumeration data type.

type EnumerationMember

type EnumerationMember struct {
	Documentation string `json:"documentation"`
	Name          string `json:"name"`
	Value         any    `json:"value"`
}

EnumerationMember is a member of an enumeration.

type Notification

type Notification struct {
	Documentation       string `json:"documentation"`
	Method              string `json:"method"`
	Direction           string `json:"messageDirection"`
	Params              *Type  `json:"params"`
	RegistrationMethod  string `json:"registrationMethod"`
	RegistrationOptions *Type  `json:"registrationOptions"`
}

Notification defines a JSON-RPC notification.

type Property

type Property struct {
	Documentation string `json:"documentation"`
	Name          string `json:"name"`
	Type          *Type  `json:"type"`
	Optional      bool   `json:"optional"`
}

Property is a member of a structure.

type Request

type Request struct {
	Documentation       string `json:"documentation"`
	Method              string `json:"method"`
	Direction           string `json:"messageDirection"`
	Params              *Type  `json:"params"`
	Result              *Type  `json:"result"`
	PartialResult       *Type  `json:"partialResult"`
	RegistrationMethod  string `json:"registrationMethod"`
	RegistrationOptions *Type  `json:"registrationOptions"`
}

Request defines a JSON-RPC call (request/response).

type Root

type Root struct {
	Requests      []Request      `json:"requests"`
	Notifications []Notification `json:"notifications"`
	Structures    []Structure    `json:"structures"`
	Enumerations  []Enumeration  `json:"enumerations"`
	TypeAliases   []TypeAlias    `json:"typeAliases"`
}

Root is the root of the model.

func Get

func Get() Root

Get returns the root node of the model.

type Structure

type Structure struct {
	Documentation string     `json:"documentation"`
	Name          string     `json:"name"`
	Properties    []Property `json:"properties"`
	Extends       []*Type    `json:"extends"`
	Mixins        []*Type    `json:"mixins"`
}

Structure defines a named structure data type.

func (Structure) Embeds

func (s Structure) Embeds() []*Type

Embeds returns the types that this structure embeds.

type Type

type Type struct {
	Kind         string          `json:"kind"`
	Name         string          `json:"name"`
	Items        []*Type         `json:"items"`
	ArrayElement *Type           `json:"element"`
	MapKey       *Type           `json:"key"`
	RawValue     json.RawMessage `json:"value"`
}

Type is a reference to a named type, or an inline anonymous type.

func (*Type) IsNull

func (t *Type) IsNull() bool

IsNull returns true if the type is the null type.

func (*Type) LiteralString

func (t *Type) LiteralString() string

LiteralString unserializes RawValue for use as a literal string type.

func (*Type) LiteralStructProperties

func (t *Type) LiteralStructProperties() []Property

LiteralStructProperties unserializes RawValue for use as a literal type's properties.

func (*Type) MapValue

func (t *Type) MapValue() *Type

MapValue unserializes RawValue for use as a map value.

type TypeAlias

type TypeAlias struct {
	Documentation string `json:"documentation"`
	Name          string `json:"name"`
	Type          *Type  `json:"type"`
}

TypeAlias defines a named type alias.

Jump to

Keyboard shortcuts

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