Class RNCRename
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.rename.RNCRename
Provides rename support for RNC (RELAX NG Compact Syntax) documents.
Supports renaming define names: when the user renames a define like
root, all references to root across the document are
updated consistently.
Use case: the user places the cursor on root and renames it
to rootElement. Both the declaration (root = element ...)
and all references (start = root) are updated.
The rename is preceded by a "prepare rename" step that validates the cursor is on a renamable symbol (a define name) and returns the current word range for the editor to pre-fill the rename input box.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.lsp4j.WorkspaceEditdoRename(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, String newName, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Renames the define at the given position, updating its declaration and all references within the document.org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Range, org.eclipse.lsp4j.PrepareRenameResult> prepareRename(RNCDocument rncDocument, org.eclipse.lsp4j.Position position) Validates that the cursor is on a renamable define name and returns the word range for the editor to pre-fill the rename input box.
-
Constructor Details
-
RNCRename
public RNCRename()
-
-
Method Details
-
prepareRename
public org.eclipse.lsp4j.jsonrpc.messages.Either<org.eclipse.lsp4j.Range,org.eclipse.lsp4j.PrepareRenameResult> prepareRename(RNCDocument rncDocument, org.eclipse.lsp4j.Position position) Validates that the cursor is on a renamable define name and returns the word range for the editor to pre-fill the rename input box.- Parameters:
rncDocument- the parsed RNC document.position- the cursor position.- Returns:
- the word range and current name, or
nullif the cursor is not on a renamable symbol.
-
doRename
public org.eclipse.lsp4j.WorkspaceEdit doRename(RNCDocument rncDocument, org.eclipse.lsp4j.Position position, String newName, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Renames the define at the given position, updating its declaration and all references within the document.- Parameters:
rncDocument- the parsed RNC document.position- the cursor position on the define to rename.newName- the new name to apply.cancelChecker- used to check if the operation has been canceled.- Returns:
- a
WorkspaceEditwith all text edits, ornullif the cursor is not on a renamable define.
-