Skip to content

fix #321 - feat: Implement volar-service-json for JSON language support - #434

Open
fantonangeli wants to merge 11 commits into
open-workflow-specification:mainfrom
fantonangeli:issue-321-feat-Implement-volar-service-json-for-JSON-language-support
Open

fantonangeli wants to merge 11 commits into
open-workflow-specification:mainfrom
fantonangeli:issue-321-feat-Implement-volar-service-json-for-JSON-language-support

Conversation

@fantonangeli

Copy link
Copy Markdown
Member

Closes #321

Description

Implement the JSON language service component for the @openworkflowspec/language-servicei nee package. This service wraps vscode-json-languageservice and 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.

pnpm --filter @openworkflowspec/language-service build:prod

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>
Copilot AI lite review requested due to automatic review settings September 16, 2026 08:52
@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for openworkflow-editor canceled.

Name Link
🔨 Latest commit 94a47b6
🔍 Latest deploy log https://app.netlify.com/projects/openworkflow-editor/deploys/6aaa6fd020e7f00008c5755e

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 isEmptyWorkflow also 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.ts documents that the bundled SDK schema is ahead of the published specification for the URI-template and emit.event.with.source rules, and removes those false errors before they reach users. volar-service-json will 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.

Comment thread packages/language-service/src/volar/json/code-lenses.ts Outdated
Comment thread packages/language-service/src/volar/json/completions.ts Outdated
Comment thread packages/language-service/src/volar/json/schema.ts
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>
Copilot AI review requested due to automatic review settings September 16, 2026 10:30
@fantonangeli

Copy link
Copy Markdown
Member Author

Suppressed Copilot comments:

Whitespace completion range:
I don't think this is a real issue for this foundation PR. A document containing:
" "
would become :
"{...hello world...} "
after accepting the completion.
Since Hello World is only a temporary demo, I'd keep this out of scope for this PR.

Schema workaround:
This is a known temporary workaround tracked by #267 and currently belongs to the Diagram Editor.
I would avoid Language Service depending on the Diagram Editor or duplicating that logic here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 *.json does not match unsaved/in-memory JSON documents such as untitled: or Monaco's inmemory:// models. In the target editor, schema diagnostics and schema-driven completions will therefore be missing until the workflow is saved; restrict the Volar selector to json and 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

Comment thread packages/language-service/src/volar/json/schema.ts
Comment thread packages/language-service/src/volar/json/schema.ts
@fantonangeli

Copy link
Copy Markdown
Member Author

Suppressed comments (1)

packages/language-service/src/volar/json/schema.ts:30

* This association is matched against the document URI, so `*.json` does not match unsaved/in-memory JSON documents such as `untitled:` or Monaco's `inmemory://` models. In the target editor, schema diagnostics and schema-driven completions will therefore be missing until the workflow is saved; restrict the Volar selector to `json` and 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"],

It would be better to create a model, from the Text Editor, with a URI like inmemory://open-workflow/workflow.json and keep fileMatch: ["*.json"], instead of setting a generic fileMatch: ["*"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement volar-service-json for JSON language support

2 participants