removeAndCleanup removes a Document and frees associated resources.
(uri uri.URI)
| 270 | |
| 271 | // removeAndCleanup removes a Document and frees associated resources. |
| 272 | func (m *Manager) removeAndCleanup(uri uri.URI) { |
| 273 | if existing, ok := m.docs[uri]; ok { |
| 274 | existing.Close() |
| 275 | delete(m.docs, uri) |
| 276 | } |
| 277 | |
| 278 | if lock, ok := m.diagnosticsProcessing[uri]; ok { |
| 279 | lock.mu.Lock() |
| 280 | defer lock.mu.Unlock() |
| 281 | // resets the debounced function to avoid parsing a document |
| 282 | // that has already been closed |
| 283 | lock.queue(func() {}) |
| 284 | delete(m.diagnosticsProcessing, uri) |
| 285 | } |
| 286 | } |