Documentation
¶
Overview ¶
Package lsp is the stdio language server behind `wtctl lsp` (LSP 3.17): production latency and error lenses and hovers on functions. It sends only file paths and function names to the API, never source text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
BaseURL string // WT_API_URL
Key string // WT_API_KEY
HTTP *http.Client
// contains filtered or unexported fields
}
Client calls the Watchtower API. It sends only the service, file path and function names.
func (*Client) CodeStats ¶
func (c *Client) CodeStats(ctx context.Context, project, service, file string, funcs []string) (map[string]Stat, error)
CodeStats returns stats by function name; functions with no data are absent.
func (*Client) LogsAt ¶ added in v0.3.1
func (c *Client) LogsAt(ctx context.Context, project, service, file string, line int, lit string) (LogSite, error)
LogsAt asks POST /logs/search for the last 24h of records logged at file:line (1-based).
When no record carries the location and lit is not empty, it falls back to records whose body contains lit.
type Config ¶
type Config struct {
Service string `yaml:"service"`
PathPrefixes []string `yaml:"path_prefixes"`
Project string `yaml:"project"`
}
Config is watchtower.yaml in the repository root.
func LoadConfig ¶
LoadConfig reads root/watchtower.yaml. A missing file is not an error: nothing maps.
type LogSite ¶ added in v0.3.1
type LogSite struct {
Lines []string // newest first, "severity body"
Count int // matched lines in the window (capped at logWindow)
More bool
}
LogSite is what the logs API holds for one source line.
type Server ¶
type Server struct {
API *Client
WebURL string // base of issue and trace links; defaults to the API URL
// contains filtered or unexported fields
}
Server is one LSP session.
type Stat ¶
type Stat struct {
Function string `json:"function"`
Count uint64 `json:"count"`
Errors uint64 `json:"errors"`
P50Ms float64 `json:"p50_ms"`
P95Ms float64 `json:"p95_ms"`
LastIssue *struct {
ID string `json:"id"`
Title string `json:"title"`
} `json:"last_issue"`
TraceExample string `json:"trace_example"`
}
Stat mirrors one entry of GET /v1/projects/{p}/code-stats.