Class SymbolRename
- Namespace
- RDCore.SDK.Semantics.Refactoring
- Assembly
- RDCore.SDK.dll
Renames a symbol: the names that refer to it, wherever they are written, and none that do not - which is what makes it a rename and not a search for a text.
public static class SymbolRename
- Inheritance
-
SymbolRename
- Inherited Members
Remarks
What a name refers to is what the static semantics resolve it to (MS-VBAL §5.6.10, §5.6.12): the names of a procedure's body as the static pass binds them, a member of an object by the declared type of the object, a named argument by the procedure that is called, a member's attribute by the member. A name the pass does not bind is resolved where it is written. A name whose meaning cannot be told is not guessed at: the rename is refused.
The new name must be one code can declare (VBIdentifier), and must not change what any code means: it must not be declared where the symbol is, it must not mean something nearer than the symbol where the code refers to the symbol, and the symbol must not become nearer than what it means where the code already writes it.
A member that code accesses late-bound - on an Object or a Variant - is not known to refer to the symbol, and is not renamed.
Methods
Plan(RenameContext, RenameTarget, string)
What renaming target to newName writes (LSP 3.17 §Rename Request).
public static RenamePlan Plan(RenameContext context, RenameTarget target, string newName)
Parameters
contextRenameContextThe workspace.
targetRenameTargetWhat is renamed (Prepare(RenameContext, Uri, SourcePosition)).
newNamestringThe new name, without a type-declaration character: a name written with one keeps it.
Returns
Prepare(RenameContext, Uri, SourcePosition)
What a rename at position of module would rename (LSP 3.17 §Prepare Rename Request).
public static RenamePreparation Prepare(RenameContext context, Uri module, SourcePosition position)
Parameters
contextRenameContextThe workspace.
moduleUriThe module.
positionSourcePositionA position in the name, or at its end.
Returns
TargetsIn(RenameContext, Uri, SourceRange)
What a client can offer to rename in a range of a module: the name at the position for an empty range - where a cursor is - and each symbol declared in the range otherwise - a selection, a line, a whole module. A name that is not renamed is not offered.
public static IReadOnlyList<RenameTarget> TargetsIn(RenameContext context, Uri module, SourceRange range)
Parameters
contextRenameContextThe workspace.
moduleUriThe module.
rangeSourceRangeThe range.
Returns
- IReadOnlyList<RenameTarget>
Each symbol once, in the order its name is written in the range.