Skip to content

Highlight problematic predicate in source view lint markers #171

Description

@JohnRDOrazio

Summary

Currently, lint issue markers (red/yellow squiggly lines) in the source view are placed on the class IRI (the subject). When a lint issue is about a specific predicate (e.g., duplicate skos:prefLabel values), the marker should highlight the predicate within the class block, not just the class IRI.

Current Behavior

  • Web worker (lib/editor/indexWorker.ts) finds the subject IRI position in the source
  • Marker is placed on the IRI token (e.g., <R02854b77E5b33FBfafC6fad>)
  • User must read the issue message to understand which predicate is problematic

Desired Behavior

  • For issues that include details.predicate (e.g., "skos:prefLabel", "rdfs:label"), place the marker on the predicate line(s) within the class block
  • Optionally also mark the specific value(s) mentioned in details.labels
  • Fall back to class IRI position when no predicate info is available

Implementation Approach

  1. Pass issue details to the web worker alongside subject_iri, rule_id, message, issue_type
  2. After finding the subject IRI position, scan forward in the source text to find the predicate token within the same Turtle block (delimited by . terminator)
  3. If multiple values are problematic, mark each value's line
  4. Consider using MarkerSeverity + relatedInformation for secondary locations

Files Involved

  • lib/editor/indexWorker.ts — position computation logic
  • components/editor/OntologySourceEditor.tsx — passes issues to worker
  • components/editor/TurtleEditor.tsx — renders markers from diagnostics

Considerations

  • Turtle syntax allows predicates on same or different lines
  • Abbreviated notation (, for same predicate, ; for same subject) complicates parsing
  • Performance: scanning within a class block is bounded and fast
  • Some rules (e.g., orphan-class) have no predicate — keep fallback to IRI position

🤖 Generated with Claude Code

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

    Labels

    UXUser experience improvementsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions