Versions in this module Expand all Collapse all v0 v0.13.0 Nov 27, 2026 v0.12.0 Nov 27, 2026 Changes in this version + var ErrClosed = errors.New("lsp: connection closed") + var ErrNoFormatting = errors.New("lsp: the server does not format documents") + var ErrNoSymbols = errors.New("lsp: the server does not list document symbols") + func FilePath(uri string) (path string, ok bool) + func FileURI(path string) string + type Client struct + func Connect(ctx context.Context, rw io.ReadWriteCloser, cfg Config) (*Client, error) + func Start(ctx context.Context, cfg Config) (*Client, error) + func (c *Client) Close() error + func (c *Client) CodeActions(ctx context.Context, uri string, r Range, diags []Diagnostic) ([]CodeAction, error) + func (c *Client) Completion(ctx context.Context, uri string, pos Position, trigger string) (CompletionList, error) + func (c *Client) CompletionTriggers() []string + func (c *Client) Definition(ctx context.Context, uri string, pos Position) ([]Location, error) + func (c *Client) DidChange(uri string, version int, changes []ContentChange) error + func (c *Client) DidClose(uri string) error + func (c *Client) DidOpen(uri, languageID string, version int, text string) error + func (c *Client) DidSave(uri string, text *string) error + func (c *Client) Done() <-chan struct{} + func (c *Client) Encoding() PositionEncoding + func (c *Client) ExecuteCommand(ctx context.Context, cmd Command) error + func (c *Client) Format(ctx context.Context, uri string, opts FormattingOptions) ([]TextEdit, error) + func (c *Client) HasCodeActions() bool + func (c *Client) HasCompletion() bool + func (c *Client) HasDefinition() bool + func (c *Client) HasFormatting() bool + func (c *Client) HasHover() bool + func (c *Client) HasImplementation() bool + func (c *Client) HasReferences() bool + func (c *Client) HasRename() bool + func (c *Client) HasSignatureHelp() bool + func (c *Client) HasSymbols() bool + func (c *Client) HasTypeDefinition() bool + func (c *Client) Hover(ctx context.Context, uri string, pos Position) (*Hover, error) + func (c *Client) Implementation(ctx context.Context, uri string, pos Position) ([]Location, error) + func (c *Client) References(ctx context.Context, uri string, pos Position, withDeclaration bool) ([]Location, error) + func (c *Client) Rename(ctx context.Context, uri string, pos Position, name string) (WorkspaceEdit, error) + func (c *Client) ResolveCodeAction(ctx context.Context, a CodeAction) (CodeAction, error) + func (c *Client) ResolveCompletion(ctx context.Context, item CompletionItem) (CompletionItem, error) + func (c *Client) SignatureHelp(ctx context.Context, uri string, pos Position, trigger string) (*SignatureHelp, error) + func (c *Client) SignatureTriggers() []string + func (c *Client) Sync() (kind SyncKind, saveText bool) + func (c *Client) TypeDefinition(ctx context.Context, uri string, pos Position) ([]Location, error) + func (c *Client) WatchDiagnostics(uri string, f func(PublishDiagnostics)) (stop func()) + type Code string + func (c *Code) UnmarshalJSON(b []byte) error + type CodeAction struct + Command *Command + Data json.RawMessage + Diagnostics []Diagnostic + Edit *WorkspaceEdit + IsCommand bool + Kind string + Title string + func (a *CodeAction) UnmarshalJSON(b []byte) error + type Command struct + Arguments []json.RawMessage + Command string + Title string + type CompletionItem struct + Data json.RawMessage + Detail string + Documentation Markup + FilterText string + InsertText string + InsertTextFormat InsertTextFormat + Kind CompletionItemKind + Label string + SortText string + TextEdit *TextEdit + type CompletionItemKind int + const KindClass + const KindColor + const KindConstant + const KindConstructor + const KindEnum + const KindEnumMember + const KindEvent + const KindField + const KindFile + const KindFolder + const KindFunction + const KindInterface + const KindKeyword + const KindMethod + const KindModule + const KindOperator + const KindProperty + const KindReference + const KindSnippet + const KindStruct + const KindText + const KindTypeParameter + const KindUnit + const KindValue + const KindVariable + type CompletionList struct + IsIncomplete bool + Items []CompletionItem + func (l *CompletionList) UnmarshalJSON(b []byte) error + type Config struct + Command []string + Env []string + InitializationOptions json.RawMessage + RootDir string + Settings json.RawMessage + Stderr io.Writer + type ContentChange struct + Range *Range + Text string + type Diagnostic struct + Code Code + Message string + Range Range + Severity Severity + Source string + type Document struct + func Attach(c *Client, e *godemirror.Editor, uri string, opts Options) (*Document, error) + func (d *Document) Close() error + func (d *Document) Format(ctx context.Context) error + func (d *Document) Save() error + func (d *Document) Symbols(ctx context.Context) ([]Symbol, error) + type FormattingOptions struct + InsertSpaces bool + TabSize int + type Hover struct + Contents Markup + Range *Range + type InsertTextFormat int + const PlainText + const Snippet + type Location struct + Range Range + URI string + type Markup struct + Kind string + Value string + func (m *Markup) UnmarshalJSON(b []byte) error + type Options struct + Invalidate func() + LanguageID string + OnError func(error) + type ParameterInformation struct + Documentation Markup + End int + Label string + Offsets bool + Start int + func (p *ParameterInformation) UnmarshalJSON(b []byte) error + type Position struct + Character int + Line int + type PositionEncoding string + const UTF16 + const UTF32 + const UTF8 + func (enc PositionEncoding) ByteColumn(line string, character int) int + func (enc PositionEncoding) Character(line string, byteCol int) int + type PublishDiagnostics struct + Diagnostics []Diagnostic + URI string + Version *int + type Range struct + End Position + Start Position + type ResponseError struct + Code int + Data json.RawMessage + Message string + func (e *ResponseError) Error() string + type Severity int + const SeverityError + const SeverityHint + const SeverityInformation + const SeverityWarning + type SignatureHelp struct + ActiveParameter *int + ActiveSignature int + Signatures []SignatureInformation + type SignatureInformation struct + ActiveParameter *int + Documentation Markup + Label string + Parameters []ParameterInformation + type Symbol struct + Children []Symbol + Detail string + Kind SymbolKind + Name string + Range godemirror.Location + Selection godemirror.Location + type SymbolKind int + const SymbolArray + const SymbolBoolean + const SymbolClass + const SymbolConstant + const SymbolConstructor + const SymbolEnum + const SymbolEnumMember + const SymbolEvent + const SymbolField + const SymbolFile + const SymbolFunction + const SymbolInterface + const SymbolKey + const SymbolMethod + const SymbolModule + const SymbolNamespace + const SymbolNull + const SymbolNumber + const SymbolObject + const SymbolOperator + const SymbolPackage + const SymbolProperty + const SymbolString + const SymbolStruct + const SymbolTypeParameter + const SymbolVariable + type SyncKind int + const SyncFull + const SyncIncremental + const SyncNone + type TextEdit struct + NewText string + Range Range + func (t *TextEdit) UnmarshalJSON(b []byte) error + type WorkspaceEdit struct + Changes map[string][]TextEdit + DocumentChanges []json.RawMessage