lsp

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallHierarchyIncomingCall

type CallHierarchyIncomingCall struct {
	From       CallHierarchyItem `json:"from"`
	FromRanges []Range           `json:"fromRanges"`
}

CallHierarchyIncomingCall represents an incoming call.

type CallHierarchyIncomingCallsParams

type CallHierarchyIncomingCallsParams struct {
	Item CallHierarchyItem `json:"item"`
}

CallHierarchyIncomingCallsParams represents parameters for callHierarchy/incomingCalls.

type CallHierarchyItem

type CallHierarchyItem struct {
	Name           string      `json:"name"`
	Kind           int         `json:"kind"`
	Tags           []int       `json:"tags,omitempty"`
	Detail         string      `json:"detail,omitempty"`
	URI            string      `json:"uri"`
	Range          Range       `json:"range"`
	SelectionRange Range       `json:"selectionRange"`
	Data           interface{} `json:"data,omitempty"`
}

CallHierarchyItem represents an item in a call hierarchy.

type CallHierarchyOutgoingCall

type CallHierarchyOutgoingCall struct {
	To         CallHierarchyItem `json:"to"`
	FromRanges []Range           `json:"fromRanges"`
}

CallHierarchyOutgoingCall represents an outgoing call.

type CallHierarchyOutgoingCallsParams

type CallHierarchyOutgoingCallsParams struct {
	Item CallHierarchyItem `json:"item"`
}

CallHierarchyOutgoingCallsParams represents parameters for callHierarchy/outgoingCalls.

type CallHierarchyPrepareParams

type CallHierarchyPrepareParams struct {
	TextDocumentPositionParams
}

CallHierarchyPrepareParams represents parameters for textDocument/prepareCallHierarchy.

type ClientCapabilities

type ClientCapabilities struct {
	TextDocument struct {
		Definition struct {
			DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
		} `json:"definition,omitempty"`
		References struct {
			DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
		} `json:"references,omitempty"`
		Hover struct {
			ContentFormat []string `json:"contentFormat,omitempty"`
		} `json:"hover,omitempty"`
	} `json:"textDocument,omitempty"`
}

ClientCapabilities represents the capabilities of the LSP client.

type DefinitionParams

type DefinitionParams struct {
	TextDocumentPositionParams
}

DefinitionParams represents parameters for the textDocument/definition request.

type Hover

type Hover struct {
	Contents MarkupContent `json:"contents"`
	Range    *Range        `json:"range,omitempty"`
}

Hover represents the result of a hover request.

type HoverParams

type HoverParams struct {
	TextDocumentPositionParams
}

HoverParams represents parameters for the textDocument/hover request.

type ImplementationParams

type ImplementationParams struct {
	TextDocumentPositionParams
}

ImplementationParams represents parameters for the textDocument/implementation request.

type InitializeParams

type InitializeParams struct {
	ProcessID        int                `json:"processId"`
	RootURI          string             `json:"rootUri,omitempty"`
	Capabilities     ClientCapabilities `json:"capabilities"`
	WorkspaceFolders []WorkspaceFolder  `json:"workspaceFolders,omitempty"`
}

InitializeParams represents parameters for the initialize request.

type JSONRPCError

type JSONRPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

JSONRPCError represents a JSON-RPC 2.0 error.

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

JSONRPCRequest represents a JSON-RPC 2.0 request.

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *JSONRPCError   `json:"error,omitempty"`
}

JSONRPCResponse represents a JSON-RPC 2.0 response.

type LSPClient

type LSPClient interface {
	Definition(ctx context.Context, params DefinitionParams) ([]Location, error)
	Implementation(ctx context.Context, params ImplementationParams) ([]Location, error)
	References(ctx context.Context, params ReferenceParams) ([]Location, error)
	Hover(ctx context.Context, params HoverParams) (*Hover, error)

	// Call Hierarchy (Omniscience V2)
	PrepareCallHierarchy(ctx context.Context, params CallHierarchyPrepareParams) ([]CallHierarchyItem, error)
	IncomingCalls(ctx context.Context, params CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error)
	OutgoingCalls(ctx context.Context, params CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error)

	Close() error
}

LSPClient defines the interface for an LSP client.

func NewClient

func NewClient(ctx context.Context, dir string, binary string, args ...string) (LSPClient, error)

func NewSocketClient

func NewSocketClient(ctx context.Context, network, address string) (LSPClient, error)

NewSocketClient connects to an existing LSP server via a Unix socket.

type Location

type Location struct {
	URI   string `json:"uri"`
	Range Range  `json:"range"`
}

Location represents a location in a text document.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func GetGlobalManager

func GetGlobalManager() *Manager

func NewManager

func NewManager() *Manager

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) GetClient

func (m *Manager) GetClient(ctx context.Context, filePath string) (LSPClient, error)

func (*Manager) SetClientCreatorForTest

func (m *Manager) SetClientCreatorForTest(fn func(ctx context.Context, dir string, binary string, args ...string) (LSPClient, error))

type MarkupContent

type MarkupContent struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

MarkupContent represents a markup content.

type Position

type Position struct {
	Line      int `json:"line"`      // 0-based
	Character int `json:"character"` // 0-based
}

Position represents a symbol's position in a text document.

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Range represents a range in a text document.

type ReferenceContext

type ReferenceContext struct {
	IncludeDeclaration bool `json:"includeDeclaration"`
}

ReferenceContext represents context for the textDocument/references request.

type ReferenceParams

type ReferenceParams struct {
	TextDocumentPositionParams
	Context ReferenceContext `json:"context"`
}

ReferenceParams represents parameters for the textDocument/references request.

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	URI string `json:"uri"`
}

TextDocumentIdentifier represents a text document's URI.

type TextDocumentPositionParams

type TextDocumentPositionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     Position               `json:"position"`
}

TextDocumentPositionParams represents parameters for requests at a position.

type WorkspaceFolder

type WorkspaceFolder struct {
	URI  string `json:"uri"`
	Name string `json:"name"`
}

WorkspaceFolder represents a workspace folder in LSP.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL