java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.rename.RNCRename

public class RNCRename extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 null if 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 WorkspaceEdit with all text edits, or null if the cursor is not on a renamable define.