MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / handleDidSave

Method handleDidSave

pkg/lsp/handler.go:374–395  ·  view source on GitHub ↗

handleDidSave handles document save notifications

(params json.RawMessage)

Source from the content-addressed store, hash-verified

372
373// handleDidSave handles document save notifications
374func (h *Handler) handleDidSave(params json.RawMessage) {
375 var p DidSaveTextDocumentParams
376 if err := json.Unmarshal(params, &p); err != nil {
377 h.server.Logger().Printf("textDocument/didSave: failed to parse params: %v (raw: %s)", err, truncateForLog(params))
378 h.sendParseError("didSave", err)
379 return
380 }
381
382 h.server.Logger().Printf("Document saved: %s", p.TextDocument.URI)
383
384 // If text is included, use it; otherwise get from document manager
385 content := p.Text
386 if content == "" {
387 if c, ok := h.server.Documents().GetContent(p.TextDocument.URI); ok {
388 content = c
389 }
390 }
391
392 if content != "" {
393 h.validateDocument(p.TextDocument.URI, content, 0)
394 }
395}
396
397// validateDocument parses the SQL and publishes diagnostics
398func (h *Handler) validateDocument(uri, content string, version int) {

Callers 1

HandleNotificationMethod · 0.95

Calls 6

sendParseErrorMethod · 0.95
validateDocumentMethod · 0.95
truncateForLogFunction · 0.85
LoggerMethod · 0.80
GetContentMethod · 0.80
DocumentsMethod · 0.80

Tested by

no test coverage detected