protocol

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompletionItemKindText          = CompletionItemKind(1)
	CompletionItemKindMethod        = CompletionItemKind(2)
	CompletionItemKindFunction      = CompletionItemKind(3)
	CompletionItemKindConstructor   = CompletionItemKind(4)
	CompletionItemKindField         = CompletionItemKind(5)
	CompletionItemKindVariable      = CompletionItemKind(6)
	CompletionItemKindClass         = CompletionItemKind(7)
	CompletionItemKindInterface     = CompletionItemKind(8)
	CompletionItemKindModule        = CompletionItemKind(9)
	CompletionItemKindProperty      = CompletionItemKind(10)
	CompletionItemKindUnit          = CompletionItemKind(11)
	CompletionItemKindValue         = CompletionItemKind(12)
	CompletionItemKindEnum          = CompletionItemKind(13)
	CompletionItemKindKeyword       = CompletionItemKind(14)
	CompletionItemKindSnippet       = CompletionItemKind(15)
	CompletionItemKindColor         = CompletionItemKind(16)
	CompletionItemKindFile          = CompletionItemKind(17)
	CompletionItemKindReference     = CompletionItemKind(18)
	CompletionItemKindFolder        = CompletionItemKind(19)
	CompletionItemKindEnumMember    = CompletionItemKind(20)
	CompletionItemKindConstant      = CompletionItemKind(21)
	CompletionItemKindStruct        = CompletionItemKind(22)
	CompletionItemKindEvent         = CompletionItemKind(23)
	CompletionItemKindOperator      = CompletionItemKind(24)
	CompletionItemKindTypeParameter = CompletionItemKind(25)
	InsertTextFormatPlainText       = InsertTextFormat(1)
	InsertTextFormatSnippet         = InsertTextFormat(2)
	InsertTextModePlainText         = InsertTextMode(1)
	InsertTextModeSnippet           = InsertTextMode(2)
)
View Source
const (
	SymbolKindNamespace = 3
	SymbolKindClass     = 5
	SymbolKindMethod    = 6
	SymbolKindField     = 8
	SymbolKindInterface = 11
	SymbolKindFunction  = 12
	SymbolKindVariable  = 13
	SymbolKindConstant  = 14
	SymbolKindNumber    = 16
)

LSP SymbolKind enum values. Only the kinds chunter uses are listed; the full enum is at https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind

View Source
const (
	SeverityError       = 1
	SeverityWarning     = 2
	SeverityInformation = 3
	SeverityHint        = 4
)

LSP DiagnosticSeverity values.

View Source
const (
	DiagnosticTagUnnecessary = 1
	DiagnosticTagDeprecated  = 2
)

LSP DiagnosticTag values.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type Command added in v0.6.0

type Command struct {
	/**
	 * Title of the command, like `save`.
	 */
	Title string `json:"title"`

	/**
	 * The identifier of the actual command handler.
	 */
	Command string `json:"command"`

	/**
	 * Arguments that the command handler should be
	 * invoked with.
	 */
	Arguments []any `json:"arguments,omitempty"`
}

type CompletionItem

type CompletionItem struct {
	Label               string              `json:"label"`
	Kind                *CompletionItemKind `json:"kind,omitempty"`
	Tags                []CompletionItemTag `json:"tags,omitempty"`
	Detail              string              `json:"detail,omitempty"`
	Documentation       string              `json:"documentation,omitempty"`
	Deprecated          *bool               `json:"deprecated,omitempty"`
	Preselect           *bool               `json:"preselect,omitempty"`
	SortText            *string             `json:"sortText,omitempty"`
	FilterText          *string             `json:"filterText,omitempty"`
	InsertText          *string             `json:"insertText,omitempty"`
	InsertTextFormat    *InsertTextFormat   `json:"insertTextFormat,omitempty"`
	InsertTextMode      *InsertTextMode     `json:"insertTextMode,omitempty"`
	TextEdit            any                 `json:"textEdit,omitempty"` // nil | TextEdit | InsertReplaceEdit
	AdditionalTextEdits []TextEdit          `json:"additionalTextEdits,omitempty"`
	CommitCharacters    []string            `json:"commitCharacters,omitempty"`
	Command             *Command            `json:"command,omitempty"`
	Data                any                 `json:"data,omitempty"`
}

type CompletionItemKind added in v0.6.0

type CompletionItemKind int

type CompletionItemTag added in v0.6.0

type CompletionItemTag int

type CompletionList

type CompletionList struct {
	IsIncomplete bool             `json:"isIncomplete"`
	Items        []CompletionItem `json:"items"`
}

type CompletionOptions

type CompletionOptions struct {
	TriggerCharacters []string `json:"triggerCharacters,omitempty"`
}

type CompletionParams

type CompletionParams struct {
	TextDocumentPositionParams
}

type DefinitionParams

type DefinitionParams struct {
	TextDocumentPositionParams
}

type Diagnostic

type Diagnostic struct {
	Range              Range                          `json:"range"`
	Severity           int                            `json:"severity"`
	Source             string                         `json:"source"`
	Message            string                         `json:"message"`
	Code               string                         `json:"code,omitempty"`
	Tags               []int                          `json:"tags,omitempty"`
	RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
}

type DiagnosticRelatedInformation added in v0.8.0

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

DiagnosticRelatedInformation points from a diagnostic to another location that is relevant to it (e.g. the duplicate definition site, or the place a symbol is also referenced). LSP spec: DiagnosticRelatedInformation.

type DidChangeTextDocumentParams

type DidChangeTextDocumentParams struct {
	TextDocument   VersionedTextDocumentIdentifier  `json:"textDocument"`
	ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
}

type DidOpenTextDocumentParams

type DidOpenTextDocumentParams struct {
	TextDocument TextDocumentItem `json:"textDocument"`
}

type DocumentSymbol added in v0.8.0

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

DocumentSymbol represents one entry in the document outline. Range is the full extent of the symbol (e.g. an entire section header + body); SelectionRange is the subrange the editor should highlight / scroll to when the user picks this entry (typically just the name token).

The Children field supports nesting (e.g. a policy-map with one child per `class` block); for v1 chunter returns a flat list and leaves Children empty.

type DocumentSymbolParams added in v0.8.0

type DocumentSymbolParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
}

DocumentSymbolParams is the parameter object for textDocument/documentSymbol. Editors call this once per document to build the breadcrumb/outline view; the server returns a flat list of top-level symbols (with optional nested children).

LSP spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol

type HoverParams

type HoverParams struct {
	TextDocumentPositionParams
}

type HoverResult

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

type InitializeParams

type InitializeParams struct {
	ClientInfo *ClientInfo `json:"clientInfo"`
}

type InitializeResult

type InitializeResult struct {
	Capabilities ServerCapabilities `json:"capabilities"`
	ServerInfo   ServerInfo         `json:"serverInfo"`
}

type InsertTextFormat added in v0.6.0

type InsertTextFormat int

type InsertTextMode added in v0.6.0

type InsertTextMode int

type Location

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

type MarkupContent

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

type MarkupKind added in v0.4.0

type MarkupKind string
const (
	PlainText MarkupKind = "plaintext"
	Markdown  MarkupKind = "markdown"
)

type Position

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

type PublishDiagnosticsParams

type PublishDiagnosticsParams struct {
	URI         string       `json:"uri"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

type Range

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

func LineRange

func LineRange(line, start, end uint) Range

type ReferenceContext added in v0.8.0

type ReferenceContext struct {
	IncludeDeclaration bool `json:"includeDeclaration"`
}

ReferenceContext carries the includeDeclaration flag for a references request.

type ReferenceParams added in v0.8.0

type ReferenceParams struct {
	TextDocumentPositionParams
	Context ReferenceContext `json:"context"`
}

ReferenceParams is the parameter object for textDocument/references. Embeds TextDocumentPositionParams (textDocument + position) and adds the ReferenceContext flag controlling whether the declaration site is also returned.

LSP spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_references

type ServerCapabilities

type ServerCapabilities struct {
	TextDocumentSync       int                `json:"textDocumentSync"`
	HoverProvider          bool               `json:"hoverProvider"`
	DefinitionProvider     bool               `json:"definitionProvider"`
	ReferencesProvider     bool               `json:"referencesProvider"`
	DocumentSymbolProvider bool               `json:"documentSymbolProvider"`
	CompletionProvider     *CompletionOptions `json:"completionProvider,omitempty"`
}

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type TextDocumentContentChangeEvent

type TextDocumentContentChangeEvent struct {
	Text string `json:"text"`
}

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	URI string `json:"uri"`
}

type TextDocumentItem

type TextDocumentItem struct {
	URI        string `json:"uri"`
	LanguageID string `json:"languageId"`
	Version    int    `json:"version"`
	Text       string `json:"text"`
}

type TextDocumentPositionParams

type TextDocumentPositionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

type TextEdit added in v0.6.0

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

type VersionedTextDocumentIdentifier

type VersionedTextDocumentIdentifier struct {
	URI     string `json:"uri"`
	Version int    `json:"version"`
}

Jump to

Keyboard shortcuts

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