Skip to content

Decode JSON Pointer segments and handle numeric path variants for Monaco highlighting#3

Merged
DevROHIT11 merged 2 commits into
mainfrom
codex/fix-yaml-editor-node-highlighting-tyhf3i
Apr 8, 2026
Merged

Decode JSON Pointer segments and handle numeric path variants for Monaco highlighting#3
DevROHIT11 merged 2 commits into
mainfrom
codex/fix-yaml-editor-node-highlighting-tyhf3i

Conversation

@DevROHIT11

Copy link
Copy Markdown
Owner

Motivation

  • Improve locating and highlighting nodes in the Monaco editor when selectedNode.id is a JSON Pointer with percent-encoding or RFC6901 escapes (~1, ~0).
  • Support ambiguous numeric path segments by trying both string and numeric interpretations so lookups work for both YAML and JSON parsed trees.
  • Avoid runtime exceptions when path lookup fails and ensure decorations update when schema format/text changes.

Description

  • Add decodePointerSegment to decode percent-encoded pointer segments and unescape ~1 and ~0 sequences.
  • Introduce buildPathCandidates to produce candidate path arrays that include both string and numeric versions for numeric segments.
  • Use the candidate paths to attempt locating nodes in YAML (parseDocument / getIn) and JSON (parseTree / findNodeAtLocation) and pick the first valid node with a range or offset for highlighting.
  • Wrap lookup logic in a try/catch to prevent exceptions from breaking the effect and update effect dependencies to include schemaFormat and schemaText so highlights refresh on format/text changes.

Testing

  • Ran the test suite with yarn test and all tests completed successfully.
  • Ran the linter with yarn lint and no issues were reported.
  • Verified that editor highlighting behavior updates when switching schemaFormat and when schemaText changes via automated test coverage and CI checks.

Codex Task

@DevROHIT11 DevROHIT11 merged commit 486f5e4 into main Apr 8, 2026
1 check passed
@DevROHIT11 DevROHIT11 deleted the codex/fix-yaml-editor-node-highlighting-tyhf3i branch April 8, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant