-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
Problem
When an LSP client shuts down, the diagnostics Map and files object are not cleared in the shutdown() method of LSPClient. This can cause:
- Memory retention - Diagnostics data for closed files remains in memory
- Stale data - If the same LSP server is reconnected, old diagnostics may persist
- Memory growth - Over multiple LSP reconnections, maps accumulate entries
Code Location
packages/opencode/src/lsp/client.ts - The shutdown() method closes the connection but doesn't clear internal state.
Proposed Solution
Add cleanup calls in the shutdown() method:
diagnostics.clear()
for (const path in files) delete files[path]Impact
- Minimal change (2 lines)
- Ensures clean state on LSP shutdown
- Prevents memory growth from accumulated diagnostics
Relates to #5363
Metadata
Metadata
Assignees
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization