fix #321 - feat: Implement volar-service-json for JSON language support - #434
Conversation
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
…ement-volar-service-json-for-JSON-language-support Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
✅ Deploy Preview for openworkflow-editor canceled.
|
There was a problem hiding this comment.
🟡 Changes recommended
Five moderate issues remain involving language filtering, completion ranges, schema workarounds, and diagnostic coverage.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Implements Volar-based JSON language support for Open Workflow documents.
Changes:
- Adds schema validation, completions, and CodeLens support.
- Integrates Volar JSON service dependencies and exports.
- Adds tests, documentation, and release metadata.
File summaries
| File | Summary |
|---|---|
pnpm-workspace.yaml |
Adds shared dependency catalog entries. |
pnpm-lock.yaml |
Locks new dependencies. |
packages/language-service/vite.config.ts |
Externalizes runtime dependencies. |
packages/language-service/tests/volar/json/createJsonSchemaLanguageServicePlugin.test.ts |
Tests schema completions. |
packages/language-service/tests/volar/json/createJsonLanguageServicePlugins.test.ts |
Tests plugin composition. |
packages/language-service/tests/volar/json/createJsonCompletionsPlugin.test.ts |
Tests custom completions. |
packages/language-service/tests/volar/json/createJsonCodeLensesPlugin.test.ts |
Tests CodeLens behavior. |
packages/language-service/tests/testUtils.ts |
Adds shared test utilities. |
packages/language-service/src/volar/json/schema.ts |
Configures schema validation; moderate issues remain regarding schema workarounds and diagnostic coverage (1 and 2 votes). |
packages/language-service/src/volar/json/completions.ts |
Adds Hello World completion; moderate issues remain regarding language-ID filtering (2 votes) and whitespace edit ranges (1 vote). |
packages/language-service/src/volar/json/code-lenses.ts |
Adds workflow CodeLens support; a moderate language-ID filtering issue remains (2 votes). |
packages/language-service/src/volar/index.ts |
Exports JSON plugins. |
packages/language-service/src/utils.ts |
Adds empty-workflow detection. |
packages/language-service/src/samples/hello-world.ts |
Defines sample workflow content. |
packages/language-service/README.md |
Documents the JSON language-service API. |
packages/language-service/package.json |
Declares package dependencies. |
.changeset/json-language-service-completions.md |
Records the package release change. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/language-service/src/volar/json/completions.ts:49
- Because
isEmptyWorkflowalso returns true for whitespace-only documents, a completion requested after leading whitespace receives a text-edit range at(0, 0)that does not contain the requested position. LSP clients may reject or mishandle such an item; accept the completion position and use a zero-length range at that position (or another valid single-line range containing it).
textEdit: { range: EMPTY_RANGE, newText: HELLO_WORLD_SAMPLE },
packages/language-service/src/volar/json/schema.ts:31
- Using the SDK schema directly reintroduces validation diagnostics that this repository currently has to strip:
specWorkarounds.tsdocuments that the bundled SDK schema is ahead of the published specification for the URI-template andemit.event.with.sourcerules, and removes those false errors before they reach users.volar-service-jsonwill report those same schema failures as editor diagnostics, so apply the existing workaround to this diagnostic path or provide a corrected schema before exposing it here.
schema: workflowSchema,
- Files reviewed: 16/17 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>
Suppressed Copilot comments:Whitespace completion range: Schema workaround: |
There was a problem hiding this comment.
🟡 Changes recommended
Schema compatibility and document-scoping issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
packages/language-service/src/volar/json/schema.ts:30
- This association is matched against the document URI, so
*.jsondoes not match unsaved/in-memory JSON documents such asuntitled:or Monaco'sinmemory://models. In the target editor, schema diagnostics and schema-driven completions will therefore be missing until the workflow is saved; restrict the Volar selector tojsonand associate the schema with all documents handled by that selector (or explicitly cover the host's unsaved URI patterns), and add an unsaved-document test.
fileMatch: ["*.json"],
- Files reviewed: 16/17 changed files
- Comments generated: 2
- Review effort level: Lite
It would be better to create a model, from the Text Editor, with a URI like |
Closes #321
Description
Implement the JSON language service component for the
@openworkflowspec/language-servicei nee package. This service wrapsvscode-json-languageserviceand provides JSON-specific authoring assistance for Open Workflow documents.Motivation
Providing robust JSON language support enables developers to author Open Workflow documents with confidence through schema-driven completions and real-time validation
How to test:
Only with this until we don't have the text-editor integration.