handleDidSave handles document save notifications
(params json.RawMessage)
| 372 | |
| 373 | // handleDidSave handles document save notifications |
| 374 | func (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 |
| 398 | func (h *Handler) validateDocument(uri, content string, version int) { |
no test coverage detected