1 -> code checks in real time
The editor will perform code analysis in real time, if the input syntax does not meet the coding specification, or there is a semantic syntax error, the error or warning will be highlighted in the code, and the mouse will be placed at the error code, and a detailed error message will be prompted.
Starting from DevEco Studio 4.0 Release, when compatibleSdkVersion ≥ 10, the editor code can be checked in real time to support ArkTS performance syntax specification checking.
illustrate
When the compileSDKVersion ≥ 10 and the arkTSVersion ≥ 1.1 (default), ArkTS strict type checking supports real-time checking.
2 -> code quick fixes
DevEco Studio supports the ability to quickly fix code issues in ArkTS or C++ code.
To view alarm information, use the Shift shortcut key to open the file query box, and enter problems to open the problem tool panel. Double-click the alarm information to view the location and cause of the alarm.
Quick fix: Place the cursor over the location of the error alarm to view the problem description and corresponding fixes in the pop-up floating window. Click on Meractions to see more fixes. Or when the light bulb icon appears on the page, you can click the icon and follow the corresponding suggestions to achieve a quick code fix.
3-> C++ Quick Fix Usage Demo
Here's an example of how to use the Quick Fix feature in C++ code.
3.1 -> Populate the switch statement
The editor supports the quick fix mode, which automatically fills in the case conditions where the switch condition expression is missing for C++ code, improving coding efficiency.
Hover the cursor over the conditional variable of the switch expression, click the light bulb icon, and select Create missing switch cases from the drop-down menu to complete the missing case condition supplement.
3.2 -> Replace type with auto
You can replace the declaration types of iterator, new expression, cast expression with auto in the editor. Hover the cursor over the type name, click the light bulb icon, and select Replace the type with 'auto' from the drop-down menu to complete the replacement.
3.3 -> Usage? : ternary operator replaces if-else
The editor supports replacing the if-else statement with ? : Ternary operator. Place the cursor at the condition of the if expression, and a yellow light bulb icon appears on the left side, click the light bulb icon, and select Replace 'if else' with '?:' in the drop-down menu to complete the replacement.
3.4 -> Generate constructors from where they are used
If you use an undefined constructor, you can use quickfix to quickly generate the corresponding constructor definition. Click on the name of the constructor, and when a red light bulb appears on the left, click the light bulb icon and select Create new constructor 'xxx' to generate the constructor.
3.5 -> Split variables into declarations and assignments
Click the cursor on the variable to be split, and a yellow light bulb appears on the left, click the light bulb icon and select Split into declaration and assignment to split the declaration and assignment statement of the variable into a declaration statement and an assignment statement.
Top comments (0)