Documentation
¶
Overview ¶
Package lspclient implements Wirecmd's narrow, server-neutral LSP client.
Index ¶
- Variables
- type Capabilities
- type Command
- type DefinitionTarget
- type Hover
- type HoverBlock
- type Location
- type Point
- type PositionError
- type Range
- type Session
- func (s *Session) Broken() error
- func (s *Session) Capabilities() Capabilities
- func (s *Session) Close() error
- func (s *Session) Declaration(ctx context.Context, target *DefinitionTarget) ([]Location, error)
- func (s *Session) Definition(ctx context.Context, target *DefinitionTarget) ([]Location, error)
- func (s *Session) DocumentSymbols(ctx context.Context, target *DefinitionTarget) ([]Symbol, error)
- func (s *Session) Hover(ctx context.Context, target *DefinitionTarget) ([]Hover, error)
- func (s *Session) Implementation(ctx context.Context, target *DefinitionTarget) ([]Location, error)
- func (s *Session) References(ctx context.Context, target *DefinitionTarget, includeDeclaration bool) ([]Location, error)
- func (s *Session) Status() Status
- func (s *Session) TypeDefinition(ctx context.Context, target *DefinitionTarget) ([]Location, error)
- func (s *Session) WorkspaceSymbols(ctx context.Context, query string) ([]Symbol, error)
- type Status
- type Symbol
Constants ¶
This section is empty.
Variables ¶
var ( ErrStart = errors.New("LSP process could not be started") ErrEncodingUnsupported = errors.New("LSP server selected an unsupported position encoding") ErrResultUnsupported = errors.New("LSP server returned an unsupported location result") ErrServerRequestUnsupported = errors.New("LSP server made an unsupported client request") )
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Declaration bool `json:"declaration"`
Definition bool `json:"definition"`
TypeDefinition bool `json:"type_definition"`
Implementation bool `json:"implementation"`
References bool `json:"references"`
Hover bool `json:"hover"`
DocumentSymbols bool `json:"document_symbols"`
WorkspaceSymbols bool `json:"workspace_symbols"`
PositionEncoding string `json:"position_encoding"`
TextDocumentSync string `json:"text_document_sync"`
OpenClose bool `json:"open_close"`
}
Capabilities is the SDK-independent subset of the initialize result that Wirecmd uses for navigation and document synchronization.
type DefinitionTarget ¶
type DefinitionTarget struct {
// contains filtered or unexported fields
}
DefinitionTarget is a validated snapshot of a definition request. Preparing it before process acquisition prevents invalid local input from starting an LSP server.
func PrepareDocument ¶
func PrepareDocument(path, languageID string) (*DefinitionTarget, error)
PrepareDocument validates and snapshots a disk document without requiring a position. It is used by document-level LSP requests such as document symbols.
func PrepareTarget ¶
func PrepareTarget(path string, line, column uint32, languageID string) (*DefinitionTarget, error)
PrepareTarget validates and snapshots a one-based disk position without starting or consulting an LSP process.
type Hover ¶
type Hover struct {
Range *Range `json:"range,omitempty"`
Content []HoverBlock `json:"content"`
}
Hover is the SDK-independent representation of one non-null hover result.
type HoverBlock ¶
type HoverBlock struct {
Kind string `json:"kind"`
Text string `json:"text"`
Language string `json:"language,omitempty"`
}
HoverBlock is one normalized piece of hover content. Code blocks retain the language supplied by the server; markdown is intentionally kept literal so the caller can choose how to render it.
type PositionError ¶
type PositionError struct{ Message string }
PositionError reports a caller coordinate that cannot address the document.
func (*PositionError) Error ¶
func (e *PositionError) Error() string
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is one initialized LSP process and its disk-document mirror.
func (*Session) Capabilities ¶
func (s *Session) Capabilities() Capabilities
Capabilities returns the negotiated SDK-independent capability summary.
func (*Session) Declaration ¶
Declaration resolves a declaration for a previously validated disk snapshot.
func (*Session) Definition ¶
Definition resolves a previously validated disk snapshot.
func (*Session) DocumentSymbols ¶
DocumentSymbols returns normalized symbols for a previously validated disk snapshot. It preserves hierarchical and flat protocol response forms.
func (*Session) Hover ¶
Hover returns the normalized hover result for a previously validated disk snapshot. A null protocol hover is represented by an empty, non-nil slice.
func (*Session) Implementation ¶
Implementation resolves an implementation for a previously validated disk snapshot.
func (*Session) References ¶
func (s *Session) References(ctx context.Context, target *DefinitionTarget, includeDeclaration bool) ([]Location, error)
References resolves references for a previously validated disk snapshot.
func (*Session) Status ¶
Status returns the negotiated server identity and capabilities. It does not contact the server.
func (*Session) TypeDefinition ¶
TypeDefinition resolves a type definition for a previously validated disk snapshot.
type Status ¶
type Status struct {
ServerName string `json:"server_name,omitempty"`
ServerVersion string `json:"server_version,omitempty"`
Capabilities Capabilities `json:"capabilities"`
}
Status is the observed, SDK-independent identity and capability state of a connected server. Empty identity fields mean the server omitted them.
type Symbol ¶
type Symbol struct {
Name string `json:"name"`
Kind uint32 `json:"kind"`
KindName string `json:"kind_name"`
Path string `json:"path"`
Range Range `json:"range"`
SelectionRange *Range `json:"selection_range,omitempty"`
Detail *string `json:"detail,omitempty"`
ContainerName *string `json:"container_name,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Children []Symbol `json:"children,omitempty"`
}
Symbol is a normalized LSP symbol. Children preserve hierarchical document symbol responses; flat SymbolInformation responses remain flat.