Skip to content

[Enhancement - Definition] - Use AST offsets for reliable tag-pair navigation #16

Description

@harshanacz

Problem
The current doDefinition implementation uses text.indexOf() to find the matching closing tag. This is unreliable in complex XML files where identical tag names appear multiple times, as it may jump to the wrong tag. It is also less efficient than using the existing AST.

Proposed Solution
Refactor the logic to rely on the XMLNode structure rather than manual string searching.

Key Improvements:

  • Direct Offset Mapping: Use node.endTagStartOffset (if available in parser) to jump directly to the closing tag.
  • Eliminate indexOf: Remove text-based searching to prevent "false positive" matches.
  • Support Self-Closing Logic: Explicitly handle or skip nodes that don't have a closing pair more gracefully.

Labels
enhancement, Definition, Navigation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions