Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: implement lsp ping (#14009)

rebelicecf137aedd7e9
diff --git a/backend/api/lsp/handler.go b/backend/api/lsp/handler.go
index 61ba788f44..fba95442f6 100644
--- a/backend/api/lsp/handler.go
+++ b/backend/api/lsp/handler.go
@@ -22,6 +22,7 @@ import (
type Method string
const (
+ LSPMethodPing Method = "$ping"
LSPMethodInitialize Method = "initialize"
LSPMethodInitialized Method = "initialized"
LSPMethodShutdown Method = "shutdown"
@@ -40,6 +41,10 @@ const (
LSPMethodPublishDiagnostics Method = "textDocument/publishDiagnostics"
)
+type PingResult struct {
+ Result string `json:"result"`
+}
+
// NewHandler creates a new Language Server Protocol handler.
func NewHandler(s *store.Store, profile *config.Profile) jsonrpc2.Handler {
return lspHandler{Handler: jsonrpc2.HandlerWithError((&Handler{store: s, profile: profile}).handle)}
@@ -189,6 +194,11 @@ func (h *Handler) handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2
}
}()
+ // Handle ping request before checking if the server is initialized.
+ if Method(req.Method) == LSPMethodPing {
+ return PingResult{Result: "pong"}, nil
+ }
+
if err := h.checkInitialized(req); err != nil {
return nil, err
}