Skip to content

Improve JSON Pointer decoding and robust node highlighting in MonacoEditor#5

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

Improve JSON Pointer decoding and robust node highlighting in MonacoEditor#5
DevROHIT11 merged 2 commits into
mainfrom
codex/fix-yaml-editor-node-highlighting-4woupn

Conversation

@DevROHIT11

Copy link
Copy Markdown
Owner

Motivation

  • Ensure editor can locate and highlight nodes when selectedNode.id contains URI-encoded or tilde-escaped JSON Pointer segments.
  • Handle ambiguous numeric pointer segments that may be either string keys or numeric indices in YAML/JSON ASTs.
  • Prevent off-by-one highlighting and ensure highlights update when the schema text or format changes.

Description

  • Add decodePointerSegment to safely decodeURIComponent pointer segments and unescape ~1/~0 sequences with a fallback for malformed segments.
  • Introduce buildPathCandidates to generate candidate paths that try numeric segments as both strings and numbers, and use these candidates when locating nodes in YAML (getIn) or JSON (findNodeAtLocation) ASTs.
  • Wrap AST lookup in a try/catch and select the first candidate node that contains a range, then compute start/end positions from that node.
  • Adjust the computed end line to avoid selecting an extra trailing blank line and update the decoration range to use the line max column, and add schemaFormat and schemaText to the effect dependencies.

Testing

  • Ran the existing unit test suite with yarn test, and all tests passed.
  • Executed the TypeScript build with yarn build to confirm type correctness, which succeeded.
  • Ran lints with yarn lint, which completed without errors.

Codex Task

@DevROHIT11 DevROHIT11 merged commit 17b05a3 into main Apr 8, 2026
1 check failed
@DevROHIT11 DevROHIT11 deleted the codex/fix-yaml-editor-node-highlighting-4woupn 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