DXCore Services – TextCommands
The TextCommands DXCore service provides access to registered text commands inside DXCore and allows you to format a text command to prepare it for expansion. Formatting of a text command means adding special characters defined in the Constants DXCore service to be able to expand it using the TextExpansions service. For example, to format the Caret text command, pass its name to the Format method:
CodeRush.TextCommands.Format("Caret")
and as a result, it will return: «Caret».
After the string, containing this formatted text command, is expanded, the text command will be executed, e.g. expanding this text inside code editor:
int count = «Caret»100;
will produce the following result:
int count = 100;
with the editor caret positioned right at the beginning of the “100” digit expression.
Methods of the service:
Name | Description |
Format(TextCommand) | Formats the text command using its name. |
Format(String) | Formats the text command using its name passed as string. |
Format(TextCommand, String[]) | Formats the text command using its name and a given list of parameters. |
Format(String, String[]) | Formats the text command using its name and a given list of parameters. |
GetAll | Returns an array of all registered TextCommands in DXCore. |
GetAll(Boolean) | Returns an array of all registered TextCommands in DXCore. The boolean parameter specifies whether the result array is sorted. |
GetEnumerator | Returns an enumerator of all registered TextCommands in DXCore. |
Also, there’s an indexed property, returning the TextCommand object by its name.
—– Products: DXCore Versions: 10.2 and up VS IDEs: any Updated: Mar/17/2011 ID: D070