Table of Contents

Class RefactoringKinds

Namespace
RDCore.SDK.Semantics.Refactoring
Assembly
RDCore.SDK.Protocol.dll

The kinds of the refactorings and source actions the language server offers as code actions (LSP 3.17 CodeActionKind): what a client asks for in a code action request (CodeActionContext.only), and what names a refactoring in Kind.

public static class RefactoringKinds
Inheritance
RefactoringKinds
Inherited Members

Remarks

Each kind is a refinement of one of LSP's own (refactor, refactor.extract, refactor.inline, refactor.move, refactor.rewrite, source), so a client that asks for refactor.extract is offered every extraction. refactor.move is a kind of LSP 3.18 and not of 3.17: a client of 3.17 asks for the kinds that move code as refactor, or by their own names. A refactoring of a whole module is a source action.

A client that asks for no kind is offered every action. A client that can show only some of them asks for those, by these names and LSP's own quickfix: it is offered only those kinds and their refinements, so a kind it does not know is never offered to it.

Fields

ConvertGoSub

Convert GoSub to Procedure: the GoSub routine a label starts becomes a procedure of its own (MS-VBAL §5.4.2.14), each GoSub of it a call, each On…GoSub of it a Select Case with the call in its case (MS-VBAL §5.4.2.16), and each Return a way out of it. The range it is asked for is on the label, on a GoSub statement that names it, or on one of its Return statements. Its choices are the new procedure's name, and its parameters, with why each is passed as it is.

public const string ConvertGoSub = "refactor.extract.gosub"

Field Value

string

EncapsulateField

Encapsulate Field: a Public variable of a module becomes private state, and the module gets Public properties of the variable's name (MS-VBAL §5.3.1.7): a Property Get, with a Property Let for a value, a Property Set for an object, and both for a Variant. The code of other modules is unchanged, and calls the properties. A caller that passed the variable ByRef passes a copy of the property's value instead, so a change it makes to it is lost: the user accepts that change for each such caller.

public const string EncapsulateField = "refactor.rewrite.encapsulateField"

Field Value

string

ExtractMethod

Extract Method: the selected statements of a procedure become a procedure of their own, and a call to it. Its choices are the new procedure's name, the value it returns, and whether it routes the exits of the statements back through its result; it shows the parameters, and why each is passed as it is.

public const string ExtractMethod = "refactor.extract.method"

Field Value

string

ImplementInterface

Implement Interface: a class module gets a Private procedure for each member of an interface class it names in an Implements directive and does not implement (MS-VBAL §5.2.4.2, §5.3.1.9), or a handler for each event of a WithEvents variable's class that it does not handle (MS-VBAL §5.3.1.8). The range it is asked for is on the directive or on the variable's declaration.

public const string ImplementInterface = "refactor.rewrite.implementInterface"

Field Value

string

Remarks

Each new procedure is named for the interface or the variable and the member. It has the member's parameters, with their names, explicit passing, types and Optional defaults, and the member's type. A Public variable of the interface gets a Property Get, with a Property Let for a value, a Property Set for an object, and both for a Variant.

An interface member is implemented by a call to the class's own Public member of the same kind, name, parameters and type, when it has one; otherwise it raises error 5. An event handler is an Exit Sub with a comment, so that it is not an empty procedure and raises nothing to the code that raises the event. It only adds code and asks nothing: the action has its edit.

ImportProject

Import Project: a source action of the whole workspace, offered in every document of a workspace whose folder has a VB6 project (.vbp) and no project file of its own. Its command is ImportProject, which the language server runs: it writes a .rdproj project file (ProjectFile) of the VB6 project in the folder of the .vbp.

public const string ImportProject = "source.rdcore.importProject"

Field Value

string

MoveCloserToUsage

Move Closer To Usage: the declaration of a variable moves to a line of its own before the statement that first uses it, in the innermost block that holds every use of it (MS-VBAL §5.4.3.1). A Private variable of a module that a single procedure uses moves into that procedure, declared Static or Dim, the user's choice: Static by default, which keeps its value between calls. In a class module either keyword changes the variable's extent (MS-VBAL §2.3), and the user accepts that change. The range it is asked for is on the variable's declaration or on a use of it.

public const string MoveCloserToUsage = "refactor.move.closerToUsage"

Field Value

string

MoveMemberDown

Move Member Down: the procedure a range is in, with the comments directly above it and its Attribute lines, moves below the procedure after it, as MoveMemberUp moves it above the one before it. A move into a branch of an #If block, or out of one, is refused (MS-VBAL §3.4). It asks nothing: the action has its edit.

public const string MoveMemberDown = "refactor.move.member.down"

Field Value

string

MoveMemberUp

Move Member Up: the procedure a range is in, with the comments directly above it and its Attribute lines, moves above the procedure before it. The Property Get, Let and Set of one name, written one after another, move together, and a procedure that moves past them moves past all of them. A move into a branch of an #If block, or out of one, is refused (MS-VBAL §3.4), and the first procedure of a module does not move into its declaration section (MS-VBAL §5.2). It asks nothing: the action has its edit.

public const string MoveMemberUp = "refactor.move.member.up"

Field Value

string

RemoveParameter

Remove Parameter: a parameter of a procedure is removed from its declaration, and its argument from every call that passes it, by position or by name (MS-VBAL §5.3.1.5, §5.6.13.1). The accessors of a property lose it together, and so do the member of a class that other classes implement and the procedures that implement it. The range it is asked for is on the parameter.

public const string RemoveParameter = "refactor.rewrite.removeParameter"

Field Value

string

Rename

Rename: a symbol and every reference to it, in every module that refers to it, take a new name. The action has no edit: its command is Rename, with which the client asks its user for the name and sends textDocument/rename. A name that a diagnostic flags is offered the same command as a quick fix (quickfix) instead.

public const string Rename = "refactor.rename"

Field Value

string

ReorderParameters

Reorder Parameters: the parameters of a procedure are put in another order in its declaration, and the arguments passed by position in every call to it with them (MS-VBAL §5.3.1.5, §5.6.13.1). The accessors of a property change together, and so do the member of a class that other classes implement and the procedures that implement it; the value of a Property Let or Property Set stays last. The range it is asked for is on the name of the procedure where it is declared, or on one of its parameters. Its choice is the list of the parameters, in the order the user puts them in.

public const string ReorderParameters = "refactor.rewrite.reorderParameters"

Field Value

string

SortMembers

Sort Members: the procedures of a module, each with the comments directly above it and its Attribute lines, are written by kind (the Subs, then the Functions, then the properties), then by name. The Property Get, Let and Set of one name, written one after another, stay together, in the order they are written. Procedures are sorted among those written one after another with nothing but blank lines between them: none is moved past a comment on lines of its own or an #If directive, so none goes into a branch of an #If block or out of one (MS-VBAL §3.4). It asks nothing: the action has its edit.

public const string SortMembers = "source.sortMembers"

Field Value

string