{"modulePath":"github.com/OpenSIN-Code/SIN-Code-Bundle","version":"v1.7.3","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lsp\n\nSPDX-License-Identifier: MIT Purpose: LSP (Language Server Protocol) client. JSON-RPC 2.0 over stdio with Content-Length framing per the LSP spec. Supports initialize, textDocument/didOpen, didChange, didClose, and the standard textDocument/\\* requests.\n\nSPDX-License-Identifier: MIT Purpose: language registry — detects available LSP servers (gopls, pyright, tsserver) on the system PATH and provides ServerSpec for each so the Client knows how to spawn them.\n\n## Variables\n\n```go\nvar DefaultServers = []ServerSpec{\n\t{Language: \"go\", Binary: \"gopls\", FileExts: []string{\".go\"}},\n\t{Language: \"python\", Binary: \"pyright-langserver\", Args: []string{\"--stdio\"}, Aliases: []string{\"pyright\"}, FileExts: []string{\".py\"}},\n\t{Language: \"python\", Binary: \"pylsp\", FileExts: []string{\".py\"}},\n\t{Language: \"typescript\", Binary: \"typescript-language-server\", Args: []string{\"--stdio\"}, Aliases: []string{\"tsserver\", \"ts-ls\"}, FileExts: []string{\".ts\", \".tsx\"}},\n\t{Language: \"javascript\", Binary: \"typescript-language-server\", Args: []string{\"--stdio\"}, Aliases: []string{\"tsserver\"}, FileExts: []string{\".js\", \".jsx\"}},\n\t{Language: \"rust\", Binary: \"rust-analyzer\", FileExts: []string{\".rs\"}},\n}\n```\n\n## Functions\n\n```go\nfunc LanguageForFile(path string) string\n```\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc Start(binary string, args []string, lang, rootURI string) (*Client, error)\n```\n\n```go\nfunc (c *Client) Call(method string, params any, result any, timeout time.Duration) error\n```\n\n```go\nfunc (c *Client) Close() error\n```\n\n```go\nfunc (c *Client) Definition(uri string, pos Position) ([]Location, error)\n```\n\n```go\nfunc (c *Client) DefinitionRaw(uri string, pos Position) (string, error)\n```\n\n```go\nfunc (c *Client) DidChange(uri string, version int, changes []TextDocumentContentChangeEvent) error\n```\n\n```go\nfunc (c *Client) DidClose(uri string) error\n```\n\n```go\nfunc (c *Client) DidOpen(doc TextDocumentItem) error\n```\n\n```go\nfunc (c *Client) Format(uri string) ([]TextEdit, error)\n```\n\n```go\nfunc (c *Client) Hover(uri string, pos Position) (*Hover, error)\n```\n\n```go\nfunc (c *Client) Lang() string\n```\n\n```go\nfunc (c *Client) Notify(method string, params any) error\n```\n\n```go\nfunc (c *Client) References(uri string, pos Position, includeDecl bool) ([]Location, error)\n```\n\n```go\nfunc (c *Client) Rename(uri string, pos Position, newName string) (*WorkspaceEdit, error)\n```\n\n```go\nfunc (c *Client) RootURI() string\n```\n\n```go\nfunc (c *Client) SetNotificationHandler(fn func(method string, params json.RawMessage))\n```\nSetNotificationHandler registers a callback for server-to-client notifications (window/logMessage, $/progress, etc.). Notifications are received in addition to response frames — they don't replace responses.\n\n```go\nfunc (c *Client) Symbols(uri string) ([]DocumentSymbol, error)\n```\n\n```go\ntype ClientCapabilities struct {\n\tTextDocument map[string]any `json:\"textDocument,omitempty\"`\n\tWorkspace    map[string]any `json:\"workspace,omitempty\"`\n}\n```\n\n```go\ntype Diagnostic struct {\n\tRange    Range  `json:\"range\"`\n\tSeverity *int   `json:\"severity,omitempty\"`\n\tCode     any    `json:\"code,omitempty\"`\n\tSource   string `json:\"source,omitempty\"`\n\tMessage  string `json:\"message\"`\n}\n```\n\n```go\ntype DocumentSymbol struct {\n\tName           string           `json:\"name\"`\n\tDetail         string           `json:\"detail,omitempty\"`\n\tKind           int              `json:\"kind\"`\n\tTags           []any            `json:\"tags,omitempty\"`\n\tDeprecated     *bool            `json:\"deprecated,omitempty\"`\n\tRange          Range            `json:\"range\"`\n\tSelectionRange Range            `json:\"selectionRange\"`\n\tChildren       []DocumentSymbol `json:\"children,omitempty\"`\n}\n```\n\n```go\ntype Hover struct {\n\tContents any    `json:\"contents\"`\n\tRange    *Range `json:\"range,omitempty\"`\n}\n```\n\n```go\ntype InitializeParams struct {\n\tProcessID    int                `json:\"processId\"`\n\tRootURI      string             `json:\"rootUri\"`\n\tCapabilities ClientCapabilities `json:\"capabilities\"`\n\tClientInfo   map[string]string  `json:\"clientInfo,omitempty\"`\n}\n```\n\n```go\ntype InitializeResult struct {\n\tCapabilities ServerCapabilities `json:\"capabilities\"`\n\tServerInfo   map[string]string  `json:\"serverInfo,omitempty\"`\n}\n```\n\n```go\ntype Location struct {\n\tURI   string `json:\"uri\"`\n\tRange Range  `json:\"range\"`\n}\n```\n\n```go\ntype LocationLink struct {\n\tOriginSelectionRange *Range `json:\"originSelectionRange,omitempty\"`\n\tTargetURI            string `json:\"targetUri\"`\n\tTargetRange          Range  `json:\"targetRange\"`\n\tTargetSelectionRange Range  `json:\"targetSelectionRange\"`\n}\n```\n\n```go\ntype Manager struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewManager() *Manager\n```\n\n```go\nfunc (m *Manager) Close()\n```\n\n```go\nfunc (m *Manager) Get(lang, rootURI string) (*Client, error)\n```\n\n```go\ntype Position struct {\n\tLine      int `json:\"line\"`\n\tCharacter int `json:\"character\"`\n}\n```\n\n```go\ntype PublishDiagnosticsParams struct {\n\tURI         string       `json:\"uri\"`\n\tDiagnostics []Diagnostic `json:\"diagnostics\"`\n}\n```\n\n```go\ntype Range struct {\n\tStart Position `json:\"start\"`\n\tEnd   Position `json:\"end\"`\n}\n```\n\n```go\ntype RenameParams struct {\n\tTextDocument TextDocumentIdentifier `json:\"textDocument\"`\n\tPosition     Position               `json:\"position\"`\n\tNewName      string                 `json:\"newName\"`\n}\n```\n\n```go\ntype Response struct {\n\tJSONRPC string          `json:\"jsonrpc\"`\n\tID      any             `json:\"id,omitempty\"`\n\tResult  json.RawMessage `json:\"result,omitempty\"`\n\tError   *ResponseError  `json:\"error,omitempty\"`\n\tMethod  string          `json:\"method,omitempty\"`\n\tParams  json.RawMessage `json:\"params,omitempty\"`\n}\n```\n\n```go\ntype ResponseError struct {\n\tCode    int    `json:\"code\"`\n\tMessage string `json:\"message\"`\n\tData    any    `json:\"data,omitempty\"`\n}\n```\n\n```go\ntype ServerCapabilities struct {\n\tTextDocumentSync           any `json:\"textDocumentSync,omitempty\"`\n\tHoverProvider              any `json:\"hoverProvider,omitempty\"`\n\tDefinitionProvider         any `json:\"definitionProvider,omitempty\"`\n\tReferencesProvider         any `json:\"referencesProvider,omitempty\"`\n\tRenameProvider             any `json:\"renameProvider,omitempty\"`\n\tDocumentFormattingProvider any `json:\"documentFormattingProvider,omitempty\"`\n\tDocumentSymbolProvider     any `json:\"documentSymbolProvider,omitempty\"`\n\tCodeActionProvider         any `json:\"codeActionProvider,omitempty\"`\n\tCompletionProvider         any `json:\"completionProvider,omitempty\"`\n}\n```\n\n```go\ntype ServerSpec struct {\n\tLanguage string\n\tBinary   string\n\tArgs     []string\n\tAliases  []string\n\tFileExts []string\n}\n```\n\n```go\nfunc DetectAvailable() []ServerSpec\n```\n\n```go\ntype SymbolInformation struct {\n\tName          string   `json:\"name\"`\n\tKind          int      `json:\"kind\"`\n\tDeprecated    *bool    `json:\"deprecated,omitempty\"`\n\tLocation      Location `json:\"location\"`\n\tContainerName string   `json:\"containerName,omitempty\"`\n}\n```\n\n```go\ntype TextDocumentContentChangeEvent struct {\n\tRange       *Range `json:\"range,omitempty\"`\n\tRangeLength *int   `json:\"rangeLength,omitempty\"`\n\tText        string `json:\"text\"`\n}\n```\n\n```go\ntype TextDocumentIdentifier struct {\n\tURI string `json:\"uri\"`\n}\n```\n\n```go\ntype TextDocumentItem struct {\n\tURI        string `json:\"uri\"`\n\tLanguageID string `json:\"languageId\"`\n\tVersion    int    `json:\"version\"`\n\tText       string `json:\"text\"`\n}\n```\n\n```go\ntype TextDocumentPositionParams struct {\n\tTextDocument TextDocumentIdentifier `json:\"textDocument\"`\n\tPosition     Position               `json:\"position\"`\n}\n```\n\n```go\ntype TextEdit struct {\n\tRange   Range  `json:\"range\"`\n\tNewText string `json:\"newText\"`\n}\n```\n\n```go\ntype VersionedTextDocumentIdentifier struct {\n\tURI     string `json:\"uri\"`\n\tVersion int    `json:\"version\"`\n}\n```\n\n```go\ntype WorkspaceEdit struct {\n\tChanges map[string][]TextEdit `json:\"changes,omitempty\"`\n}\n```\n\n","path":"github.com/OpenSIN-Code/SIN-Code-Bundle/cmd/sin-code/internal/lsp","name":"lsp","synopsis":"SPDX-License-Identifier: MIT Purpose: LSP (Language Server Protocol) client.","isRedistributable":true}
