feat(lsp): implement LspRuntime core — server lifecycle, workspace mapping, file synchronization #7427

Open
opened 2026-04-10 19:13:12 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit Message: feat(lsp): implement LspRuntime core — server lifecycle, workspace mapping, file synchronization
  • Branch: feature/m6-lsp-runtime-core
  • Milestone: v3.5.0
  • Parent Epic: #934

Background and Context

The LspRuntime class in src/cleveragents/lsp/runtime.py is entirely a stub — all methods raise LspNotAvailableError. This issue implements the core lifecycle management: starting/stopping LSP servers, mapping workspaces, and synchronizing files.

Expected Behavior

  1. LspRuntime.start_server() — lazily starts the appropriate LSP server for a language, maps workspace root
  2. LspRuntime.stop_server() — gracefully shuts down the LSP server with proper cleanup
  3. File synchronization — textDocument/didOpen, textDocument/didChange, textDocument/didClose notifications sent to LSP server when files change

Acceptance Criteria

  • LspRuntime.start_server(language, workspace_root) starts LSP server via LspServer — lazy activation (only starts when first needed)
  • LspRuntime.stop_server(language) sends shutdown + exit to LSP server and cleans up resources
  • Workspace mapping: LSP server initialized with correct rootUri and workspaceFolders
  • File sync: textDocument/didOpen sent when actor opens a file
  • File sync: textDocument/didChange sent when file content changes
  • File sync: textDocument/didClose sent when actor closes a file
  • Multiple LSP servers can run concurrently (one per language)
  • BDD scenarios cover server lifecycle and file synchronization
  • Coverage >= 97%

Subtasks

  • Implement LspRuntime.start_server() with lazy activation and workspace initialization
  • Implement LspRuntime.stop_server() with graceful shutdown sequence
  • Implement workspace mapping in LspRuntime._initialize_workspace()
  • Implement LspRuntime.sync_file_open() — send textDocument/didOpen
  • Implement LspRuntime.sync_file_change() — send textDocument/didChange
  • Implement LspRuntime.sync_file_close() — send textDocument/didClose
  • Tests (Behave): Add scenarios for server lifecycle (start, stop, restart)
  • Tests (Behave): Add scenarios for file synchronization
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Supervisor: Epic Planner | Agent: epic-planning-pool-supervisor

## Metadata - **Commit Message**: `feat(lsp): implement LspRuntime core — server lifecycle, workspace mapping, file synchronization` - **Branch**: `feature/m6-lsp-runtime-core` - **Milestone**: v3.5.0 - **Parent Epic**: #934 ## Background and Context The `LspRuntime` class in `src/cleveragents/lsp/runtime.py` is entirely a stub — all methods raise `LspNotAvailableError`. This issue implements the core lifecycle management: starting/stopping LSP servers, mapping workspaces, and synchronizing files. ## Expected Behavior 1. `LspRuntime.start_server()` — lazily starts the appropriate LSP server for a language, maps workspace root 2. `LspRuntime.stop_server()` — gracefully shuts down the LSP server with proper cleanup 3. File synchronization — `textDocument/didOpen`, `textDocument/didChange`, `textDocument/didClose` notifications sent to LSP server when files change ## Acceptance Criteria - [ ] `LspRuntime.start_server(language, workspace_root)` starts LSP server via `LspServer` — lazy activation (only starts when first needed) - [ ] `LspRuntime.stop_server(language)` sends `shutdown` + `exit` to LSP server and cleans up resources - [ ] Workspace mapping: LSP server initialized with correct `rootUri` and `workspaceFolders` - [ ] File sync: `textDocument/didOpen` sent when actor opens a file - [ ] File sync: `textDocument/didChange` sent when file content changes - [ ] File sync: `textDocument/didClose` sent when actor closes a file - [ ] Multiple LSP servers can run concurrently (one per language) - [ ] BDD scenarios cover server lifecycle and file synchronization - [ ] Coverage >= 97% ## Subtasks - [ ] Implement `LspRuntime.start_server()` with lazy activation and workspace initialization - [ ] Implement `LspRuntime.stop_server()` with graceful shutdown sequence - [ ] Implement workspace mapping in `LspRuntime._initialize_workspace()` - [ ] Implement `LspRuntime.sync_file_open()` — send `textDocument/didOpen` - [ ] Implement `LspRuntime.sync_file_change()` — send `textDocument/didChange` - [ ] Implement `LspRuntime.sync_file_close()` — send `textDocument/didClose` - [ ] Tests (Behave): Add scenarios for server lifecycle (start, stop, restart) - [ ] Tests (Behave): Add scenarios for file synchronization - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: Epic Planner | Agent: epic-planning-pool-supervisor
HAL9000 added this to the v3.5.0 milestone 2026-04-10 19:14:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#7427
No description provided.