PrepareRenameSource typedef

PrepareRenameSource = FutureOr<PrepareRenameResult?> Function(EditorState state, int pos)

The type of function that prepares a rename operation.

Called when the user initiates rename (F2) to check if rename is possible and get the symbol range.

  • state is the current editor state
  • pos is the document position of the symbol

Should return a PrepareRenameResult with the symbol range, or null/error if rename is not available.

Implementation

typedef PrepareRenameSource = FutureOr<PrepareRenameResult?> Function(
  EditorState state,
  int pos,
);