Interface-based handlers
Implement only the LSP features you need. The server registers methods and advertises capabilities automatically.
go-lsp handles JSON-RPC framing, method dispatch, LSP protocol types, document state, testing, and debugging tools so your server code can focus on language behavior.
go get github.com/owenrumney/go-lsp
type Handler struct{}
func (h *Handler) Initialize(context.Context, *lsp.InitializeParams) (*lsp.InitializeResult, error) {
return &lsp.InitializeResult{
ServerInfo: &lsp.ServerInfo{Name: "mylang", Version: "0.1.0"},
}, nil
}
func (h *Handler) Shutdown(context.Context) error { return nil }
func main() {
srv := server.NewServer(&Handler{})
log.Fatal(srv.Run(context.Background(), server.RunStdio()))
}
Implement only the LSP features you need. The server registers methods and advertises capabilities automatically.
document.Store applies full or incremental sync and handles UTF-16 LSP positions.
servertest simulates an LSP client over in-memory pipes for focused handler tests.
The debug UI captures live traffic, logs, timelines, and exportable traces for bug reports.