Documentation
¶
Index ¶
- Constants
- func ApplyTextEdits(content string, edits []*pb.TextEdit) (string, error)
- func BuildEditorContext(uri, language, content string, selection *pb.Range) *pb.EditorContext
- func WriteMessage(writer io.Writer, msg *JSONRPCMessage) error
- type Bridge
- func (b *Bridge) ApplyEdits(ctx context.Context, req *pb.ApplyEditsRequest) (*pb.ApplyEditsResponse, error)
- func (b *Bridge) CancelStream(streamID string) error
- func (b *Bridge) ConnectToCoordinator(ctx context.Context) error
- func (b *Bridge) DisconnectFromCoordinator() error
- func (b *Bridge) Exit(ctx context.Context) error
- func (b *Bridge) HandleMessage(ctx context.Context, msg *JSONRPCMessage) *JSONRPCMessage
- func (b *Bridge) HandleStreamQuery(ctx context.Context, query string, callback StreamCallback) (string, error)
- func (b *Bridge) HandleTextQuery(ctx context.Context, query string) (string, error)
- func (b *Bridge) Initialize(ctx context.Context, params InitializeParams) (*InitializeResult, error)
- func (b *Bridge) Initialized(ctx context.Context) error
- func (b *Bridge) ProposeEdits(ctx context.Context, req *pb.ProposeEditsRequest) (*pb.ProposeEditsResponse, error)
- func (b *Bridge) ServeStdio(ctx context.Context, reader io.Reader, writer io.Writer) error
- func (b *Bridge) Shutdown(ctx context.Context) error
- func (b *Bridge) StreamInlineCompletions(ctx context.Context, req *pb.InlineCompletionRequest, ...) (string, error)
- func (b *Bridge) UpdateEditorState(ctx context.Context, req *pb.UpdateEditorStateRequest) (*pb.UpdateEditorStateResponse, error)
- type BridgeConfig
- type CancelParams
- type ClientCapabilities
- type ClientInfo
- type InitializeParams
- type InitializeResult
- type InlineCompletionCallback
- type JSONRPCError
- type JSONRPCMessage
- type ServerCapabilities
- type ServerInfo
- type StreamCallback
- type StreamChunkNotification
- type StreamQueryParams
- type StreamQueryResult
- type TextDocumentClientCapabilities
- type TextDocumentSyncClientCapabilities
- type TextDocumentSyncKind
- type TextDocumentSyncOptions
- type TextQueryParams
- type TextQueryResult
Constants ¶
const ( ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
JSON-RPC error codes
Variables ¶
This section is empty.
Functions ¶
func ApplyTextEdits ¶
ApplyTextEdits applies LSP text edits to the provided content and returns the updated text.
func BuildEditorContext ¶
func BuildEditorContext(uri, language, content string, selection *pb.Range) *pb.EditorContext
BuildEditorContext constructs a minimal EditorContext for a single document.
func WriteMessage ¶
func WriteMessage(writer io.Writer, msg *JSONRPCMessage) error
WriteMessage writes a JSON-RPC message to the writer
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge implements LSP server that bridges to ACP coordinator
func NewBridge ¶
func NewBridge(config *BridgeConfig) (*Bridge, error)
NewBridge creates a new LSP bridge instance
func (*Bridge) ApplyEdits ¶
func (b *Bridge) ApplyEdits(ctx context.Context, req *pb.ApplyEditsRequest) (*pb.ApplyEditsResponse, error)
ApplyEdits forwards apply edits to ACP.
func (*Bridge) CancelStream ¶
CancelStream cancels an active stream by ID
func (*Bridge) ConnectToCoordinator ¶
ConnectToCoordinator establishes gRPC connection to the ACP coordinator
func (*Bridge) DisconnectFromCoordinator ¶
DisconnectFromCoordinator closes the gRPC connection
func (*Bridge) HandleMessage ¶
func (b *Bridge) HandleMessage(ctx context.Context, msg *JSONRPCMessage) *JSONRPCMessage
HandleMessage processes a JSON-RPC message and returns a response
func (*Bridge) HandleStreamQuery ¶
func (b *Bridge) HandleStreamQuery(ctx context.Context, query string, callback StreamCallback) (string, error)
HandleStreamQuery processes a streaming query
func (*Bridge) HandleTextQuery ¶
HandleTextQuery processes a text query and returns a response
func (*Bridge) Initialize ¶
func (b *Bridge) Initialize(ctx context.Context, params InitializeParams) (*InitializeResult, error)
Initialize handles LSP initialize request
func (*Bridge) Initialized ¶
Initialized handles LSP initialized notification
func (*Bridge) ProposeEdits ¶
func (b *Bridge) ProposeEdits(ctx context.Context, req *pb.ProposeEditsRequest) (*pb.ProposeEditsResponse, error)
ProposeEdits calls the ACP propose edits RPC.
func (*Bridge) ServeStdio ¶
ServeStdio starts the LSP server on stdio
func (*Bridge) StreamInlineCompletions ¶
func (b *Bridge) StreamInlineCompletions(ctx context.Context, req *pb.InlineCompletionRequest, cb InlineCompletionCallback) (string, error)
StreamInlineCompletions streams inline completions to the callback.
func (*Bridge) UpdateEditorState ¶
func (b *Bridge) UpdateEditorState(ctx context.Context, req *pb.UpdateEditorStateRequest) (*pb.UpdateEditorStateResponse, error)
UpdateEditorState retrieves editor state snapshot (plan/TODO/approvals).
type BridgeConfig ¶
type BridgeConfig struct {
// CoordinatorAddr is the endpoint for gRPC connection
CoordinatorAddr string
// AgentID for this bridge instance
AgentID string
// Capabilities to advertise
Capabilities []string
}
BridgeConfig holds LSP bridge configuration
type CancelParams ¶
type CancelParams struct {
ID json.RawMessage `json:"id"`
}
CancelParams represents parameters for $/cancelRequest
type ClientCapabilities ¶
type ClientCapabilities struct {
TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"`
}
ClientCapabilities represents client capabilities
type ClientInfo ¶
ClientInfo holds client information
type InitializeParams ¶
type InitializeParams struct {
ProcessID *int `json:"processId"`
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
RootURI string `json:"rootUri"`
Capabilities ClientCapabilities `json:"capabilities"`
}
InitializeParams represents LSP initialize request params
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}
InitializeResult represents LSP initialize response
type InlineCompletionCallback ¶
InlineCompletionCallback receives streamed inline completion text.
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
JSONRPCError represents a JSON-RPC error
type JSONRPCMessage ¶
type JSONRPCMessage 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 *JSONRPCError `json:"error,omitempty"`
}
JSONRPCMessage represents a JSON-RPC 2.0 message
func ReadMessage ¶
func ReadMessage(reader *bufio.Reader) (*JSONRPCMessage, error)
ReadMessage reads a JSON-RPC message from the reader
type ServerCapabilities ¶
type ServerCapabilities struct {
TextDocumentSync *TextDocumentSyncOptions `json:"textDocumentSync,omitempty"`
}
ServerCapabilities represents server capabilities
type ServerInfo ¶
ServerInfo holds server information
type StreamCallback ¶
StreamCallback is called for each chunk in the stream
type StreamChunkNotification ¶
type StreamChunkNotification struct {
StreamID string `json:"streamId"`
Chunk string `json:"chunk"`
Done bool `json:"done"`
}
StreamChunkNotification represents a streaming chunk notification
type StreamQueryParams ¶
type StreamQueryParams struct {
Query string `json:"query"`
}
StreamQueryParams represents parameters for buckley/streamQuery method
type StreamQueryResult ¶
StreamQueryResult represents initial result for buckley/streamQuery method
type TextDocumentClientCapabilities ¶
type TextDocumentClientCapabilities struct {
Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"`
}
TextDocumentClientCapabilities represents text document capabilities
type TextDocumentSyncClientCapabilities ¶
type TextDocumentSyncClientCapabilities struct {
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
TextDocumentSyncClientCapabilities represents sync capabilities
type TextDocumentSyncKind ¶
type TextDocumentSyncKind int
TextDocumentSyncKind defines text document sync modes
const ( TextDocumentSyncKindNone TextDocumentSyncKind = 0 TextDocumentSyncKindFull TextDocumentSyncKind = 1 TextDocumentSyncKindIncremental TextDocumentSyncKind = 2 )
type TextDocumentSyncOptions ¶
type TextDocumentSyncOptions struct {
OpenClose bool `json:"openClose,omitempty"`
Change TextDocumentSyncKind `json:"change,omitempty"`
}
TextDocumentSyncOptions represents text document sync options
type TextQueryParams ¶
type TextQueryParams struct {
Query string `json:"query"`
}
TextQueryParams represents parameters for buckley/textQuery method
type TextQueryResult ¶
TextQueryResult represents result for buckley/textQuery method