java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.highlight.RNCHighlighting

public class RNCHighlighting extends Object
Provides document highlighting for RNC (RELAX NG Compact Syntax) documents.

Use case: the user places the cursor on a define name like root and the editor highlights all occurrences of root in the document — the declaration is highlighted with DocumentHighlightKind.Write and references with DocumentHighlightKind.Read.

Example: placing the cursor on root highlights:

 start = root            ← Read highlight
 root = element root {   ← Write highlight (declaration)
   text
 }
 
See Also:
  • Constructor Details

    • RNCHighlighting

      public RNCHighlighting()
  • Method Details

    • findDocumentHighlights

      public List<org.eclipse.lsp4j.DocumentHighlight> findDocumentHighlights(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)
      Finds all occurrences of the define name at the given cursor position, returning them as document highlights with Write/Read kinds.

      If the cursor is on an element or attribute name instead, only that single name is highlighted.

      Parameters:
      rncDocument - the parsed RNC document.
      position - the cursor position.
      cancelChecker - used to check if the operation has been canceled.
      Returns:
      a list of DocumentHighlight entries, or an empty list if the word is not a define or element/attribute name.