Documentation
¶
Overview ¶
Package lsp implements a stateful, persistent JSON-RPC Language Server Protocol (LSP) client for multiplexing language analysis queries directly to a single, persistent gopls daemon.
Package lsp implements a stateful, persistent JSON-RPC Language Server Protocol (LSP) client.
Index ¶
- Variables
- func PathToURI(path string) string
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) GetDefinition(ctx context.Context, filename string, line, col int) ([]Location, error)
- func (c *Client) Initialize(ctx context.Context, initialRoots []string) error
- func (c *Client) SyncRoots(_ context.Context, allRoots []string) error
- type DefinitionParams
- type Location
- type Manager
- type Position
- type Range
- type TextDocumentIdentifier
- type WorkspaceFolder
Constants ¶
This section is empty.
Variables ¶
var GlobalManager = &Manager{}
GlobalManager is the shared, package-level LSP lifecycle controller.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the persistent gopls LSP JSON-RPC client.
func NewClientWithConn ¶
NewClientWithConn creates an LSP client using a pre-established net.Conn connection (ideal for testing).
func (*Client) GetDefinition ¶
func (c *Client) GetDefinition(ctx context.Context, filename string, line, col int) ([]Location, error)
GetDefinition retrieves definition coordinates (converting 1-indexed input to 0-indexed LSP queries).
func (*Client) Initialize ¶
Initialize performs the standard initialize and initialized LSP handshake.
type DefinitionParams ¶
type DefinitionParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
Position Position `json:"position"`
}
DefinitionParams contains parameters for the textDocument/definition request.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates the lifecycle of the single, persistent gopls language server process.
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
URI string `json:"uri"`
}
TextDocumentIdentifier targets a specific file URI.
type WorkspaceFolder ¶ added in v0.20.2
WorkspaceFolder represents a workspace folder in LSP.