Skip to content

[NEW FEATURE TEST]: add test cases and edge case coverage for inlay hints and code lens #59

Description

@harshanacz

Overview

Two new features were added in branch feat/inlay-hints-and-code-lens:

  • getInlayHints() — shows attribute type and required markers inline
  • getCodeLens() — shows "N references" above named elements

This issue tracks writing test cases and verifying edge case behavior for both.


Inlay Hints — getInlayHints()

Happy path

  • Attribute with a non-string XSD type (e.g. xs:boolean) → produces : boolean type hint
  • Attribute marked use="required" in schema → produces * parameter hint
  • Both hints appear together on the same attribute when type is non-string and required

Edge cases

  • Attribute with xs:string type → no hint produced (skip rule)
  • Attribute with no type defined in schema → no hint produced
  • Attribute with no value (<el attr />) → valueEnd is undefined, must not crash
  • Element not found in schema → returns []
  • No schema provider passed → returns []
  • Range filter: hints outside the given range are excluded
  • Range filter: hints inside the given range are included

Code Lens — getCodeLens()

Happy path

  • Named element with 2+ references → "N references" (plural)
  • All reference attributes are counted: key, ref, target, href, type, base

Edge cases

  • Named element with 0 references → "0 references"
  • Named element with exactly 1 reference → "1 reference" (singular, not "1 references")
  • Two elements sharing the same name value → both lenses show the same count
  • Element with no name attribute → not included in results
  • Empty document → returns []
  • Deeply nested named elements → still detected correctly

Files to add tests in

  • src/services/xmlInlayHints.test.ts
  • src/services/xmlCodeLens.test.ts

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