feat: enhanced JSON Schema, LSP server, and canonical snippets for IDE support#208
Merged
feat: enhanced JSON Schema, LSP server, and canonical snippets for IDE support#208
Conversation
…E support
- schema: enrich GenerateWorkflowSchema() with if/then per-module-type config
validation using ConfigFieldDef metadata from ModuleSchemaRegistry; adds
pipelines, imports, requires, platform sections; adds AllOf/If/Then/OneOf
fields to Schema struct with json.RawMessage additionalProperties; adds
configFieldDefToSchema() helper, KnownStepTypes(), GenerateApplicationSchema()
- schema/snippets: add 30+ canonical snippets (10 module, 1 pipeline scaffold,
12 step, 3 trigger, 3 workflow, 3 structural) with \${N:placeholder} syntax
- schema/snippets_export: ExportSnippetsVSCode() and ExportSnippetsJetBrains()
for IDE integration
- cmd/wfctl/snippets: add 'wfctl snippets --format vscode|jetbrains|json' subcommand
- lsp: new package implementing Language Server Protocol server with stdio
transport using github.com/tliron/glsp; registry.go (type metadata),
document.go (DocumentStore + ContextAt cursor analysis), completion.go
(module/step/trigger/config/template completions), diagnostics.go (unknown
type/field/dependsOn validation, unclosed template detection), hover.go
(markdown hover for modules/triggers/template functions), server.go (glsp
handler wiring with publishDiagnostics)
- cmd/workflow-lsp-server: new binary entrypoint with -version flag
- release.yml: build workflow-lsp-server cross-platform binaries in release job
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds IDE support capabilities to the workflow project by introducing (1) a richer JSON Schema generator for config validation, (2) a new Language Server Protocol (LSP) server for YAML authoring assistance, and (3) canonical snippet exports (VSCode + JetBrains) surfaced via wfctl.
Changes:
- Enhanced JSON Schema generation with conditional per-module validation and additional top-level sections (pipelines/imports/requires/platform) plus an application-level schema.
- Added a new
workflow-lsp-serverbinary andlsp/package implementing completions, diagnostics, and hover for workflow YAML. - Added canonical snippet definitions and exporters (VSCode JSON + JetBrains XML) plus a
wfctl snippetssubcommand.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| schema/schema.go | Expands schema model + generates enhanced workflow/application schemas with new sections and conditional validation. |
| schema/schema_enhanced_test.go | Adds tests validating generated schema shape and selected conditionals. |
| schema/snippets.go | Introduces canonical snippet definitions for common modules/steps/triggers/workflows/structure. |
| schema/snippets_export.go | Adds snippet export functions for VSCode JSON and JetBrains live templates XML. |
| schema/snippets_test.go | Adds tests for snippet completeness and export validity. |
| lsp/server.go | Implements LSP server wiring and stdio transport with diagnostics publishing. |
| lsp/registry.go | Builds an LSP registry from schema-known module/step/trigger/workflow types. |
| lsp/document.go | Adds a thread-safe document store and basic cursor-context detection. |
| lsp/diagnostics.go | Adds YAML-based diagnostics for unknown types, unknown config keys, dependsOn validation, and template closure. |
| lsp/completion.go | Adds context-aware completions for keys, types, dependsOn names, and template functions. |
| lsp/hover.go | Adds hover content for module types, module config keys, trigger types, and template functions. |
| lsp/lsp_test.go | Adds unit tests for registry population, document store behavior, diagnostics, completions, hover, and context detection. |
| cmd/workflow-lsp-server/main.go | Adds the LSP server entrypoint binary with build-time version injection. |
| cmd/wfctl/snippets.go | Adds wfctl snippets command to export snippets in multiple formats. |
| cmd/wfctl/main.go | Registers the new snippets subcommand in wfctl. |
| .github/workflows/release.yml | Adds cross-platform release builds for workflow-lsp-server. |
| go.mod / go.sum | Adds github.com/tliron/glsp and related indirect dependencies. |
- snippets_export.go: use as JetBrains XML attribute newline separator - completion.go: remove incorrect comment about stdlib strings import cycle - completion.go: check ctx.DependsOn before FieldName for dependsOn completions - schema.go: set additionalProperties:false on per-module config sub-schema - schema.go: derive KnownStepTypes() from KnownModuleTypes() step. prefix filter - schema.go: add Required:["type"] to moduleIfThen If schema - schema.go: replace literal "*" pipelines property with AdditionalProperties - schema.go: add per-step if/then config conditionals with TODO for registry - schema.go: set additionalProperties:false on triggers schema Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three major additions for IDE integration:
Enhanced JSON Schema Generator
if/thenconditionals keyed ontypefieldimports,requires,platformsectionsGenerateApplicationSchema()for multi-workflow app configsLSP Server (
lsp/+cmd/workflow-lsp-server/){{ }}Canonical Snippets (
schema/snippets*.go+wfctl snippets)ExportSnippetsVSCode()— VSCode .code-snippets JSON formatExportSnippetsJetBrains()— JetBrains live template XML formatwfctl snippets --format vscode|jetbrains|jsonsubcommandTest plan
🤖 Generated with Claude Code