Description
The LSP server integration (src/server.ts) is a stub with several issues:
- Memory leak —
handleServerMessage creates a new DiagnosticCollection on every message instead of reusing a single collection
- No proper LSP protocol handling — Only handles
publishDiagnostics but ignores initialization, capabilities, shutdown, etc.
- No lifecycle management — The server is never started or stopped; it is defined but not used in
extension.ts
- No error recovery — If the server process crashes, there is no restart logic
Required Changes
Fix diagnostic collection leak
- Create the diagnostic collection once in the constructor
- Reuse it across all
publishDiagnostics messages
Implement basic LSP lifecycle
- Handle
initialize request with capabilities response
- Handle
shutdown and exit notifications
- Properly track client-server state
Wire server into extension lifecycle
- Start the server in
activate() when configured
- Stop the server in
deactivate()
- Add a configuration option to enable/disable LSP mode
Add crash recovery
- Restart the server process if it exits unexpectedly
- Limit restart attempts to avoid infinite loops
- Log restart events to output channel
Acceptance Criteria
Complexity
High — requires understanding of LSP protocol, child process management, and integration with VS Code diagnostic APIs.
Points
200
Description
The LSP server integration (
src/server.ts) is a stub with several issues:handleServerMessagecreates a newDiagnosticCollectionon every message instead of reusing a single collectionpublishDiagnosticsbut ignores initialization, capabilities, shutdown, etc.extension.tsRequired Changes
Fix diagnostic collection leak
publishDiagnosticsmessagesImplement basic LSP lifecycle
initializerequest with capabilities responseshutdownandexitnotificationsWire server into extension lifecycle
activate()when configureddeactivate()Add crash recovery
Acceptance Criteria
Complexity
High — requires understanding of LSP protocol, child process management, and integration with VS Code diagnostic APIs.
Points
200