Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ef002c8 to
18ec8e9
Compare
18ec8e9 to
90fb012
Compare
213628d to
5cb42ad
Compare
7c811a0 to
16b35f4
Compare
….worker Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntent The worker was converting Monaco positions against the full file content (prefix + user code), but Monaco positions are relative to the visible user code only. This caused double-counting of the prefix offset since SDCPNLanguageServer methods already add prefixLength internally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add key={petriNetId} so the language client remounts with fresh state
when switching between Petri nets.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Monaco providers now call notifyDocumentChanged before each completion/hover/signatureHelp request so the worker always has up-to-date content when converting positions. Without this, typing a trigger character (e.g. ".") could race the SDCPN state sync, causing the worker to compute offsets against stale text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bc34ac2 to
fdc56a8
Compare
PR SummaryMedium Risk Overview Replaces the previous on-main-thread checker/Monaco typings setup with Cleans up and adjusts packaging/security: removes CDN-related CSP allowances, drops the frontend webpack browser fallbacks previously used for Written by Cursor Bugbot for commit d86a788. This will update automatically on new commits. Configure here. |
libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/place-properties.tsx
Show resolved
Hide resolved
🤖 Augment PR SummarySummary: This PR introduces an LSP-inspired TypeScript Language Service layer for Petrinaut’s Monaco editors, moving diagnostics and IntelliSense work off the main thread into a WebWorker. Changes:
Technical Notes: Monaco’s built-in TypeScript worker features are disabled and replaced by worker-backed providers; diagnostics are pushed from the worker and mirrored into Monaco markers. 🤖 Was this summary useful? React with 👍 or 👎 |
libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/place-properties.tsx
Show resolved
Hide resolved
…offsetToPosition` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

🌟 What is the purpose of this PR?
Add a TypeScript Language Service layer for Petrinaut's Monaco editors, providing real-time diagnostics, completions, hover info, and signature help — all running off the main thread in a WebWorker, communicating via an LSP-inspired JSON-RPC 2.0 protocol with standard
vscode-languageserver-types.graph TD subgraph Main Thread SDCPN["SDCPNContext"] --updates--> LC["LanguageClientContext"] LC --> Sync["Sync Components"] Monaco["MonacoContext"] --> Sync CodeEditor --uses--> Monaco end subgraph WebWorker Worker["language-server.worker"] --> LS["SDCPNLanguageServer"] end LC -- "notifications" --> Worker Worker -. "diagnostics" .-> LC Sync -- "requests" --> Worker Worker -. "responses" .-> SyncProtocol messages (JSON-RPC 2.0)
initialize,sdcpn/didChange,textDocument/didChangetextDocument/publishDiagnosticsDiagnostic[]per URItextDocument/completionPosition→CompletionListtextDocument/hoverPosition→HovertextDocument/signatureHelpPosition→SignatureHelp🔗 Related links
🔍 What does this change?
Architecture
monaco/provider.tsx) with a module-level lazy singleton to prevent re-initializationlsp/)lsp/worker/language-server.worker.ts) with a JSON-RPC 2.0 protocolLSP-inspired protocol (
lsp/worker/protocol.ts)vscode-languageserver-types(Diagnostic,CompletionItem,CompletionList,Hover,SignatureHelp,Position,Range)initialize,sdcpn/didChange,textDocument/didChangetextDocument/completion,textDocument/hover,textDocument/signatureHelptextDocument/publishDiagnostics(per-URI diagnostic notifications)Position { line, character }with offset↔position conversion utilities bridging the TS LanguageServicePersistent LanguageService (
lsp/lib/create-sdcpn-language-service.ts)SDCPNLanguageServerclass creatests.createLanguageService()once and reuses it across SDCPN changessyncFiles(sdcpn)diffs virtual files incrementally (add/remove/update) rather than recreating everythingupdateDocumentContent()for single-file typing updatesgetFileContent()for offset↔position conversionShared modules
lsp/lib/document-uris.ts: Single source of truth for URI ↔ file path ↔ item type mapping, consumed by both the worker and Monaco componentslsp/lib/ts-to-lsp.ts: Pure TS → LSP type conversion functions (toLspSeverity,toCompletionItemKind,serializeDiagnostic), extracted from the worker for testabilitylsp/lib/position-utils.ts: Offset ↔ LSP Position conversion utilitiesLanguage features (Monaco sync components)
DiagnosticsSyncmaps LSPDiagnosticranges to Monaco markers (diagnostics-sync.tsx)CompletionSyncwith LSPCompletionItemKind→ Monaco kind mapping (completion-sync.tsx)HoverSyncrendering LSPMarkupContent(hover-sync.tsx)SignatureHelpSyncwith LSPSignatureHelp→ Monaco mapping (signature-help-sync.tsx)Cleanup
@dnd-kitdependency and feature flagsrollup-plugin-visualizerdependencyPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
checker.test.ts: 20 tests covering SDCPN validation with theSDCPNLanguageServercreate-sdcpn-language-service.test.ts: 11 tests covering dot completions, top-level completions,updateDocumentContentmutability,syncFilesstructural updates, and differential equation completionsposition-utils.test.ts: 12 tests coveringoffsetToPosition,positionToOffset, and roundtrip identitydocument-uris.test.ts: 22 tests covering URI construction, parsing, file path conversion, and roundtrip identity for all item typests-to-lsp.test.ts: 38 tests covering TS diagnostic severity → LSP severity mapping, all TSScriptElementKind→ LSPCompletionItemKindmappings, and fullserializeDiagnosticconversion (multi-line ranges, chained messages, defaults)🐾 Next steps
vscode-languageserver/vscode-languageclient) to replace custom JSON-RPC mapping and reduce protocol boilerplate.