java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.definition.RNCDefinitions

public class RNCDefinitions extends Object
Provides go-to-definition support for RNC (RELAX NG Compact Syntax) define references.

Use case: the user invokes "Go to Definition" (Ctrl+Click or F12) on a define reference, and the cursor navigates to the corresponding define declaration.

Example: in the following RNC, invoking go-to-definition on root in the start pattern navigates to the root define on line 2:

 start = root                      <-- Ctrl+Click on "root" here
 root = element root { text }      <-- navigates to "root" here
 

The method returns a LocationLink with both the origin selection range (the clicked reference) and the target range (the define name in the declaration), enabling the IDE to highlight both ends of the link.

  • Constructor Details

  • Method Details

    • findDefinition

      public List<? extends org.eclipse.lsp4j.LocationLink> findDefinition(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker)
      Finds the definition location for the word at the given cursor position.

      The method extracts the word under the cursor, looks it up in the document's define declarations, and returns a location link from the reference to the definition.

      Parameters:
      position - the cursor position (typically the click position).
      cancelChecker - used to check if the operation has been canceled.
      textDocument - the RNC text document.
      Returns:
      a singleton list with the LocationLink to the define declaration, or an empty list if no matching define is found.