lsp

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lsp is the SIML language server: diagnostics, completion, hover, navigation, rename, outline, folding, semantic tokens, formatting and code actions for every *.siml file, and the requests the rotation panel of the VS Code extension makes (siml/rotation, siml/pathAt, siml/registered, siml/splice, siml/database, siml/patterns, siml/insertPattern, siml/sim). It speaks JSON-RPC over a stream, and reads the name table and the item database from the repository each file sits in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(in io.Reader, out io.Writer, opts Options) (shutdownRequested bool, err error)

Serves the protocol on in and out until the client sends exit or in ends. The result says whether shutdown came first, as the exit code should.

Types

type CodeAction

type CodeAction struct {
	Title       string         `json:"title"`
	Kind        string         `json:"kind"`
	Diagnostics []Diagnostic   `json:"diagnostics,omitempty"`
	IsPreferred bool           `json:"isPreferred,omitempty"`
	Edit        *WorkspaceEdit `json:"edit,omitempty"`
	Command     *Command       `json:"command,omitempty"`
}

type CodeLens

type CodeLens struct {
	Range   Range    `json:"range"`
	Command *Command `json:"command,omitempty"`
}

type Command

type Command struct {
	Title     string `json:"title"`
	Command   string `json:"command"`
	Arguments []any  `json:"arguments,omitempty"`
}

type CompletionItem

type CompletionItem struct {
	Label            string         `json:"label"`
	Kind             int            `json:"kind,omitempty"`
	Detail           string         `json:"detail,omitempty"`
	Documentation    *MarkupContent `json:"documentation,omitempty"`
	SortText         string         `json:"sortText,omitempty"`
	FilterText       string         `json:"filterText,omitempty"`
	InsertText       string         `json:"insertText,omitempty"`
	InsertTextFormat int            `json:"insertTextFormat,omitempty"`
	TextEdit         *TextEdit      `json:"textEdit,omitempty"`
	Command          *Command       `json:"command,omitempty"`
}

type Diagnostic

type Diagnostic struct {
	Range    Range  `json:"range"`
	Severity int    `json:"severity"`
	Code     string `json:"code,omitempty"`
	Source   string `json:"source"`
	Message  string `json:"message"`

	RelatedInformation []RelatedInformation `json:"relatedInformation,omitempty"`
}
type DocumentLink struct {
	Range  Range  `json:"range"`
	Target string `json:"target"`
}

type DocumentSymbol

type DocumentSymbol struct {
	Name           string           `json:"name"`
	Detail         string           `json:"detail,omitempty"`
	Kind           int              `json:"kind"`
	Range          Range            `json:"range"`
	SelectionRange Range            `json:"selectionRange"`
	Children       []DocumentSymbol `json:"children,omitempty"`
}

type FoldingRange

type FoldingRange struct {
	StartLine int    `json:"startLine"`
	EndLine   int    `json:"endLine"`
	Kind      string `json:"kind,omitempty"` // comment, imports or region.
}

type Hover

type Hover struct {
	Contents MarkupContent `json:"contents"`
	Range    *Range        `json:"range,omitempty"`
}

type InlayHint

type InlayHint struct {
	Position    Position `json:"position"`
	Label       string   `json:"label"`
	PaddingLeft bool     `json:"paddingLeft,omitempty"`
}

type Location

type Location struct {
	URI   string `json:"uri"`
	Range Range  `json:"range"`
}

type MarkupContent

type MarkupContent struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type Options

type Options struct {
	// Sims a request of `wowsimcli siml sim` in the repository at root and gives its result; it stops when ctx is
	// done.
	Sim func(ctx context.Context, root string, req json.RawMessage) (json.RawMessage, error)
	// The game files' row of a spell, as `go run ./tools/spelldata <id>` prints it, for a hover.
	Row func(spellID int32) (string, bool)
}

What the server needs from the program that starts it.

type Position

type Position struct {
	Line      int `json:"line"`
	Character int `json:"character"`
}

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

type RelatedInformation

type RelatedInformation struct {
	Location Location `json:"location"`
	Message  string   `json:"message"`
}

type ResponseError

type ResponseError = jsonrpc.ResponseError

An error a request answers with.

type SemanticTokens

type SemanticTokens struct {
	Data []uint32 `json:"data"`
}

type TextEdit

type TextEdit struct {
	Range   Range  `json:"range"`
	NewText string `json:"newText"`
}

type WorkspaceEdit

type WorkspaceEdit struct {
	Changes map[string][]TextEdit `json:"changes"`
}

Directories

Path Synopsis
Package jsonrpc is JSON-RPC 2.0 over a stream, framed as the language server protocol frames it: a Content-Length header, a blank line and the body.
Package jsonrpc is JSON-RPC 2.0 over a stream, framed as the language server protocol frames it: a Content-Length header, a blank line and the body.
Starts the SIML language server, `wowsimcli siml lsp`, for an editor, from the repository root, through tools/lsplaunch.
Starts the SIML language server, `wowsimcli siml lsp`, for an editor, from the repository root, through tools/lsplaunch.

Jump to

Keyboard shortcuts

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