This content originally appeared on DEV Community and was authored by ZHZL-m
1 -> Expand the macro
Supports expanding macros at the current macro reference. Move the cursor to the macro you want to expand, right-click Refactor, and select Inline to expand the macro referenced here.
2 -> swap if branch
The editor supports swapping the position of the if-else block and negating the condition when the if-else full code block is selected.
Use constraints
The code block to be refactored must be a complete if-else code structure, and {} cannot be omitted;
If a statement in if-else contains nested if-else statements, only the outermost of-the-other statements are reversed. For if() -else if()-else() structures, only the last layer of if-else structures can be swapped;
The negation of the judgment condition of an assignment statement is not supported.
How to use:
Select the code area to be converted in the editor, right-click Refactor, select Swap If Branches, negate the original if condition, and swap the if-else order of the original code blocks.
3 -> Move the function body to the declaration
The editor supports moving the function body from the source file to the header file to improve code readability. Select the function name in the editor, right-click Refactor, and select Move to Declaration, and the function implementation in the source file will be moved to the header file.
4 -> Move the function body to the implementation
In the editor, place the cursor over or select the function name, right-click Refactor, select Move to Implementation, and select the file to move the function definition to the file.
5 -> converts the statement to the original string
The editor provides refactoring capabilities that support converting strings with escape characters of \n, \t, \”, \, \’ to raw strings. Currently, only standard strings are supported, and other strings such as u8 “” are not supported.
Select the string code area in the editor, right-click Refactor, and select Convert To Raw String to convert the statement to the original string.
This content originally appeared on DEV Community and was authored by ZHZL-m