handleDidClose handles document close notifications
(params json.RawMessage)
| 344 | |
| 345 | // handleDidClose handles document close notifications |
| 346 | func (h *Handler) handleDidClose(params json.RawMessage) { |
| 347 | var p DidCloseTextDocumentParams |
| 348 | if err := json.Unmarshal(params, &p); err != nil { |
| 349 | h.server.Logger().Printf("textDocument/didClose: failed to parse params: %v (raw: %s)", err, truncateForLog(params)) |
| 350 | h.sendParseError("didClose", err) |
| 351 | return |
| 352 | } |
| 353 | |
| 354 | h.server.Logger().Printf("Document closed: %s", p.TextDocument.URI) |
| 355 | |
| 356 | // Cancel any pending debounce timer for this document |
| 357 | h.debounceMu.Lock() |
| 358 | if t, ok := h.debounceTimers[p.TextDocument.URI]; ok { |
| 359 | t.Stop() |
| 360 | delete(h.debounceTimers, p.TextDocument.URI) |
| 361 | } |
| 362 | h.debounceMu.Unlock() |
| 363 | |
| 364 | h.server.Documents().Close(p.TextDocument.URI) |
| 365 | |
| 366 | // Clear diagnostics for closed document |
| 367 | h.server.SendNotification("textDocument/publishDiagnostics", PublishDiagnosticsParams{ |
| 368 | URI: p.TextDocument.URI, |
| 369 | Diagnostics: []Diagnostic{}, |
| 370 | }) |
| 371 | } |
| 372 | |
| 373 | // handleDidSave handles document save notifications |
| 374 | func (h *Handler) handleDidSave(params json.RawMessage) { |
no test coverage detected