Unified code style tool editorConfig

Article directory

editorConfig

  1. editorConfig is an editor configuration that helps developers define and maintain a consistent code style between different editors and IDEs. Such as file indentation, newline and other formats.
  2. Generally, a file named .editorconfig is created in the root directory of the project, and the content of the file defines the coding standard of the project. When a file is opened with the IDE, the editorConfig plug-in will search in the directory of the opened file and its parent node at each level. editorconfig file, the editor reads the configuration file and formats the code accordingly, if not, the editor default configuration is used.
  3. editorConfig example
# http://editorconfig.org
root = true
# 对所有的文件生效
[*]
charset = utf-8
indent_style = space
indent_size = 4
tab_width =4
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline= true
max_line_length = 80[*.{
    
    json,yml}]
indent_size = 2[*.md]
trim_trailing_whitespace = false
  1. editorConfig configuration instructions
root           表示是最顶层的配置文件,发现设为true时,才会停止查找.editorconfig文件    
charset           设置编码 一般设置为utf8
indent_style    缩进类型(tab是硬缩进,space为软缩进)
indent_size     缩进的数量,如果indent_style为tab,则此属性默认为tab_width
tab_width        用一个整数来设置tab缩进的列数。默认是indent_size
end_of_line     换行符格式,值为lf、cr和crlf
trim_trailing_whitespace  设为true表示会去除换行行首的任意空白字符。
insert_final_newline      是否在文件的最后插入一个空行
  1. editorConfig supported editors

insert image description here

PS: I am Java YYDS personally, I am researching BigData, and I am also trying different IDEs for development, young people, go for it!

Guess you like

Origin blog.csdn.net/qq_43408367/article/details/131020157