filmov
tv
Code Formatting - ReSharper Essentials
Показать описание
### Format and Reformat Code
Code that is formatted consistently is more readable, and more enjoyable to work with. But what is good formatting?
How to use whitespaces and blank lines to arrange and separate code blocks, should you use tabs for indents (or spaces?), and many more questions typically arise in these discussions.
ReSharper comes with formatting rules that can suit every team. There are default formatting rules based on the default Visual Studio formatting options and numerous best practices. You can configure every detail of formatting rules, and enforce it in your code base.
Formatting rules are applied when ReSharper runs code completion and code generation, and when refactorings are performed. Formatting rules can also be applied to existing code.
### Format Selection from Alt+Enter
When you select code in the editor and use the Alt+Enter shortcut, you can format that selected portion of code using the current code formatting configuration.
### .editorconfig
EditorConfig is a configuration file convention that is used to define and maintain consistent code styles between team members working on the same code, and between different editors and IDEs.
A mixed team of ReSharper and Rider users is definitely possible, and code styles will be consistent across the two!
Style configuration is saved in files named `.editorconfig`, and can be shared easily by adding it to your Git repository (or other source control).
ReSharper will apply code styles defined in files named `.editorconfig` in the directory of the current file and in all parent directories.
### Code Cleanup
### File/Type Layout
### See Also
Code that is formatted consistently is more readable, and more enjoyable to work with. But what is good formatting?
How to use whitespaces and blank lines to arrange and separate code blocks, should you use tabs for indents (or spaces?), and many more questions typically arise in these discussions.
ReSharper comes with formatting rules that can suit every team. There are default formatting rules based on the default Visual Studio formatting options and numerous best practices. You can configure every detail of formatting rules, and enforce it in your code base.
Formatting rules are applied when ReSharper runs code completion and code generation, and when refactorings are performed. Formatting rules can also be applied to existing code.
### Format Selection from Alt+Enter
When you select code in the editor and use the Alt+Enter shortcut, you can format that selected portion of code using the current code formatting configuration.
### .editorconfig
EditorConfig is a configuration file convention that is used to define and maintain consistent code styles between team members working on the same code, and between different editors and IDEs.
A mixed team of ReSharper and Rider users is definitely possible, and code styles will be consistent across the two!
Style configuration is saved in files named `.editorconfig`, and can be shared easily by adding it to your Git repository (or other source control).
ReSharper will apply code styles defined in files named `.editorconfig` in the directory of the current file and in all parent directories.
### Code Cleanup
### File/Type Layout
### See Also
Комментарии