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

Method validateDocument

pkg/lsp/handler.go:398–417  ·  view source on GitHub ↗

validateDocument parses the SQL and publishes diagnostics

(uri, content string, version int)

Source from the content-addressed store, hash-verified

396
397// validateDocument parses the SQL and publishes diagnostics
398func (h *Handler) validateDocument(uri, content string, version int) {
399 var diagnostics []Diagnostic
400
401 // Use ParseWithRecovery for multi-error diagnostics so the user sees
402 // every problem at once instead of fixing them one-by-one.
403 _, errs := gosqlx.ParseWithRecovery(content)
404 for i, err := range errs {
405 diag := h.createDiagnosticFromError(content, err, i)
406 diagnostics = append(diagnostics, diag)
407 }
408
409 // Publish diagnostics
410 h.server.SendNotification("textDocument/publishDiagnostics", PublishDiagnosticsParams{
411 URI: uri,
412 Version: version,
413 Diagnostics: diagnostics,
414 })
415
416 h.server.Logger().Printf("Published %d diagnostics for %s", len(diagnostics), uri)
417}
418
419// sendParseError sends an error message to the client when notification parsing fails
420func (h *Handler) sendParseError(method string, err error) {

Callers 3

handleDidOpenMethod · 0.95
handleDidChangeMethod · 0.95
handleDidSaveMethod · 0.95

Calls 4

ParseWithRecoveryFunction · 0.92
SendNotificationMethod · 0.80
LoggerMethod · 0.80

Tested by

no test coverage detected