Documentation
¶
Overview ¶
Package lsp implements the sqletch language server (docs/design/10-lsp.md): JSON-RPC 2.0 over stdio, a subset of the Language Server Protocol (diagnostics + go-to-definition), backed by an injected Workspace checker so the protocol layer never touches dialect drivers or the pipeline directly.
Index ¶
- func Serve(in io.Reader, out io.Writer, ws Workspace, initErr string, logW io.Writer) int
- type ContentChange
- type DefinitionParams
- type Diagnostic
- type DidChangeParams
- type DidCloseParams
- type DidOpenParams
- type DidSaveParams
- type InitializeResult
- type Location
- type Message
- type Position
- type PublishDiagnosticsParams
- type Range
- type ResponseError
- type ServerCapabilities
- type ServerInfo
- type ShowMessageParams
- type TextDocumentIdentifier
- type TextDocumentItem
- type Workspace
- type WorkspaceResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
Serve runs the language server until the client's exit notification or a transport failure, returning the process exit code (0 after an orderly shutdown, 1 otherwise). ws == nil serves the degraded mode of docs/design/10-lsp.md §6: initErr is reported once via window/showMessage and every request answers empty.
Types ¶
type ContentChange ¶
type ContentChange struct {
Text string `json:"text"`
}
type DefinitionParams ¶
type DefinitionParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
Position Position `json:"position"`
}
type Diagnostic ¶
type DidChangeParams ¶
type DidChangeParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
// Full sync: the last element carries the complete new content.
ContentChanges []ContentChange `json:"contentChanges"`
}
type DidCloseParams ¶
type DidCloseParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type DidOpenParams ¶
type DidOpenParams struct {
TextDocument TextDocumentItem `json:"textDocument"`
}
type DidSaveParams ¶
type DidSaveParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
type Message ¶
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID *json.RawMessage `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *ResponseError `json:"error,omitempty"`
}
Message is a JSON-RPC 2.0 request, notification, or response; unset members are omitted on the wire.
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct {
URI string `json:"uri"`
Diagnostics []Diagnostic `json:"diagnostics"`
}
type ResponseError ¶
type ServerCapabilities ¶
type ServerInfo ¶
type ShowMessageParams ¶
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
URI string `json:"uri"`
}
type TextDocumentItem ¶
type Workspace ¶
type Workspace interface {
Check(overlay map[string][]byte) (WorkspaceResult, error)
}
Workspace is the analysis seam: internal/cli injects its OfflineChecker so the protocol layer stays free of dialect drivers. Check runs one consistent offline snapshot with overlay (open buffer) contents replacing disk.
type WorkspaceResult ¶
type WorkspaceResult struct {
Diags map[string][]diagnostics.Diagnostic
Files map[string]*template.QueryFile
Sources map[string][]byte
}
WorkspaceResult mirrors cli.WorkspaceCheck, keyed by absolute path.