Skip to content

fix: enable node-click highlighting in YAML editor mode#175

Open
sakshammjn wants to merge 3 commits into
ioflux-org:mainfrom
sakshammjn:fix/yaml-format
Open

fix: enable node-click highlighting in YAML editor mode#175
sakshammjn wants to merge 3 commits into
ioflux-org:mainfrom
sakshammjn:fix/yaml-format

Conversation

@sakshammjn

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a bug where clicking a node in the graph visualization failed to highlight the corresponding lines in the Monaco editor when the editor format was set to YAML. The existing implementation used jsonc-parser (which only supports JSON) to resolve node paths to editor positions. This worked for JSON but failed for YAML, as parseTree returned undefined and the effect bailed out early.

Changes:

  1. Added the yaml package for position-aware YAML AST parsing
  2. Refactored the highlight useEffect in MonacoEditor.tsx to branch on schemaFormat: using jsonc-parser for JSON (unchanged) and yaml's parseDocument for YAML
  3. Added a 50ms micro-delay to handle the race condition when toggling formats.
  4. Added schemaFormat to the useEffect dependency array to re-trigger highlights on format switch

What kind of change does this PR introduce

Bug fix

Issue Number

Closes #167

Video

Screen.Recording.2026-03-10.at.10.51.11.PM.mov

Does this PR introduce a breaking change?

No

If relevant, did you update the documentation?

No

@sakshammjn sakshammjn changed the title fix: resolve YAML highlighting edge case on format switch fix: enable node-click highlighting in YAML editor mode Mar 10, 2026
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.

Bug: Node-click highlighting in editor fails when using YAML format

1 participant