EditorConfig
EditorConfig is an open specification and file format for syntax highlighting, text editors and integrated development environment (IDEs) that aims to maintain a consistent coding style, particularly aimed at groups working together.[1][2] It can help keep multiple editors as well as individuals using the same conventions. It stores configurations in a file which can be shared by multiple people or used in multiple editors (by the same person or by many).[3][4] It defines rules for how to format different programming languages or other structured text files with conventions such as what character to end a line with and how to manage indentation.[5] ConceptThe project web site states "EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems."[6] SpecificationSource:[7] The configuration is typically stored in a UTF-8 encoded text file: .editorconfig. Some tools allow saving their style preferences as an EditorConfig file.[8] Each line:
Any other line format is invalid. It does not support in-line comments. If there is a ; or # character anywhere other than the start of line it is considered to be part of the text of the line. It does not support any character escaping. Parts/sections of file
glob expressionsSection names are file path globs, using a format similar to .gitignore, and are based on Unix conventions.
File locationEditorConfig plugins look for a file named .editorconfig in the same directory that contains an existing file, and in parent directories of that one until it hits the root file path (e.g. / in Linux/Unix/macOS or C: in the case of Microsoft Windows, or it finds an .editorconfig file that contains a line that states The most recent rules found take precedence in the order they are read. So rules in the same directory as the file would over-rule rules from higher level directories. File formatEditor config uses the common INI configuration file format. Style options
Some tools support additional options such as max_line_length (which forces a hard line wrap after the specified number of characters) (supported by Emacs, Vim, Atom, and several others) ImplementationMany popular editors have adopted support of the specification.[9] The GitHub page for the project has libraries written in Go programing language,[10] C programing language,[11] and Python programming language,[12] and there is a Node.JS library as well.[13] There is a comprehensive listing of editors available on the project site.[14] Editors reported to work without use of a plug-inGitea, GitHub, IntelliJ IDEA,[15] PyCharm, BBEdit, Xcode 16, and editors by JetBrains,[16] Kate, Emacs[17] Komodo, Visual Studio, Vim/Neovim. Editors which require a plug-inSome editors require installation of a plug-in: Eclipse IDE, Atom, Geany, JEdit, Notepad++, NetBeans, Visual Studio Code,[18] Sublime Text Build environment which require a plug-inApache Ant, Gradle, Apache Maven Editors which don't support EditorConfigThere is no list maintained of all the various text editors or IDEs which do not support EditorConfig (e.g. Spyder IDE[19] has had support mentioned in the past, but does not seem to yet include it.[20][21] Other software development tools which implement EditorConfigPrettier[22] References
|