Some settings that can speed up development efficiency in use of Rider or IDEA

Rider has some very small shortcut settings, which can greatly increase the efficiency of daily code writing, and these are also applicable to IDEA

1. Increase the number of tabs open at the same time:

When using Rider or IDEA, if there are a large number of open files, some scripts will be automatically closed . At this time, you can set the upper limit of the number of scripts opened at the same time:

As above, only when there are more than 30 script tabs open at the same time, some unused tabs will be closed

2. Multi-line display of all open script tabs

When there are many opened tabs exceeding the maximum width of the screen, the extra tabs will be automatically folded, and you need to click the fold button on the far right to find the script file. So set the script tab here to display in multiple lines without folding:

If you cancel "Show tabs in one row" above, the tabs will be displayed in multiple rows, which is convenient for finding the corresponding file:

3. Sort all open tabs:

When opening the script tab, it is troublesome to find the corresponding tab. If all the tabs are arranged in the specified order, then the search will become very convenient:

In this way, all the opened tabs will be arranged in order from az, and the newly opened tabs will be automatically inserted into the specified position according to the alphabetical order. In this way, when searching for a specified script file, you only need to quickly find the specified file according to the first letter of the script

 4. Mark unsaved modified files:

Sometimes you may forget to save the modified content when writing code, resulting in the execution of the previous file when debugging, so here you can mark the modified but not saved file:

In this way, after modification, there will be a "*" icon in the upper left corner of the script tab, and it will disappear after saving:

5. Display the directory structure of the selected file in the Project Tab on the left:

When coding, sometimes you need to open the directory structure where the corresponding script file is located in the project tab on the left. Usually, you can only find it slowly in the project tab, so if you can open the corresponding script file directly in the project tab on the left It will be much more convenient to select the directory structure of the file:

As shown in the figure, when "Always Select Opened File" is checked, if the opened "AnimationStateWrap.cs" file is selected, the file will be selected in the Project Tab on the left immediately

PS:

1. When double-clicking the opened file tab on the right, the Project Tab on the left can be automatically displayed or hidden, and there is no need to click the "—" button in the upper right corner of the Project Tab 

2. When "Open Files with Single Click" is checked, the file can be opened with one click, so that the setting can be unified with the operation logic of "display the file when the Editor tab is clicked". More convenient

6. After using Rider for a period of time, it may become very stuck when opening global search or other functions. At this time, you can clear Rider's cache:

Under the File menu, "Invalidate Caches/Restart", then Rider will restart automatically - if it does not restart automatically, restart it manually:

 

7. Other Rider settings:

In order to make it easier for Rider to write C# and Lua codes, the following settings can be made:

Set the script code style, such as the following to set the C# code to "K&R" and "BSD" style, you need to reformat the script: Ctrl + Alt + Enter. Otherwise the script doesn't change

 

trailing space: the extra blank space at the end of the script, these blank spaces are deleted by default

Do not use BOM for all UTF-8 files, because in some cases BOM may cause Chinese garbled characters:

8. Set the tab color according to different situations:

In development, it is often encountered that the open tabs have different colors, and it is difficult to quickly find the target file. Here is a place where you can modify the Editor tab color:

1. If "Eable File Colors" is enabled in "Appearance and Behavior" -> "File Colors", the color of "Editor Tabs" will also be affected. The scope of influence of the color is determined by the specific color "Scope" in the "Local colors" below

When the color range of adding "+" is "All", all tabs will use this color.

Note: In the "Local colors" color list, the color at the top has a higher priority . When the same tab meets the colors of the following scopes, the color with a higher priority is used first.

 

 As above, "Non-Solution" files will use "Yellow" first.

So if you want to avoid color confusion, just adjust the color priority of the "All" range below - just select it with the mouse and drag it up. Or just keep the "All" color profile and remove all other "Local colors" profiles - the best option

2. Set the color of the currently selected tab: "Color Scheme" -> "General" select "Editor" -> "Tabs"

Adjust the "Foreground" of the "Selected Tab" tab as above

Note: The "Background" set in "Selected Tab" will be overwritten by the scope color in the "File Colors" above, so only "Foreground" will take effect here

3. Set the file colors of different states in "Version Control" -> "File Status Colors"

What is changed here is the "Foreground" color of the tab, and does not change the "Background" of the tab, so it will not affect the color in "File Colors"

But it will cover the "Foreground" in the "Selected Tab" above, that is, the priority of "Foreground" here is higher than that of "Selected Tab"

You can set the file "Foreground" in different states according to specific needs. If you don't want the color settings here, you can directly turn off the "File Status Color" on the right side of this option.

9.Rider automatic line break:

When writing code, when the number of columns of each line of code reaches a certain limit, it will automatically switch to the next line. To avoid being too long, you need to drag the horizontal slider below to see the content behind:

 Usually fill in the value as "200" - you can adjust the maximum number of characters per line according to your own code style, and check "Show hard wrap and visual guides (configured in code style options)" at the same time

Note: When this function is turned on, when the number of code columns exceeds the specified number, it will automatically switch to the next line, but the starting position of the switch and the alignment position of the switch to the next line are automatically selected by the system, which may not meet your own code aesthetic needs.

 Therefore, the above code automatic line break function is usually not enabled. Therefore, it is required to maintain good habits when writing code normally. If a line of code is too long, manually wrap it, so that you can freely decide the starting position of the switch and the alignment position of the next line

PS: The method of turning off automatic line wrap: set the value to 0 , and then turn off the above "Show hard wrap and visual guides (configured in code style options)"

 

10. Rider's code intelligent prompt:

Automatically select the first suggestion of the intellisense, do not use the "down arrow" to specify

Only when the above two are checked at the same time, when you enter "enter", "." or other keys, the first suggestion in the smart prompt will be automatically selected.

But this kind of prompt is too convenient, and long-term use will form a dependency, especially when the first suggestion in the suggestion list is not the target prompt, you need to use the "down arrow" to manually select the target suggestion again. Out of line with usual habits.

Therefore, the function of actively selecting the first suggestion is not enabled to avoid excessive reliance on tools. So turn off the above two options

11.Rider breakpoint debugging:

Rider breakpoint failure:

Sometimes you may encounter the situation that Rider suddenly cannot break the point. Usually, Rider and Unity are automatically bound, and it will automatically stop at the breakpoint during runtime. But sometimes it doesn't work.

Solution:

1. Restart Unity and restart Rider at the same time. Usually after both are restarted, the breakpoint can be normal

2. Delete the ".idea" folder in the root directory of the project

The function of each button in the breakpoint debugging panel:

Button 1 represents a direct jump from one breakpoint to the next - Resume Program

Button 2 represents single-step debugging, which refers to step-by-step execution along the current code line by line - Step Into

Button 3 represents jumping out of the current single-step debugging and returning to the previous level. Mainly for single-step debugging when executing the method body of the current method, use "Step Out" to jump out of the current method body and return to the previous level - Step Out

12. Find the function of each button on the panel:

Find the specified file: shift + shift

Global Find: "Ctrl + shift + F"

"Cc": case-sensitive, for example, when the search content is "HandButtonBinding", it will only be satisfied when the case is completely "HandButtonBinding". When "Cc" is not turned on, then "handbuttonbing" will also satisfy the search result

"W": When the search content is "abc", if you click "W", then only when the string is "abc" will be recognized, "abcdef" will not be recognized; if you do not click "W" , then "abc", "abcdef" will be recognized

13. Turn off Rider's automatic update:

14. Commonly used shortcut keys:

Return to the previous editing position: ctrl + -

Advance to next edit position: ctrl + shift + -

Format the script code according to the setting style: ctrl + alt + enter

Indent the code to the left: select the content to be indented, then shift + tab. Single line content cannot be indented

Indent the content to the right: select the content to be indented, and then tab. Single line content cannot be indented

Switch the case of a string: crtl + shift + U
 

 Summary of shortcut keys for IDEA: some of the shortcut keys for IDEA and Rider are common, summary of shortcut keys for IDEA

Guess you like

Origin blog.csdn.net/m0_47975736/article/details/124780758