Skip to content

feat(ui): add codemirror json editor#162

Open
siddhant-galileo wants to merge 6 commits intolev/improvejsoneditorfrom
siddhant/codemirror-jsoneditor
Open

feat(ui): add codemirror json editor#162
siddhant-galileo wants to merge 6 commits intolev/improvejsoneditorfrom
siddhant/codemirror-jsoneditor

Conversation

@siddhant-galileo
Copy link
Copy Markdown
Collaborator

Summary

  • What changed and why.

Updated to use codemirror instead of monaco.

Screen.Recording.2026-04-02.at.5.06.55.PM.mov

Scope

  • User-facing/API changes:
  • Internal changes:
  • Out of scope:

Risk and Rollout

  • Risk level: low / medium / high
  • Rollback plan:

Testing

  • Added or updated automated tests
  • Ran make check (or explained why not)
  • Manually verified behavior

Checklist

  • Linked issue/spec (if applicable)
  • Updated docs/examples for user-facing changes
  • Included any required follow-up tasks

@siddhant-galileo siddhant-galileo changed the base branch from main to lev/improvejsoneditor April 2, 2026 11:40
@siddhant-galileo siddhant-galileo changed the title feat: add codemirror json editor feat(ui): add codemirror json editor Apr 2, 2026
if (existingKeys.has(propertyName)) continue;
const normalized = normalizeSchema(rawSchema, schemaCursor.rootSchema);
const type = getSchemaType(normalized) ?? 'string';
let defaultValue = '""';
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.

This also regresses the JSON scaffolding guarantees we added in the original editor work. Every object-valued property is inserted as plain {}, so selecting selector, evaluator, or a nested condition node in CodeMirror yields incomplete JSON instead of the valid skeletons Monaco inserts (for example {"path":"*"} or {"name":"","config":{}}). Because the PR exposes CodeMirror as a user-selectable engine, this becomes a user-facing behavior regression rather than an internal implementation detail.


if (isSelectorPathLocation(path)) {
const { stepNames, stepTypes } = getScopeFilters(tree);
const stepPathSuggestions = context.steps
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.

These selector-path completions are using step names (fetch_user, database_query, etc.) instead of paths derived from the step schemas. That's a behavior regression from the Monaco editor: users need suggestions like input.query or output.user.email, not step identifiers that are invalid in selector.path.

path: JsonPath
): SchemaCursor {
let rootSchema = asSchema(context.schema) ?? null;
if (context.mode === 'evaluator-config' && activeEvaluator?.configSchema) {
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.

This regresses evaluator-config autocomplete in the new CodeMirror engine. resolveSchemaAtJsonPath only swaps to the selected evaluator's configSchema for mode === "evaluator-config", but full control JSON editing also needs that override once the cursor enters condition.evaluator.config. As written, the CodeMirror path keeps walking the generic control schema, so keys like values, logic, pattern, and enum suggestions disappear there.

Copy link
Copy Markdown
Contributor

@lan17 lan17 left a comment

Choose a reason for hiding this comment

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

Thanks for pushing this forward. I found a couple of regressions in the new CodeMirror path that need to be addressed before it reaches parity with the existing Monaco editor:

  1. CodeMirror never switches to the selected evaluator config schema during full control JSON editing, so condition.evaluator.config loses the evaluator-specific key and enum suggestions.
  2. Selector-path autocomplete is suggesting step names instead of schema-derived paths, which makes the inserted values invalid for selector.path.
  3. Object-valued property completions in CodeMirror insert bare {} blocks, which regresses the valid JSON skeletons we already provide for selector, evaluator, and nested condition nodes.

I left inline comments on the relevant spots.

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.

2 participants