Documentation
¶
Overview ¶
Package gopls manages the pinned semantic-intelligence sidecar over LSP.
Index ¶
- Constants
- func OffsetForPosition(contents []byte, position Position) (int, error)
- type Capabilities
- type Client
- type Config
- type Installation
- type Manager
- func (m *Manager) Capabilities() (Capabilities, error)
- func (m *Manager) Close(ctx context.Context) error
- func (m *Manager) Notify(method string, params any) error
- func (m *Manager) Request(ctx context.Context, method string, params, result any, idempotent bool) error
- func (m *Manager) Restart(ctx context.Context) error
- type Position
Constants ¶
const SupportedVersion = "v0.21.0"
SupportedVersion is the only gopls version covered by the current LSP contract suite and release bundle.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Capabilities ¶
type Capabilities struct {
WorkspaceSymbol bool `json:"workspace_symbol"`
Hover bool `json:"hover"`
Definition bool `json:"definition"`
TypeDefinition bool `json:"type_definition"`
References bool `json:"references"`
Implementation bool `json:"implementation"`
DocumentSymbol bool `json:"document_symbol"`
CallHierarchy bool `json:"call_hierarchy"`
Diagnostics bool `json:"diagnostics"`
Rename bool `json:"rename"`
Formatting bool `json:"formatting"`
CodeAction bool `json:"code_action"`
}
Capabilities is the normalized subset of negotiated gopls features used by agentic-go. It records the initialize response rather than assuming support.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client owns one long-lived stdio LSP process.
func (*Client) Capabilities ¶
func (c *Client) Capabilities() Capabilities
Capabilities returns the immutable negotiated capability manifest.
func (*Client) Terminated ¶
Terminated reports whether the sidecar session can no longer serve requests.
type Config ¶
type Config struct {
Command string
Workspace string
ClientVersion string
Args []string
MaxFrame int
InitializeTimeout time.Duration
}
Config describes one managed gopls process.
type Installation ¶
type Installation struct {
Path string `json:"path"`
Version string `json:"version"`
Bundled bool `json:"bundled"`
}
Installation describes the effective semantic sidecar.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the replaceable gopls session for one workspace. It retries at most one idempotent read after a terminal sidecar failure. Mutation is never replayed because the server may have applied an edit before disconnecting.
func NewManager ¶
NewManager starts the initial long-lived sidecar session.
func (*Manager) Capabilities ¶
func (m *Manager) Capabilities() (Capabilities, error)
Capabilities returns the currently negotiated sidecar capabilities.