Class RNCReferences
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.reference.RNCReferences
Provides "Find References" support for RNC (RELAX NG Compact Syntax) documents.
Use case: the user places the cursor on a define name like inline
and invokes "Find All References". This class locates all positions where
inline is used as a pattern reference (excluding element/attribute
names and the define declaration itself, unless requested).
Example: in this document, finding references for inline returns
the reference at line 2 (inline*):
start = element root {
inline*
}
inline = element span { text }
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<? extends org.eclipse.lsp4j.Location> findReferences(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.ReferenceContext context, WorkspaceIndex workspaceIndex, Function<String, String> openDocContent, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Finds all references to the define name at the given cursor position.
-
Constructor Details
-
RNCReferences
public RNCReferences()
-
-
Method Details
-
findReferences
public List<? extends org.eclipse.lsp4j.Location> findReferences(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, org.eclipse.lsp4j.ReferenceContext context, WorkspaceIndex workspaceIndex, Function<String, String> openDocContent, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Finds all references to the define name at the given cursor position.When the cursor is not on a define name and
workspaceIndexis non-null, falls back to workspace cross-file references — the XML files in the workspace that reference this RNC grammar file. This handles the "N references" code lens click, which passes position(0,0)(not on any define), expecting cross-file results.- Parameters:
rncDocument- the parsed RNC document.position- the cursor position on the define name.context- the reference context; whenReferenceContext.isIncludeDeclaration()istrue, the define declaration itself is included.workspaceIndex- the workspace Bloom index for cross-file lookup, ornullif the workspace index feature is disabled.cancelChecker- used to check if the operation has been canceled.- Returns:
- a list of
Locationfor each reference found, or an empty list if the word is not a define name.
-