Skip to content

Commit e0442c8

Browse files
Mazyodclaude
andcommitted
docs: document Monaco native LSP client as playground enhancement opportunity
Track monaco.lsp (v0.55.0) as a potential simplification for the playground, including what it provides, current blockers, and adoption recommendation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f252d41 commit e0442c8

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

docs/INTEGRATION_NOTES.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,39 @@ def get_base_python_capabilities() -> types.ClientCapabilities:
124124

125125
Backends could extend this base instead of duplicating the boilerplate.
126126

127-
### 4. Backend Registry Pattern
127+
### 4. Monaco Native LSP Client (`monaco.lsp`)
128+
129+
Monaco Editor v0.55.0 (November 2025) introduced a built-in LSP client under `monaco.lsp` that could significantly simplify the playground. The current playground manually handles JSON-RPC, the LSP handshake, position conversion, diagnostics, and hover registration (~200 lines per backend). With `monaco.lsp`, this reduces to ~10-15 lines per backend.
130+
131+
**What it provides:**
132+
- `MonacoLspClient` — auto-registers 21 LSP features (completion, hover, diagnostics, semantic tokens, go-to-definition, rename, code actions, inlay hints, etc.)
133+
- `WebSocketTransport` — connect via WebSocket
134+
- `createTransportToWorker(worker)` — connect to a Web Worker
135+
- `createTransportToIFrame(iframe)` — connect to an iframe
136+
137+
**Example usage:**
138+
```typescript
139+
const worker = new Worker(PYRIGHT_WORKER_URL);
140+
const transport = monaco.lsp.createTransportToWorker(worker);
141+
new monaco.lsp.MonacoLspClient(transport);
142+
// All features auto-registered, including semantic tokens
143+
```
144+
145+
**What it would replace in the playground:**
146+
- `BackendAdapter` interface (diagnostics, hover, updateCode)
147+
- `typeConversions.ts` (LSP-to-Monaco position mapping)
148+
- Per-backend implementations (~200 lines each)
149+
- Dependencies: `vscode-languageserver-protocol`, `vscode-jsonrpc`
150+
151+
**Blockers / caveats (as of v0.55.0):**
152+
- **API not stable** — the author (hediet, Microsoft) explicitly warned the API may change
153+
- **No custom initialization params** — sends `rootUri: null`, `processId: null` with no way to customize. The playground backends need specific `initializationOptions`
154+
- **Global registration** — providers register for all models, not per-language
155+
- **No reconnection** — WebSocket drops require page refresh
156+
157+
**Recommendation:** Monitor the API stability across v0.56.0+. The lack of custom `initializationOptions` is the main blocker for adoption. Once that is addressed, migrating the playground would eliminate significant boilerplate and gain features (completion, semantic tokens, rename, etc.) for free.
158+
159+
### 5. Backend Registry Pattern
128160

129161
For easier discovery and testing:
130162

0 commit comments

Comments
 (0)