Repository navigation
Description
Problem
General JavaScript assistance inside Citry components currently depends on the VS Code extension creating virtual JavaScript documents and invoking VS Code providers. Other editors connected to citry-lsp receive Citry-owned features but do not automatically receive equivalent JavaScript completion, hover, or navigation.
Developers should retain normal JavaScript editing assistance when choosing inline component code, including in Helix and Zed.
Prior art
packages/py/citry_lsp/citry_lsp/server.py:citry/browserProjectionexposes mapped JavaScript projections.packages/editors/vscode/src/extension.ts:registerBrowserLanguageProvidersdelegates requests to VS Code providers.docs/design/embedded_language_ide.md: portable analysis and exact source mappings already exist; general web-language intelligence is currently delegated to editor providers.- IDE: complete and validate the
dataobject in$component()callback #113 tracks typed completion and validation for the$component()callback'sdataobject; coordinate with that work rather than creating a second typing contract.
Proposed work
Extend citry-lsp to delegate general JavaScript requests to a JavaScript language server/service and translate results back to authored component source through standard LSP responses.
- Evaluate an established JavaScript/TypeScript service, including project configuration, library types, imports, and dependency discovery.
- Reuse Citry's source discovery, projections, and typed context. Cover inline
js, ownedjs_fileassets, and supported Alpine expression regions with an explicit capability list. - Support completion, hover, navigation, and diagnostics; define which further operations can be mapped safely.
- Preserve exact positions and edits across Python string decoding, generated helper code, unsaved edits, and multiple components. Reject stale or unmappable results.
- Define dependency installation, process lifecycle, cancellation, and behavior when the service is missing, incompatible, or unavailable. Keep existing Citry-owned assistance usable.
- Coordinate with the VS Code bridge so users do not receive duplicate diagnostics or competing edits.
This is an architecture extension. Compare server-side delegation with maintaining separate editor bridges before implementation; do not replace the existing portable analyzer with a second Citry parser.
Acceptance criteria
A representative inline-component fixture receives useful ordinary JavaScript completion, hover, navigation, and diagnostics through standard LSP in VS Code and a second editor. Verify project symbols through runtime-supported imports or JSDoc types, Citry-provided data, incomplete input, unsaved changes, and mapping failures. Document supported regions and any intentionally deferred operations.
Browser breakpoint source maps are separate runtime artifacts and are tracked in the debugging issue.
Related work
- Helix integration: IDE: add and document Helix integration #118
- Zed integration: IDE: add a first-party Zed integration #119
- Source-mapped debugging: Debugging: map running component JavaScript back to authored source #117
Activity