semanticapi

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotatedTextEdit

type AnnotatedTextEdit struct {
	Range        Range  `json:"range"`
	NewText      string `json:"newText"`
	AnnotationID string `json:"annotationId"`
}

AnnotatedTextEdit is a TextEdit with an annotation identifier.

type ApplyWorkspaceEditParams

type ApplyWorkspaceEditParams struct {
	Label string        `json:"label,omitempty"`
	Edit  WorkspaceEdit `json:"edit"`
}

ApplyWorkspaceEditParams contains the parameters for a workspace/applyEdit request.

type ApplyWorkspaceEditResult

type ApplyWorkspaceEditResult struct {
	Applied       bool   `json:"applied"`
	FailureReason string `json:"failureReason,omitempty"`
}

ApplyWorkspaceEditResult contains the result of a workspace/applyEdit request.

type CallHierarchyIncomingCall

type CallHierarchyIncomingCall struct {
	From       CallHierarchyItem `json:"from"`
	FromRanges []Range           `json:"fromRanges"`
}

CallHierarchyIncomingCall represents an incoming call.

type CallHierarchyIncomingCallsParams

type CallHierarchyIncomingCallsParams struct {
	Item CallHierarchyItem `json:"item"`
}

CallHierarchyIncomingCallsParams contains the parameters for an IncomingCalls request.

type CallHierarchyItem

type CallHierarchyItem struct {
	Name           string     `json:"name"`
	Kind           SymbolKind `json:"kind"`
	URI            string     `json:"uri"`
	Range          Range      `json:"range"`
	SelectionRange Range      `json:"selectionRange"`
}

CallHierarchyItem represents a call hierarchy item.

type CallHierarchyOutgoingCall

type CallHierarchyOutgoingCall struct {
	To         CallHierarchyItem `json:"to"`
	FromRanges []Range           `json:"fromRanges"`
}

CallHierarchyOutgoingCall represents an outgoing call.

type CallHierarchyOutgoingCallsParams

type CallHierarchyOutgoingCallsParams struct {
	Item CallHierarchyItem `json:"item"`
}

CallHierarchyOutgoingCallsParams contains the parameters for an OutgoingCalls request.

type CallHierarchyPrepareParams

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

CallHierarchyPrepareParams contains the parameters for a PrepareCallHierarchy request.

type CodeAction

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

CodeAction represents a change that can be performed in code.

type CodeActionContext

type CodeActionContext struct {
	Diagnostics []Diagnostic          `json:"diagnostics"`
	Only        []CodeActionKind      `json:"only,omitempty"`
	TriggerKind CodeActionTriggerKind `json:"triggerKind,omitempty"`
}

CodeActionContext contains additional diagnostic information about the context in which a code action is run.

type CodeActionKind

type CodeActionKind string

CodeActionKind enumerates code action kinds.

const (
	CodeActionKindQuickFix              CodeActionKind = "quickfix"
	CodeActionKindRefactor              CodeActionKind = "refactor"
	CodeActionKindRefactorExtract       CodeActionKind = "refactor.extract"
	CodeActionKindRefactorInline        CodeActionKind = "refactor.inline"
	CodeActionKindRefactorRewrite       CodeActionKind = "refactor.rewrite"
	CodeActionKindSource                CodeActionKind = "source"
	CodeActionKindSourceOrganizeImports CodeActionKind = "source.organizeImports"
)

type CodeActionOptions

type CodeActionOptions struct {
	CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"`
	ResolveProvider bool             `json:"resolveProvider,omitempty"`
}

CodeActionOptions describes the options for the code action provider.

type CodeActionParams

type CodeActionParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Range         Range                  `json:"range"`
	Context       CodeActionContext      `json:"context"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

CodeActionParams contains the parameters for a CodeAction request.

type CodeActionResult

type CodeActionResult struct {
	Command    *Command    `json:"-"`
	CodeAction *CodeAction `json:"-"`
}

CodeActionResult represents an item in the codeAction response array. Per LSP spec: (Command | CodeAction)[]

func (CodeActionResult) MarshalJSON

func (r CodeActionResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for CodeActionResult.

func (*CodeActionResult) UnmarshalJSON

func (r *CodeActionResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for CodeActionResult.

type CodeActionTriggerKind

type CodeActionTriggerKind int

CodeActionTriggerKind enumerates the kind of a code action trigger.

const (
	CodeActionTriggerKindInvoked   CodeActionTriggerKind = 1
	CodeActionTriggerKindAutomatic CodeActionTriggerKind = 2
)

type CodeDescription

type CodeDescription struct {
	Href string `json:"href"`
}

CodeDescription represents a URI to open with more information about a diagnostic error.

type CodeLens

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

CodeLens represents a command that should be shown along with source text.

type CodeLensOptions

type CodeLensOptions struct {
	ResolveProvider bool `json:"resolveProvider,omitempty"`
}

CodeLensOptions describes the options for the code lens provider.

type CodeLensParams

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

CodeLensParams contains the parameters for a CodeLens request.

type Color

type Color struct {
	Red   float64 `json:"red"`
	Green float64 `json:"green"`
	Blue  float64 `json:"blue"`
	Alpha float64 `json:"alpha"`
}

Color represents a color in RGBA space.

type ColorInformation

type ColorInformation struct {
	Range Range `json:"range"`
	Color Color `json:"color"`
}

ColorInformation contains a range and a color found at that range.

type ColorPresentation

type ColorPresentation struct {
	Label               string     `json:"label"`
	TextEdit            *TextEdit  `json:"textEdit,omitempty"`
	AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
}

ColorPresentation describes how a color is presented.

type ColorPresentationParams

type ColorPresentationParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Color        Color                  `json:"color"`
	Range        Range                  `json:"range"`
}

ColorPresentationParams contains the parameters for a ColorPresentation request.

type Command

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

Command represents a reference to a command.

type CompletionContext

type CompletionContext struct {
	TriggerKind      CompletionTriggerKind `json:"triggerKind"`
	TriggerCharacter string                `json:"triggerCharacter,omitempty"`
}

CompletionContext contains additional information about the context in which a completion request is triggered.

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       *MarkupContent      `json:"-"`
	DocumentationString string              `json:"-"`
	InsertText          string              `json:"insertText,omitempty"`
	InsertTextFormat    InsertTextFormat    `json:"insertTextFormat,omitempty"`
	TextEdit            *TextEdit           `json:"-"`
	TextEditIR          *InsertReplaceEdit  `json:"-"` // InsertReplaceEdit variant
}

CompletionItem represents a completion entry.

func (CompletionItem) MarshalJSON

func (c CompletionItem) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for CompletionItem. The "documentation" field is either a string or a MarkupContent object per LSP spec. The "textEdit" field is either a TextEdit or an InsertReplaceEdit per LSP spec.

func (*CompletionItem) UnmarshalJSON

func (c *CompletionItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for CompletionItem.

type CompletionItemKind

type CompletionItemKind int

CompletionItemKind enumerates the kind of a completion entry.

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
)

type CompletionItemTag

type CompletionItemTag int

CompletionItemTag enumerates tags for completion items.

const (
	CompletionItemTagDeprecated CompletionItemTag = 1
)

type CompletionOptions

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

CompletionOptions describes the options for the completion provider.

type CompletionParams

type CompletionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
	Context      *CompletionContext     `json:"context,omitempty"`
}

CompletionParams contains the parameters for a Completion request.

type CompletionResult

type CompletionResult struct {
	IsIncomplete bool             `json:"isIncomplete"`
	Items        []CompletionItem `json:"items"`
	IsItemsOnly  bool             `json:"-"` // true if response was just CompletionItem[]
}

CompletionResult represents the result of a completion request. Per LSP spec: CompletionItem[] | CompletionList | null When unmarshaling from CompletionItem[], IsIncomplete is set to false.

func (CompletionResult) MarshalJSON

func (r CompletionResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for CompletionResult.

func (*CompletionResult) UnmarshalJSON

func (r *CompletionResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for CompletionResult.

type CompletionTriggerKind

type CompletionTriggerKind int

CompletionTriggerKind enumerates how a completion was triggered.

const (
	CompletionTriggerKindInvoked                         CompletionTriggerKind = 1
	CompletionTriggerKindTriggerCharacter                CompletionTriggerKind = 2
	CompletionTriggerKindTriggerForIncompleteCompletions CompletionTriggerKind = 3
)

type ConfigurationItem

type ConfigurationItem struct {
	ScopeURI string `json:"scopeUri,omitempty"`
	Section  string `json:"section,omitempty"`
}

ConfigurationItem represents a configuration section to fetch.

type ConfigurationParams

type ConfigurationParams struct {
	Items []ConfigurationItem `json:"items"`
}

ConfigurationParams contains the parameters for a workspace/configuration request.

type CreateFile

type CreateFile struct {
	Kind         string             `json:"kind"` // always "create"
	URI          string             `json:"uri"`
	Options      *CreateFileOptions `json:"options,omitempty"`
	AnnotationID string             `json:"annotationId,omitempty"`
}

CreateFile represents a create file operation.

type CreateFileOptions

type CreateFileOptions struct {
	Overwrite      bool `json:"overwrite,omitempty"`
	IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}

CreateFileOptions contains options for creating a file.

type CreateFilesParams

type CreateFilesParams struct {
	Files []FileCreate `json:"files"`
}

CreateFilesParams contains the parameters for file creation events.

type DeclarationParams

type DeclarationParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

DeclarationParams contains the parameters for a Declaration request.

type DefinitionParams

type DefinitionParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

DefinitionParams contains the parameters for a Definition request.

type DeleteFile

type DeleteFile struct {
	Kind         string             `json:"kind"` // always "delete"
	URI          string             `json:"uri"`
	Options      *DeleteFileOptions `json:"options,omitempty"`
	AnnotationID string             `json:"annotationId,omitempty"`
}

DeleteFile represents a delete file operation.

type DeleteFileOptions

type DeleteFileOptions struct {
	Recursive         bool `json:"recursive,omitempty"`
	IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
}

DeleteFileOptions contains options for deleting a file.

type DeleteFilesParams

type DeleteFilesParams struct {
	Files []FileDelete `json:"files"`
}

DeleteFilesParams contains the parameters for file deletion events.

type Diagnostic

type Diagnostic struct {
	Range              Range                          `json:"range"`
	Severity           DiagnosticSeverity             `json:"severity,omitempty"`
	Code               string                         `json:"-"`
	CodeInt            int                            `json:"-"`
	CodeIsInt          bool                           `json:"-"`
	CodeDescription    *CodeDescription               `json:"codeDescription,omitempty"`
	Source             string                         `json:"source,omitempty"`
	Message            string                         `json:"message"`
	Tags               []DiagnosticTag                `json:"tags,omitempty"`
	RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
	Data               json.RawMessage                `json:"data,omitempty"`
}

Diagnostic represents a diagnostic, such as a compiler error or warning.

func (Diagnostic) MarshalJSON

func (d Diagnostic) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for Diagnostic. The "code" field is either an integer or a string per LSP spec.

func (*Diagnostic) UnmarshalJSON

func (d *Diagnostic) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for Diagnostic.

type DiagnosticOptions

type DiagnosticOptions struct {
	Identifier            string `json:"identifier,omitempty"`
	InterFileDependencies bool   `json:"interFileDependencies"`
	WorkspaceDiagnostics  bool   `json:"workspaceDiagnostics"`
}

DiagnosticOptions describes the options for the diagnostic provider.

type DiagnosticRelatedInformation

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

DiagnosticRelatedInformation represents a related message and source code location for a diagnostic.

type DiagnosticSeverity

type DiagnosticSeverity int

DiagnosticSeverity enumerates the severity of a diagnostic.

const (
	DiagnosticSeverityError       DiagnosticSeverity = 1
	DiagnosticSeverityWarning     DiagnosticSeverity = 2
	DiagnosticSeverityInformation DiagnosticSeverity = 3
	DiagnosticSeverityHint        DiagnosticSeverity = 4
)

type DiagnosticTag

type DiagnosticTag int

DiagnosticTag enumerates tags for diagnostics.

const (
	DiagnosticTagUnnecessary DiagnosticTag = 1
	DiagnosticTagDeprecated  DiagnosticTag = 2
)

type DidChangeConfigurationParams

type DidChangeConfigurationParams struct {
	Settings json.RawMessage `json:"settings,omitempty"`
}

DidChangeConfigurationParams contains the parameters for a DidChangeConfiguration notification.

type DidChangeTextDocumentParams

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

DidChangeTextDocumentParams contains the parameters for the DidChange notification.

type DidChangeWatchedFilesParams

type DidChangeWatchedFilesParams struct {
	Changes []FileEvent `json:"changes"`
}

DidChangeWatchedFilesParams contains the parameters for a DidChangeWatchedFiles notification.

type DidChangeWatchedFilesRegistrationOptions added in v0.0.26

type DidChangeWatchedFilesRegistrationOptions struct {
	Watchers []FileSystemWatcher `json:"watchers"`
}

DidChangeWatchedFilesRegistrationOptions describes options for registering file system watchers.

type DidChangeWorkspaceFoldersParams

type DidChangeWorkspaceFoldersParams struct {
	Event WorkspaceFoldersChangeEvent `json:"event"`
}

DidChangeWorkspaceFoldersParams contains the parameters for a DidChangeWorkspaceFolders notification.

type DidCloseTextDocumentParams

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

DidCloseTextDocumentParams contains the parameters for the DidClose notification.

type DidOpenTextDocumentParams

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

DidOpenTextDocumentParams contains the parameters for the DidOpen notification.

type DidSaveTextDocumentParams

type DidSaveTextDocumentParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Text         string                 `json:"text,omitempty"`
}

DidSaveTextDocumentParams contains the parameters for the DidSave notification.

type DocumentChange

type DocumentChange struct {
	TextDocumentEdit *TextDocumentEdit `json:"-"`
	CreateFile       *CreateFile       `json:"-"`
	RenameFile       *RenameFile       `json:"-"`
	DeleteFile       *DeleteFile       `json:"-"`
}

DocumentChange represents a single change in documentChanges array. It can be a TextDocumentEdit, CreateFile, RenameFile, or DeleteFile.

func (DocumentChange) MarshalJSON

func (d DocumentChange) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for DocumentChange.

func (*DocumentChange) UnmarshalJSON

func (d *DocumentChange) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for DocumentChange.

type DocumentColorParams

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

DocumentColorParams contains the parameters for a DocumentColor request.

type DocumentDiagnosticParams

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

DocumentDiagnosticParams contains the parameters for a Diagnostic request.

type DocumentDiagnosticReport

type DocumentDiagnosticReport struct {
	Kind             string                              `json:"kind"`
	ResultID         string                              `json:"resultId,omitempty"`
	Items            []Diagnostic                        `json:"items,omitempty"`
	RelatedDocuments map[string]DocumentDiagnosticReport `json:"relatedDocuments,omitempty"`
}

DocumentDiagnosticReport represents a diagnostic report for a document.

type DocumentFormattingParams

type DocumentFormattingParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Options      FormattingOptions      `json:"options"`
}

DocumentFormattingParams contains the parameters for a Formatting request.

type DocumentHighlight

type DocumentHighlight struct {
	Range Range                 `json:"range"`
	Kind  DocumentHighlightKind `json:"kind,omitempty"`
}

DocumentHighlight represents a document highlight, such as all usages of a symbol.

type DocumentHighlightKind

type DocumentHighlightKind int

DocumentHighlightKind enumerates the kind of a document highlight.

const (
	DocumentHighlightKindText  DocumentHighlightKind = 1
	DocumentHighlightKindRead  DocumentHighlightKind = 2
	DocumentHighlightKindWrite DocumentHighlightKind = 3
)

type DocumentHighlightParams

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

DocumentHighlightParams contains the parameters for a DocumentHighlight request.

type DocumentLink struct {
	Range   Range  `json:"range"`
	Target  string `json:"target,omitempty"`
	Tooltip string `json:"tooltip,omitempty"`
}

DocumentLink represents a link in a document.

type DocumentLinkOptions

type DocumentLinkOptions struct {
	ResolveProvider bool `json:"resolveProvider,omitempty"`
}

DocumentLinkOptions describes the options for the document link provider.

type DocumentLinkParams

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

DocumentLinkParams contains the parameters for a DocumentLink request.

type DocumentOnTypeFormattingOptions

type DocumentOnTypeFormattingOptions struct {
	FirstTriggerCharacter string   `json:"firstTriggerCharacter"`
	MoreTriggerCharacter  []string `json:"moreTriggerCharacter,omitempty"`
}

DocumentOnTypeFormattingOptions describes the options for the on type formatting provider.

type DocumentOnTypeFormattingParams

type DocumentOnTypeFormattingParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
	Character    string                 `json:"ch"`
	Options      FormattingOptions      `json:"options"`
}

DocumentOnTypeFormattingParams contains the parameters for an OnTypeFormatting request.

type DocumentRangeFormattingParams

type DocumentRangeFormattingParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Range        Range                  `json:"range"`
	Options      FormattingOptions      `json:"options"`
}

DocumentRangeFormattingParams contains the parameters for a RangeFormatting request.

type DocumentSymbol

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

DocumentSymbol represents information about programming constructs like variables, classes, interfaces etc.

type DocumentSymbolParams

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

DocumentSymbolParams contains the parameters for a DocumentSymbol request.

type DocumentSymbolResult

type DocumentSymbolResult struct {
	DocumentSymbols   []DocumentSymbol    `json:"-"`
	SymbolInformation []SymbolInformation `json:"-"`
}

DocumentSymbolResult represents the result of documentSymbol request. Per LSP spec: DocumentSymbol[] | SymbolInformation[] | null

func (DocumentSymbolResult) MarshalJSON

func (r DocumentSymbolResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for DocumentSymbolResult.

func (*DocumentSymbolResult) UnmarshalJSON

func (r *DocumentSymbolResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for DocumentSymbolResult.

type ExecuteCommandOptions

type ExecuteCommandOptions struct {
	Commands []string `json:"commands"`
}

ExecuteCommandOptions describes the options for the execute command provider.

type ExecuteCommandParams

type ExecuteCommandParams struct {
	Command       string            `json:"command"`
	Arguments     []json.RawMessage `json:"arguments,omitempty"`
	WorkDoneToken *ProgressToken    `json:"workDoneToken,omitempty"`
}

ExecuteCommandParams contains the parameters for an ExecuteCommand request.

type FileChangeType

type FileChangeType int

FileChangeType enumerates the type of file events.

const (
	FileChangeTypeCreated FileChangeType = 1
	FileChangeTypeChanged FileChangeType = 2
	FileChangeTypeDeleted FileChangeType = 3
)

type FileCreate

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

FileCreate represents a file creation event.

type FileDelete

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

FileDelete represents a file deletion event.

type FileEvent

type FileEvent struct {
	URI  string         `json:"uri"`
	Type FileChangeType `json:"type"`
}

FileEvent represents a file event.

type FileRename

type FileRename struct {
	OldURI string `json:"oldUri"`
	NewURI string `json:"newUri"`
}

FileRename represents a file rename event.

type FileSystemWatcher added in v0.0.26

type FileSystemWatcher struct {
	GlobPattern GlobPattern `json:"globPattern"`
	Kind        WatchKind   `json:"kind,omitempty"`
}

FileSystemWatcher represents a file system watcher registration.

type FoldingRange

type FoldingRange struct {
	StartLine      uint32           `json:"startLine"`
	StartCharacter uint32           `json:"startCharacter,omitempty"`
	EndLine        uint32           `json:"endLine"`
	EndCharacter   uint32           `json:"endCharacter,omitempty"`
	Kind           FoldingRangeKind `json:"kind,omitempty"`
}

FoldingRange represents a folding range.

type FoldingRangeKind

type FoldingRangeKind string

FoldingRangeKind enumerates the kind of a folding range.

const (
	FoldingRangeKindComment FoldingRangeKind = "comment"
	FoldingRangeKindImports FoldingRangeKind = "imports"
	FoldingRangeKindRegion  FoldingRangeKind = "region"
)

type FoldingRangeParams

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

FoldingRangeParams contains the parameters for a FoldingRange request.

type FormattingOptions

type FormattingOptions struct {
	TabSize                uint32 `json:"tabSize"`
	InsertSpaces           bool   `json:"insertSpaces"`
	TrimTrailingWhitespace bool   `json:"trimTrailingWhitespace,omitempty"`
	InsertFinalNewline     bool   `json:"insertFinalNewline,omitempty"`
	TrimFinalNewlines      bool   `json:"trimFinalNewlines,omitempty"`
}

FormattingOptions describes options for formatting.

type GlobPattern added in v0.0.26

type GlobPattern = json.RawMessage

GlobPattern represents a glob pattern used for file watching. It can be a simple string pattern or a RelativePattern.

type Hover

type Hover struct {
	Contents        MarkupContent  `json:"-"`
	ContentsMarked  *MarkedString  `json:"-"`
	ContentsMarkedA []MarkedString `json:"-"`
	Range           *Range         `json:"range,omitempty"`
}

Hover represents the result of a hover request. Per LSP spec, contents can be: MarkedString | MarkedString[] | MarkupContent

func (Hover) MarshalJSON

func (h Hover) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for Hover. The "contents" field is either a MarkedString, MarkedString[], or MarkupContent.

func (*Hover) UnmarshalJSON

func (h *Hover) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for Hover.

type HoverParams

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

HoverParams contains the parameters for a Hover request.

type ImplementationParams

type ImplementationParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

ImplementationParams contains the parameters for an Implementation request.

type InitializeParams

type InitializeParams struct {
	ProcessID         *int              `json:"processId"`
	RootURI           string            `json:"rootUri"`
	Capabilities      json.RawMessage   `json:"capabilities,omitempty"`
	WorkspaceFolders  []WorkspaceFolder `json:"workspaceFolders,omitempty"`
	Trace             TraceValue        `json:"trace,omitempty"`
	InitializeOptions json.RawMessage   `json:"initializationOptions,omitempty"`
	WorkDoneToken     *ProgressToken    `json:"workDoneToken,omitempty"`
}

InitializeParams contains the parameters for the Initialize request.

type InitializeResult

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

InitializeResult contains the result of the Initialize request.

type InlayHint

type InlayHint struct {
	Position      Position             `json:"position"`
	Label         string               `json:"-"`
	LabelParts    []InlayHintLabelPart `json:"-"`
	Kind          InlayHintKind        `json:"kind,omitempty"`
	TextEdits     []TextEdit           `json:"textEdits,omitempty"`
	Tooltip       *MarkupContent       `json:"-"`
	TooltipString string               `json:"-"`
	PaddingLeft   bool                 `json:"paddingLeft,omitempty"`
	PaddingRight  bool                 `json:"paddingRight,omitempty"`
}

InlayHint represents an inlay hint.

func (InlayHint) MarshalJSON

func (h InlayHint) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for InlayHint. The "label" field is either a string or an array of InlayHintLabelPart per LSP spec. The "tooltip" field is either a string or a MarkupContent object per LSP spec.

func (*InlayHint) UnmarshalJSON

func (h *InlayHint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for InlayHint.

type InlayHintKind

type InlayHintKind int

InlayHintKind enumerates the kind of an inlay hint.

const (
	InlayHintKindType      InlayHintKind = 1
	InlayHintKindParameter InlayHintKind = 2
)

type InlayHintLabelPart

type InlayHintLabelPart struct {
	Value         string         `json:"value"`
	Tooltip       *MarkupContent `json:"-"`
	TooltipString string         `json:"-"`
	Location      *Location      `json:"location,omitempty"`
	Command       *Command       `json:"command,omitempty"`
}

InlayHintLabelPart represents a part of an inlay hint label.

func (InlayHintLabelPart) MarshalJSON

func (p InlayHintLabelPart) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for InlayHintLabelPart. The "tooltip" field is either a string or a MarkupContent object per LSP spec.

func (*InlayHintLabelPart) UnmarshalJSON

func (p *InlayHintLabelPart) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for InlayHintLabelPart.

type InlayHintOptions

type InlayHintOptions struct {
	ResolveProvider bool `json:"resolveProvider,omitempty"`
}

InlayHintOptions describes the options for the inlay hint provider.

type InlayHintParams

type InlayHintParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Range        Range                  `json:"range"`
}

InlayHintParams contains the parameters for an InlayHint request.

type InlineValue

type InlineValue struct {
	Range        Range  `json:"range"`
	Text         string `json:"text,omitempty"`
	VariableName string `json:"variableName,omitempty"`
	Expression   string `json:"expression,omitempty"`
}

InlineValue represents an inline value.

type InlineValueParams

type InlineValueParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Range        Range                  `json:"range"`
}

InlineValueParams contains the parameters for an InlineValue request.

type InsertReplaceEdit

type InsertReplaceEdit struct {
	NewText string `json:"newText"`
	Insert  Range  `json:"insert"`
	Replace Range  `json:"replace"`
}

InsertReplaceEdit represents an insert/replace edit with separate ranges.

type InsertTextFormat

type InsertTextFormat int

InsertTextFormat defines how an insert text is interpreted.

const (
	InsertTextFormatPlainText InsertTextFormat = 1
	InsertTextFormatSnippet   InsertTextFormat = 2
)

type LSP

type LSP interface {
	Initialize(ctx context.Context, params InitializeParams) (InitializeResult, error)
	Initialized(ctx context.Context) error
	Shutdown(ctx context.Context) error
	Exit(ctx context.Context) error

	DidOpen(ctx context.Context, params DidOpenTextDocumentParams) error
	DidChange(ctx context.Context, params DidChangeTextDocumentParams) error
	DidClose(ctx context.Context, params DidCloseTextDocumentParams) error
	DidSave(ctx context.Context, params DidSaveTextDocumentParams) error

	Completion(ctx context.Context, params CompletionParams) (CompletionResult, error)
	Hover(ctx context.Context, params HoverParams) (*Hover, error)
	SignatureHelp(ctx context.Context, params SignatureHelpParams) (*SignatureHelp, error)
	Definition(ctx context.Context, params DefinitionParams) (LocationResult, error)
	Declaration(ctx context.Context, params DeclarationParams) (LocationResult, error)
	TypeDefinition(ctx context.Context, params TypeDefinitionParams) (LocationResult, error)
	Implementation(ctx context.Context, params ImplementationParams) (LocationResult, error)
	References(ctx context.Context, params ReferenceParams) ([]Location, error)
	DocumentHighlight(ctx context.Context, params DocumentHighlightParams) ([]DocumentHighlight, error)
	DocumentSymbol(ctx context.Context, params DocumentSymbolParams) (DocumentSymbolResult, error)
	CodeAction(ctx context.Context, params CodeActionParams) ([]CodeActionResult, error)
	CodeLens(ctx context.Context, params CodeLensParams) ([]CodeLens, error)
	Formatting(ctx context.Context, params DocumentFormattingParams) ([]TextEdit, error)
	RangeFormatting(ctx context.Context, params DocumentRangeFormattingParams) ([]TextEdit, error)
	Rename(ctx context.Context, params RenameParams) (*WorkspaceEdit, error)
	PrepareRename(ctx context.Context, params PrepareRenameParams) (*PrepareRenameResult, error)
	FoldingRange(ctx context.Context, params FoldingRangeParams) ([]FoldingRange, error)
	SelectionRange(ctx context.Context, params SelectionRangeParams) ([]SelectionRange, error)

	SemanticTokensFull(ctx context.Context, params SemanticTokensParams) (*SemanticTokens, error)
	SemanticTokensRange(ctx context.Context, params SemanticTokensRangeParams) (*SemanticTokens, error)

	Diagnostic(ctx context.Context, params DocumentDiagnosticParams) (DocumentDiagnosticReport, error)
	WorkspaceDiagnostic(ctx context.Context, params WorkspaceDiagnosticParams) (WorkspaceDiagnosticReport, error)

	WorkspaceSymbol(ctx context.Context, params WorkspaceSymbolParams) ([]SymbolInformation, error)
	ExecuteCommand(ctx context.Context, params ExecuteCommandParams) (string, error)

	PrepareCallHierarchy(ctx context.Context, params CallHierarchyPrepareParams) ([]CallHierarchyItem, error)
	CallHierarchyIncomingCalls(ctx context.Context, params CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error)
	CallHierarchyOutgoingCalls(ctx context.Context, params CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error)

	CompletionResolve(ctx context.Context, item CompletionItem) (CompletionItem, error)
	CodeLensResolve(ctx context.Context, lens CodeLens) (CodeLens, error)
	DocumentColor(ctx context.Context, params DocumentColorParams) ([]ColorInformation, error)
	ColorPresentation(ctx context.Context, params ColorPresentationParams) ([]ColorPresentation, error)
	DocumentLink(ctx context.Context, params DocumentLinkParams) ([]DocumentLink, error)
	DocumentLinkResolve(ctx context.Context, link DocumentLink) (DocumentLink, error)
	OnTypeFormatting(ctx context.Context, params DocumentOnTypeFormattingParams) ([]TextEdit, error)
	LinkedEditingRange(ctx context.Context, params LinkedEditingRangeParams) (*LinkedEditingRanges, error)
	Moniker(ctx context.Context, params MonikerParams) ([]Moniker, error)
	WillSaveWaitUntil(ctx context.Context, params WillSaveTextDocumentParams) ([]TextEdit, error)
	SemanticTokensFullDelta(ctx context.Context, params SemanticTokensDeltaParams) (*SemanticTokensDelta, error)

	PrepareTypeHierarchy(ctx context.Context, params TypeHierarchyPrepareParams) ([]TypeHierarchyItem, error)
	TypeHierarchySupertypes(ctx context.Context, params TypeHierarchySupertypesParams) ([]TypeHierarchyItem, error)
	TypeHierarchySubtypes(ctx context.Context, params TypeHierarchySubtypesParams) ([]TypeHierarchyItem, error)

	InlayHint(ctx context.Context, params InlayHintParams) ([]InlayHint, error)
	InlayHintResolve(ctx context.Context, hint InlayHint) (InlayHint, error)
	InlineValue(ctx context.Context, params InlineValueParams) ([]InlineValue, error)

	WillCreateFiles(ctx context.Context, params CreateFilesParams) (*WorkspaceEdit, error)
	WillRenameFiles(ctx context.Context, params RenameFilesParams) (*WorkspaceEdit, error)
	WillDeleteFiles(ctx context.Context, params DeleteFilesParams) (*WorkspaceEdit, error)

	WillSave(ctx context.Context, params WillSaveTextDocumentParams) error
	DidChangeConfiguration(ctx context.Context, params DidChangeConfigurationParams) error
	DidChangeWatchedFiles(ctx context.Context, params DidChangeWatchedFilesParams) error
	DidChangeWorkspaceFolders(ctx context.Context, params DidChangeWorkspaceFoldersParams) error
	WorkDoneProgressCancel(ctx context.Context, params WorkDoneProgressCancelParams) error
	SetTrace(ctx context.Context, params SetTraceParams) error
	DidCreateFiles(ctx context.Context, params CreateFilesParams) error
	DidRenameFiles(ctx context.Context, params RenameFilesParams) error
	DidDeleteFiles(ctx context.Context, params DeleteFilesParams) error
}

LSP defines the interface for a Language Server Protocol server.

type LSPCallback

type LSPCallback interface {

	// ShowMessage displays a message in the UI (window/showMessage).
	ShowMessage(ctx context.Context, params ShowMessageParams) error
	// LogMessage logs a message (window/logMessage).
	LogMessage(ctx context.Context, params LogMessageParams) error
	// PublishDiagnostics publishes diagnostics for a document
	// (textDocument/publishDiagnostics).
	PublishDiagnostics(ctx context.Context, params PublishDiagnosticsParams) error
	// Progress reports progress ($/progress).
	Progress(ctx context.Context, params ProgressParams) error
	// LogTrace logs a trace message ($/logTrace).
	LogTrace(ctx context.Context, params LogTraceParams) error

	// ShowDocument requests the client to display a document (window/showDocument).
	ShowDocument(ctx context.Context, params ShowDocumentParams) (ShowDocumentResult, error)
	// ShowMessageRequest shows a message with action items
	// (window/showMessageRequest).
	ShowMessageRequest(
		ctx context.Context, params ShowMessageRequestParams,
	) (*MessageActionItem, error)
	// WorkDoneProgressCreate requests creation of a progress token
	// (window/workDoneProgress/create).
	WorkDoneProgressCreate(ctx context.Context, params WorkDoneProgressCreateParams) error
	// ApplyEdit applies a workspace edit (workspace/applyEdit).
	ApplyEdit(
		ctx context.Context, params ApplyWorkspaceEditParams,
	) (ApplyWorkspaceEditResult, error)
	// WorkspaceFolders returns the workspace folders (workspace/workspaceFolders).
	WorkspaceFolders(ctx context.Context) ([]WorkspaceFolder, error)
	// Configuration fetches configuration from the client (workspace/configuration).
	Configuration(ctx context.Context, params ConfigurationParams) ([]json.RawMessage, error)
	// RegisterCapability dynamically registers capabilities
	// (client/registerCapability).
	RegisterCapability(ctx context.Context, params RegistrationParams) error
	// UnregisterCapability dynamically unregisters capabilities
	// (client/unregisterCapability).
	UnregisterCapability(ctx context.Context, params UnregistrationParams) error

	// CodeLensRefresh requests the client to refresh code lenses
	// (workspace/codeLens/refresh).
	CodeLensRefresh(ctx context.Context) error
	// SemanticTokensRefresh requests the client to refresh semantic tokens
	// (workspace/semanticTokens/refresh).
	SemanticTokensRefresh(ctx context.Context) error
	// InlayHintRefresh requests the client to refresh inlay hints
	// (workspace/inlayHint/refresh).
	InlayHintRefresh(ctx context.Context) error
	// DiagnosticRefresh requests the client to refresh diagnostics
	// (workspace/diagnostic/refresh).
	DiagnosticRefresh(ctx context.Context) error
}

LSPCallback defines the interface for server→client LSP callbacks. This includes both notifications (no return value expected) and requests (return value expected from client).

type LinkedEditingRangeParams

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

LinkedEditingRangeParams contains the parameters for a LinkedEditingRange request.

type LinkedEditingRanges

type LinkedEditingRanges struct {
	Ranges      []Range `json:"ranges"`
	WordPattern string  `json:"wordPattern,omitempty"`
}

LinkedEditingRanges represents linked editing ranges.

type Location

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

Location represents a location inside a resource.

type LocationLink struct {
	OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
	TargetURI            string `json:"targetUri"`
	TargetRange          Range  `json:"targetRange"`
	TargetSelectionRange Range  `json:"targetSelectionRange"`
}

LocationLink represents a link between a source and a target location.

type LocationResult

type LocationResult struct {
	Location      *Location      `json:"-"`
	Locations     []Location     `json:"-"`
	LocationLinks []LocationLink `json:"-"`
}

LocationResult represents the result of definition/declaration/typeDefinition/implementation. Per LSP spec: Location | Location[] | LocationLink[] | null

func (LocationResult) MarshalJSON

func (r LocationResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for LocationResult.

func (*LocationResult) UnmarshalJSON

func (r *LocationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for LocationResult.

type LogMessageParams

type LogMessageParams struct {
	Type    MessageType `json:"type"`
	Message string      `json:"message"`
}

LogMessageParams contains the parameters for a window/logMessage notification.

type LogTraceParams

type LogTraceParams struct {
	Message string `json:"message"`
	Verbose string `json:"verbose,omitempty"`
}

LogTraceParams contains the parameters for a LogTrace notification.

type MarkedString

type MarkedString struct {
	Language string `json:"language,omitempty"`
	Value    string `json:"value"`
	IsRaw    bool   `json:"-"` // true if it was just a plain string
}

MarkedString represents a code block with language. Deprecated in favor of MarkupContent. Per LSP spec: MarkedString = string | { language: string; value: string }

func (MarkedString) MarshalJSON

func (m MarkedString) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for MarkedString.

func (*MarkedString) UnmarshalJSON

func (m *MarkedString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for MarkedString.

type MarkupContent

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

MarkupContent represents human-readable text with a rendering format.

type MarkupKind

type MarkupKind string

MarkupKind describes the content type of a Hover or CompletionItem.

const (
	MarkupKindPlainText MarkupKind = "plaintext"
	MarkupKindMarkdown  MarkupKind = "markdown"
)

type MessageActionItem

type MessageActionItem struct {
	Title string `json:"title"`
}

MessageActionItem represents an action item in a ShowMessageRequest.

type MessageType

type MessageType int

MessageType enumerates the type of a message (for ShowMessage/LogMessage).

const (
	MessageTypeError   MessageType = 1
	MessageTypeWarning MessageType = 2
	MessageTypeInfo    MessageType = 3
	MessageTypeLog     MessageType = 4
	MessageTypeDebug   MessageType = 5
)

type Moniker

type Moniker struct {
	Scheme     string                 `json:"scheme"`
	Identifier string                 `json:"identifier"`
	Unique     MonikerUniquenessLevel `json:"unique"`
	Kind       MonikerKind            `json:"kind,omitempty"`
}

Moniker represents a moniker attached to a symbol.

type MonikerKind

type MonikerKind string

MonikerKind enumerates the kind of a moniker.

const (
	MonikerKindImport MonikerKind = "import"
	MonikerKindExport MonikerKind = "export"
	MonikerKindLocal  MonikerKind = "local"
)

type MonikerParams

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

MonikerParams contains the parameters for a Moniker request.

type MonikerUniquenessLevel

type MonikerUniquenessLevel string

MonikerUniquenessLevel enumerates the uniqueness level of a moniker.

const (
	MonikerUniquenessLevelDocument MonikerUniquenessLevel = "document"
	MonikerUniquenessLevelProject  MonikerUniquenessLevel = "project"
	MonikerUniquenessLevelGroup    MonikerUniquenessLevel = "group"
	MonikerUniquenessLevelScheme   MonikerUniquenessLevel = "scheme"
	MonikerUniquenessLevelGlobal   MonikerUniquenessLevel = "global"
)

type ParameterInformation

type ParameterInformation struct {
	Label               string         `json:"-"`
	LabelOffsets        *[2]uint32     `json:"-"`
	Documentation       *MarkupContent `json:"-"`
	DocumentationString string         `json:"-"`
}

ParameterInformation represents a parameter of a callable-signature.

func (ParameterInformation) MarshalJSON

func (p ParameterInformation) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for ParameterInformation. The "label" field is either a string or a [start, end] tuple per LSP spec. The "documentation" field is either a string or a MarkupContent object per LSP spec.

func (*ParameterInformation) UnmarshalJSON

func (p *ParameterInformation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for ParameterInformation.

type Position

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

Position represents a position in a text document (0-based line and character).

type PrepareRenameParams

type PrepareRenameParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

PrepareRenameParams contains the parameters for a PrepareRename request.

type PrepareRenameResult

type PrepareRenameResult struct {
	Range           Range  `json:"-"`
	Placeholder     string `json:"-"`
	DefaultBehavior bool   `json:"-"`
	IsRangeOnly     bool   `json:"-"` // true if only Range is set (not placeholder)
	IsDefault       bool   `json:"-"` // true if defaultBehavior variant
}

PrepareRenameResult contains the result of a PrepareRename request. Per LSP spec, it can be: Range | { range, placeholder } | { defaultBehavior }.

func (PrepareRenameResult) MarshalJSON

func (p PrepareRenameResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for PrepareRenameResult.

func (*PrepareRenameResult) UnmarshalJSON

func (p *PrepareRenameResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for PrepareRenameResult.

type PreviousResultID added in v0.0.19

type PreviousResultID struct {
	URI   string `json:"uri"`
	Value string `json:"value"`
}

PreviousResultID pairs a document URI with a previous diagnostic result ID.

type ProgressParams

type ProgressParams struct {
	Token ProgressToken   `json:"token"`
	Value json.RawMessage `json:"value"`
}

ProgressParams contains the parameters for a $/progress notification.

type ProgressToken

type ProgressToken struct {
	StringValue  string
	IntegerValue int
	IsInteger    bool
}

ProgressToken is either a string or an integer.

func NewWorkDoneToken added in v0.0.19

func NewWorkDoneToken() *ProgressToken

NewWorkDoneToken returns a new ProgressToken with a UUID string value, suitable for use as a workDoneToken in LSP requests.

func (ProgressToken) MarshalJSON

func (p ProgressToken) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ProgressToken) UnmarshalJSON

func (p *ProgressToken) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PublishDiagnosticsParams

type PublishDiagnosticsParams struct {
	URI         string       `json:"uri"`
	Version     int32        `json:"version,omitempty"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

PublishDiagnosticsParams contains the parameters for a textDocument/publishDiagnostics notification.

type Range

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

Range represents a range in a text document.

type ReferenceContext

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

ReferenceContext contains additional information for a references request.

type ReferenceParams

type ReferenceParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	Context       ReferenceContext       `json:"context"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

ReferenceParams contains the parameters for a References request.

type Registration

type Registration struct {
	ID              string          `json:"id"`
	Method          string          `json:"method"`
	RegisterOptions json.RawMessage `json:"registerOptions,omitempty"`
}

Registration represents a capability registration.

type RegistrationParams

type RegistrationParams struct {
	Registrations []Registration `json:"registrations"`
}

RegistrationParams contains the parameters for a client/registerCapability request.

type RelativePattern added in v0.0.26

type RelativePattern struct {
	BaseURI string `json:"baseUri"`
	Pattern string `json:"pattern"`
}

RelativePattern represents a pattern relative to a base URI.

type RenameFile

type RenameFile struct {
	Kind         string             `json:"kind"` // always "rename"
	OldURI       string             `json:"oldUri"`
	NewURI       string             `json:"newUri"`
	Options      *RenameFileOptions `json:"options,omitempty"`
	AnnotationID string             `json:"annotationId,omitempty"`
}

RenameFile represents a rename file operation.

type RenameFileOptions

type RenameFileOptions struct {
	Overwrite      bool `json:"overwrite,omitempty"`
	IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}

RenameFileOptions contains options for renaming a file.

type RenameFilesParams

type RenameFilesParams struct {
	Files []FileRename `json:"files"`
}

RenameFilesParams contains the parameters for file rename events.

type RenameOptions

type RenameOptions struct {
	PrepareProvider bool `json:"prepareProvider,omitempty"`
}

RenameOptions describes the options for the rename provider.

type RenameParams

type RenameParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	NewName       string                 `json:"newName"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

RenameParams contains the parameters for a Rename request.

type SelectionRange

type SelectionRange struct {
	Range  Range           `json:"range"`
	Parent *SelectionRange `json:"parent,omitempty"`
}

SelectionRange represents a selection range.

type SelectionRangeParams

type SelectionRangeParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Positions    []Position             `json:"positions"`
}

SelectionRangeParams contains the parameters for a SelectionRange request.

type SemanticTokens

type SemanticTokens struct {
	ResultID string   `json:"resultId,omitempty"`
	Data     []uint32 `json:"data"`
}

SemanticTokens represents semantic tokens for a document.

type SemanticTokensDelta

type SemanticTokensDelta struct {
	ResultID string               `json:"resultId,omitempty"`
	Edits    []SemanticTokensEdit `json:"edits"`
}

SemanticTokensDelta represents a delta of semantic tokens.

type SemanticTokensDeltaParams

type SemanticTokensDeltaParams struct {
	TextDocument     TextDocumentIdentifier `json:"textDocument"`
	PreviousResultID string                 `json:"previousResultId"`
}

SemanticTokensDeltaParams contains the parameters for a SemanticTokensFullDelta request.

type SemanticTokensEdit

type SemanticTokensEdit struct {
	Start       uint32   `json:"start"`
	DeleteCount uint32   `json:"deleteCount"`
	Data        []uint32 `json:"data,omitempty"`
}

SemanticTokensEdit represents an edit to semantic tokens.

type SemanticTokensLegend

type SemanticTokensLegend struct {
	TokenTypes     []string `json:"tokenTypes"`
	TokenModifiers []string `json:"tokenModifiers"`
}

SemanticTokensLegend describes the legend used by the semantic tokens provider.

type SemanticTokensOptions

type SemanticTokensOptions struct {
	Legend SemanticTokensLegend `json:"legend"`
	Full   bool                 `json:"full,omitempty"`
	Range  bool                 `json:"range,omitempty"`
}

SemanticTokensOptions describes the options for the semantic tokens provider.

type SemanticTokensParams

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

SemanticTokensParams contains the parameters for a SemanticTokensFull request.

type SemanticTokensRangeParams

type SemanticTokensRangeParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Range        Range                  `json:"range"`
}

SemanticTokensRangeParams contains the parameters for a SemanticTokensRange request.

type SemanticTokensResult

type SemanticTokensResult struct {
	SemanticTokens      *SemanticTokens      `json:"-"`
	SemanticTokensDelta *SemanticTokensDelta `json:"-"`
}

SemanticTokensResult represents the result of semanticTokens/full/delta request. Per LSP spec: SemanticTokens | SemanticTokensDelta | null

func (SemanticTokensResult) MarshalJSON

func (r SemanticTokensResult) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for SemanticTokensResult.

func (*SemanticTokensResult) UnmarshalJSON

func (r *SemanticTokensResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for SemanticTokensResult.

type ServerCapabilities

type ServerCapabilities struct {
	CompletionProvider               *CompletionOptions               `json:"completionProvider,omitempty"`
	HoverProvider                    bool                             `json:"hoverProvider,omitempty"`
	SignatureHelpProvider            *SignatureHelpOptions            `json:"signatureHelpProvider,omitempty"`
	DeclarationProvider              bool                             `json:"declarationProvider,omitempty"`
	DefinitionProvider               bool                             `json:"definitionProvider,omitempty"`
	TypeDefinitionProvider           bool                             `json:"typeDefinitionProvider,omitempty"`
	ImplementationProvider           bool                             `json:"implementationProvider,omitempty"`
	ReferencesProvider               bool                             `json:"referencesProvider,omitempty"`
	DocumentHighlightProvider        bool                             `json:"documentHighlightProvider,omitempty"`
	DocumentSymbolProvider           bool                             `json:"documentSymbolProvider,omitempty"`
	CodeActionProvider               *CodeActionOptions               `json:"codeActionProvider,omitempty"`
	CodeLensProvider                 *CodeLensOptions                 `json:"codeLensProvider,omitempty"`
	DocumentFormattingProvider       bool                             `json:"documentFormattingProvider,omitempty"`
	DocumentRangeFormattingProvider  bool                             `json:"documentRangeFormattingProvider,omitempty"`
	RenameProvider                   *RenameOptions                   `json:"renameProvider,omitempty"`
	FoldingRangeProvider             bool                             `json:"foldingRangeProvider,omitempty"`
	SelectionRangeProvider           bool                             `json:"selectionRangeProvider,omitempty"`
	SemanticTokensProvider           *SemanticTokensOptions           `json:"semanticTokensProvider,omitempty"`
	DiagnosticProvider               *DiagnosticOptions               `json:"diagnosticProvider,omitempty"`
	WorkspaceSymbolProvider          bool                             `json:"workspaceSymbolProvider,omitempty"`
	ExecuteCommandProvider           *ExecuteCommandOptions           `json:"executeCommandProvider,omitempty"`
	CallHierarchyProvider            bool                             `json:"callHierarchyProvider,omitempty"`
	DocumentColorProvider            bool                             `json:"documentColorProvider,omitempty"`
	DocumentLinkProvider             *DocumentLinkOptions             `json:"documentLinkProvider,omitempty"`
	DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
	LinkedEditingRangeProvider       bool                             `json:"linkedEditingRangeProvider,omitempty"`
	MonikerProvider                  bool                             `json:"monikerProvider,omitempty"`
	TypeHierarchyProvider            bool                             `json:"typeHierarchyProvider,omitempty"`
	InlayHintProvider                *InlayHintOptions                `json:"inlayHintProvider,omitempty"`
	InlineValueProvider              bool                             `json:"inlineValueProvider,omitempty"`
}

ServerCapabilities describes the capabilities of a language server.

func (*ServerCapabilities) UnmarshalJSON

func (c *ServerCapabilities) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for ServerCapabilities. LSP allows some provider fields to be either bool or options object.

type SetTraceParams

type SetTraceParams struct {
	Value TraceValue `json:"value"`
}

SetTraceParams contains the parameters for a SetTrace notification.

type ShowDocumentParams

type ShowDocumentParams struct {
	URI       string `json:"uri"`
	External  bool   `json:"external,omitempty"`
	TakeFocus bool   `json:"takeFocus,omitempty"`
	Selection *Range `json:"selection,omitempty"`
}

ShowDocumentParams contains the parameters for a ShowDocument request.

type ShowDocumentResult

type ShowDocumentResult struct {
	Success bool `json:"success"`
}

ShowDocumentResult is the result of a showDocument request.

type ShowMessageParams

type ShowMessageParams struct {
	Type    MessageType `json:"type"`
	Message string      `json:"message"`
}

ShowMessageParams contains the parameters for a window/showMessage notification.

type ShowMessageRequestParams

type ShowMessageRequestParams struct {
	Type    MessageType         `json:"type"`
	Message string              `json:"message"`
	Actions []MessageActionItem `json:"actions,omitempty"`
}

ShowMessageRequestParams contains the parameters for a window/showMessageRequest request.

type SignatureHelp

type SignatureHelp struct {
	Signatures      []SignatureInformation `json:"signatures"`
	ActiveSignature uint32                 `json:"activeSignature"`
	ActiveParameter uint32                 `json:"activeParameter"`
}

SignatureHelp represents the signature of something callable.

type SignatureHelpOptions

type SignatureHelpOptions struct {
	TriggerCharacters   []string `json:"triggerCharacters,omitempty"`
	RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
}

SignatureHelpOptions describes the options for the signature help provider.

type SignatureHelpParams

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

SignatureHelpParams contains the parameters for a SignatureHelp request.

type SignatureInformation

type SignatureInformation struct {
	Label               string                 `json:"label"`
	Documentation       *MarkupContent         `json:"-"`
	DocumentationString string                 `json:"-"`
	Parameters          []ParameterInformation `json:"parameters,omitempty"`
}

SignatureInformation represents the signature of something callable.

func (SignatureInformation) MarshalJSON

func (s SignatureInformation) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for SignatureInformation. The "documentation" field is either a string or a MarkupContent object per LSP spec.

func (*SignatureInformation) UnmarshalJSON

func (s *SignatureInformation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for SignatureInformation.

type SymbolInformation

type SymbolInformation struct {
	Name     string     `json:"name"`
	Kind     SymbolKind `json:"kind"`
	Location Location   `json:"location"`
}

SymbolInformation represents information about programming constructs like variables, classes, interfaces etc. (flat version for workspace symbols).

type SymbolKind

type SymbolKind int

SymbolKind enumerates the kind of a symbol.

const (
	SymbolKindFile          SymbolKind = 1
	SymbolKindModule        SymbolKind = 2
	SymbolKindNamespace     SymbolKind = 3
	SymbolKindPackage       SymbolKind = 4
	SymbolKindClass         SymbolKind = 5
	SymbolKindMethod        SymbolKind = 6
	SymbolKindProperty      SymbolKind = 7
	SymbolKindField         SymbolKind = 8
	SymbolKindConstructor   SymbolKind = 9
	SymbolKindEnum          SymbolKind = 10
	SymbolKindInterface     SymbolKind = 11
	SymbolKindFunction      SymbolKind = 12
	SymbolKindVariable      SymbolKind = 13
	SymbolKindConstant      SymbolKind = 14
	SymbolKindString        SymbolKind = 15
	SymbolKindNumber        SymbolKind = 16
	SymbolKindBoolean       SymbolKind = 17
	SymbolKindArray         SymbolKind = 18
	SymbolKindObject        SymbolKind = 19
	SymbolKindKey           SymbolKind = 20
	SymbolKindNull          SymbolKind = 21
	SymbolKindEnumMember    SymbolKind = 22
	SymbolKindStruct        SymbolKind = 23
	SymbolKindEvent         SymbolKind = 24
	SymbolKindOperator      SymbolKind = 25
	SymbolKindTypeParameter SymbolKind = 26
)

type SymbolTag

type SymbolTag int

SymbolTag enumerates tags for symbols.

const (
	SymbolTagDeprecated SymbolTag = 1
)

type TextDocumentContentChangeEvent

type TextDocumentContentChangeEvent struct {
	Range *Range `json:"range,omitempty"`
	Text  string `json:"text"`
}

TextDocumentContentChangeEvent describes a change to a text document.

type TextDocumentEdit

type TextDocumentEdit struct {
	TextDocument   VersionedTextDocumentIdentifier `json:"textDocument"`
	Edits          []TextEdit                      `json:"-"`
	AnnotatedEdits []AnnotatedTextEdit             `json:"-"`
	UseAnnotated   bool                            `json:"-"`
}

TextDocumentEdit represents an edit to a versioned text document. Per LSP spec, edits can be (TextEdit | AnnotatedTextEdit)[].

func (TextDocumentEdit) MarshalJSON

func (t TextDocumentEdit) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for TextDocumentEdit.

func (*TextDocumentEdit) UnmarshalJSON

func (t *TextDocumentEdit) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling for TextDocumentEdit.

type TextDocumentIdentifier

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

TextDocumentIdentifier identifies a text document using a URI.

type TextDocumentItem

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

TextDocumentItem represents an item to transfer a text document from the client to the server.

type TextDocumentPositionParams

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

TextDocumentPositionParams is a parameter literal used in requests to pass a text document and a position inside that document.

type TextDocumentSaveReason

type TextDocumentSaveReason int

TextDocumentSaveReason enumerates the reasons why a text document is saved.

const (
	TextDocumentSaveReasonManual     TextDocumentSaveReason = 1
	TextDocumentSaveReasonAfterDelay TextDocumentSaveReason = 2
	TextDocumentSaveReasonFocusOut   TextDocumentSaveReason = 3
)

type TextEdit

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

TextEdit represents a textual edit applicable to a text document.

type TraceValue

type TraceValue string

TraceValue represents a trace value.

const (
	TraceValueOff      TraceValue = "off"
	TraceValueMessages TraceValue = "messages"
	TraceValueVerbose  TraceValue = "verbose"
)

type TypeDefinitionParams

type TypeDefinitionParams struct {
	TextDocument  TextDocumentIdentifier `json:"textDocument"`
	Position      Position               `json:"position"`
	WorkDoneToken *ProgressToken         `json:"workDoneToken,omitempty"`
}

TypeDefinitionParams contains the parameters for a TypeDefinition request.

type TypeHierarchyItem

type TypeHierarchyItem struct {
	Name           string      `json:"name"`
	Kind           SymbolKind  `json:"kind"`
	Tags           []SymbolTag `json:"tags,omitempty"`
	Detail         string      `json:"detail,omitempty"`
	URI            string      `json:"uri"`
	Range          Range       `json:"range"`
	SelectionRange Range       `json:"selectionRange"`
}

TypeHierarchyItem represents an item in a type hierarchy.

type TypeHierarchyPrepareParams

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

TypeHierarchyPrepareParams contains the parameters for a PrepareTypeHierarchy request.

type TypeHierarchySubtypesParams

type TypeHierarchySubtypesParams struct {
	Item TypeHierarchyItem `json:"item"`
}

TypeHierarchySubtypesParams contains the parameters for a TypeHierarchySubtypes request.

type TypeHierarchySupertypesParams

type TypeHierarchySupertypesParams struct {
	Item TypeHierarchyItem `json:"item"`
}

TypeHierarchySupertypesParams contains the parameters for a TypeHierarchySupertypes request.

type Unregistration

type Unregistration struct {
	ID     string `json:"id"`
	Method string `json:"method"`
}

Unregistration represents a capability unregistration.

type UnregistrationParams

type UnregistrationParams struct {
	Unregistrations []Unregistration `json:"unregisterations"`
}

UnregistrationParams contains the parameters for a client/unregisterCapability request.

type VersionedTextDocumentIdentifier

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

VersionedTextDocumentIdentifier identifies a specific version of a text document.

type WatchKind added in v0.0.26

type WatchKind int

WatchKind enumerates the kind of file system events to watch.

const (
	WatchKindCreate WatchKind = 1
	WatchKindChange WatchKind = 2
	WatchKindDelete WatchKind = 4
)

type WillSaveTextDocumentParams

type WillSaveTextDocumentParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Reason       TextDocumentSaveReason `json:"reason"`
}

WillSaveTextDocumentParams contains the parameters for a WillSave notification/request.

type WorkDoneProgressBegin

type WorkDoneProgressBegin struct {
	Kind        string `json:"kind"` // always "begin"
	Title       string `json:"title"`
	Cancellable bool   `json:"cancellable,omitempty"`
	Message     string `json:"message,omitempty"`
	Percentage  uint32 `json:"percentage,omitempty"`
}

WorkDoneProgressBegin is sent when work starts.

type WorkDoneProgressCancelParams

type WorkDoneProgressCancelParams struct {
	Token string `json:"token"`
}

WorkDoneProgressCancelParams contains the parameters for a WorkDoneProgressCancel notification.

type WorkDoneProgressCreateParams

type WorkDoneProgressCreateParams struct {
	Token ProgressToken `json:"token"`
}

WorkDoneProgressCreateParams contains the parameters for window/workDoneProgress/create request.

type WorkDoneProgressEnd

type WorkDoneProgressEnd struct {
	Kind    string `json:"kind"` // always "end"
	Message string `json:"message,omitempty"`
}

WorkDoneProgressEnd is sent when work ends.

type WorkDoneProgressReport

type WorkDoneProgressReport struct {
	Kind        string `json:"kind"` // always "report"
	Cancellable bool   `json:"cancellable,omitempty"`
	Message     string `json:"message,omitempty"`
	Percentage  uint32 `json:"percentage,omitempty"`
}

WorkDoneProgressReport is sent to report progress.

type WorkspaceDiagnosticParams added in v0.0.19

type WorkspaceDiagnosticParams struct {
	Identifier        string             `json:"identifier,omitempty"`
	PreviousResultIDs []PreviousResultID `json:"previousResultIds,omitempty"`
	WorkDoneToken     string             `json:"workDoneToken,omitempty"`
}

WorkspaceDiagnosticParams contains the parameters for a WorkspaceDiagnostic request.

type WorkspaceDiagnosticReport added in v0.0.19

type WorkspaceDiagnosticReport struct {
	Items []WorkspaceDocumentDiagnosticReport `json:"items"`
}

WorkspaceDiagnosticReport contains the response from a WorkspaceDiagnostic request.

type WorkspaceDocumentDiagnosticReport added in v0.0.19

type WorkspaceDocumentDiagnosticReport struct {
	Kind     string       `json:"kind"`
	ResultID string       `json:"resultId,omitempty"`
	URI      string       `json:"uri"`
	Version  int32        `json:"version,omitempty"`
	Items    []Diagnostic `json:"items,omitempty"`
}

WorkspaceDocumentDiagnosticReport is a per-document diagnostic report within a workspace diagnostic response.

type WorkspaceEdit

type WorkspaceEdit struct {
	Changes         map[string][]TextEdit `json:"changes,omitempty"`
	DocumentChanges []DocumentChange      `json:"documentChanges,omitempty"`
}

WorkspaceEdit represents changes to many resources managed in the workspace. Per LSP spec, documentChanges can be TextDocumentEdit[] or (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[].

type WorkspaceFolder

type WorkspaceFolder struct {
	URI  string `json:"uri"`
	Name string `json:"name"`
}

WorkspaceFolder represents a workspace folder.

type WorkspaceFoldersChangeEvent

type WorkspaceFoldersChangeEvent struct {
	Added   []WorkspaceFolder `json:"added"`
	Removed []WorkspaceFolder `json:"removed"`
}

WorkspaceFoldersChangeEvent represents a workspace folders change event.

type WorkspaceSymbolParams

type WorkspaceSymbolParams struct {
	Query         string         `json:"query"`
	WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"`
}

WorkspaceSymbolParams contains the parameters for a WorkspaceSymbol request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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