lsp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoInstallLSP

func AutoInstallLSP(lang string) (string, error)

func FindLSPBinary

func FindLSPBinary(lang string) (string, error)

FindLSPBinary resolves the path to an LSP executable.

func PathToURI

func PathToURI(path string) string

func URIToPath

func URIToPath(uriStr string) (string, error)

Types

type LSPClient

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

func NewLSPClient

func NewLSPClient(binaryPath string, args []string) (*LSPClient, error)

NewLSPClient spawns the LSP binary and connects to standard IO.

func (*LSPClient) Close

func (c *LSPClient) Close()

func (*LSPClient) DidOpen

func (c *LSPClient) DidOpen(filePath, text string) error

func (*LSPClient) Initialize

func (c *LSPClient) Initialize(ctx context.Context, workspacePath string) error

func (*LSPClient) References

func (c *LSPClient) References(ctx context.Context, filePath string, line, character int64) ([]Location, error)

type LSPManager

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

LSPManager wraps all active LSPs for different languages.

func NewLSPManager

func NewLSPManager(workspaceRoot string) *LSPManager

func (*LSPManager) Close

func (m *LSPManager) Close()

func (*LSPManager) GetClient

func (m *LSPManager) GetClient(lang string) (*LSPClient, error)

GetClient retrieves or spawns the LSP client for the given language.

type Location

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

type Notification

type Notification struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
}

type Position

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

type Range

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

type Request

type Request struct {
	JSONRPC string `json:"jsonrpc"`
	ID      int64  `json:"id"`
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
}

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      *int64          `json:"id,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *ResponseError  `json:"error,omitempty"`
}

type ResponseError

type ResponseError struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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