Skip to content

Conversation

@kugesan1105
Copy link
Collaborator

@kugesan1105 kugesan1105 commented Jan 20, 2026

Adds multiprocessing worker for GIL-free compilation, scheduler with priority queue and debouncing.

Notes

  1. NEXT PR SHOULD RESOLVE: LSP Performance Bottlenecks
image

… background compilation

- Added `ProgramSnapshot` and `SnapshotManager` for non-blocking LSP queries.
- Introduced `WorkerManager` and `CompilationWorker` for handling background compilation tasks.
- Implemented inter-process communication (IPC) protocol for worker communication.
- Added synchronization primitives including `RWLock` and `AnalysisGate` for thread safety.
- Enhanced `JacLangServer` to handle file open, save, change, and close events with scheduling for analysis.
- Created `AnalysisScheduler` to manage user activity backoff and prioritize analysis tasks.
- Added support for cancellation of in-flight compilation requests.
- Implemented error handling and logging for worker processes.
- Refactor JacLangServer to utilize a scheduler for analysis, improving responsiveness and allowing for cancellation of requests.
- Introduce a LockManager for thread-safe access to shared resources.
- Enhance logging capabilities for better debugging and monitoring.
- Implement health checks for the worker process to ensure reliability and automatic recovery from crashes.
- Add support for cancellation of in-flight requests, improving user experience during rapid typing.
- Update serialization of ProgramSnapshot to handle deep AST structures by temporarily increasing the recursion limit.
- Create a test script to reproduce and validate the pickle recursion issue with AST nodes.
…and responsiveness

- Updated LSP server to use intelligent debounce scheduling and foreground request handling.
- Removed unused snapshot management code to streamline IPC and reduce overhead.
- Enhanced worker process to handle both compilation and foreground LSP requests, minimizing IPC overhead.
- Introduced new methods for handling various LSP requests (hover, definition, etc.) directly in the worker.
- Simplified file change handling to only analyze on save, improving responsiveness during rapid edits.
- Added new utility functions for generating diagnostics from a dictionary.
- Updated test fixture to include additional spacing for clarity.
…nd performance; enhance type checking and analysis scheduling
@kugesan1105
Copy link
Collaborator Author

kugesan1105 commented Jan 28, 2026

VSCode → server.jac → engine.jac → WorkerManager → Worker
            ↓              ↓
        (thin wrapper)  (thin wrapper)

Both server.impl.jac and engine.impl.jac are essentially thin wrappers doing:

server.impl.jac:definition() → just calls ls.get_definition()

kugesan1105 and others added 9 commits January 28, 2026 23:33
… to get the error and warning for jaclang core files
…er communication

- Removed JacLangServer and Workspace dependencies from test utilities.
- Introduced LspTestClient to simulate LSP two-process architecture.
- Updated tests to utilize LspTestClient for compiling files and making requests.
- Simplified hover, definition, and completion assertions using the new client.
- Cleaned up test setup and teardown processes to manage client lifecycle.
…n and add TODO for symbol resolution refactor in tests
@kugesan1105 kugesan1105 force-pushed the lsp_scheduler_infrastructure branch from cf003d2 to 29f8e4d Compare January 28, 2026 22:34
@kugesan1105 kugesan1105 force-pushed the lsp_scheduler_infrastructure branch from 5097850 to f73a605 Compare January 28, 2026 22:38
@kugesan1105 kugesan1105 changed the title LSP- Add scheduler infrastructure with debouncing support Rearchitect LSP: separate main/worker processes for compilation Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP- Add scheduler infrastructure with debouncing support

2 participants