EditorConfig
This article may meet Wikipedia's criteria for speedy deletion for the following reasons:
If this article does not meet the criteria for speedy deletion, or you intend to fix it, please remove this notice, but do not remove this notice from pages that you have created yourself. If you created this page and you disagree with the given reason for deletion, you can click the button below and leave a message explaining why you believe it should not be deleted. You can also visit the talk page to check if you have received a response to your message. Note that this article may be deleted at any time if it unquestionably meets the speedy deletion criteria, or if an explanation posted to the talk page is found to be insufficient.
Note to administrators: this article has content on its talk page which should be checked before deletion. Administrators: check links, talk, history (last), and logs before deletion. Consider checking Google.This page was last edited by DrKC MD (contribs | logs) at 03:25, 24 April 2024 (UTC) (6 months ago) |
Type of format | INI configuration file |
---|---|
Standard | https://editorconfig.org/ |
Open format? | true |
Free format? | true |
Website | https://github.com/editorconfig/ |
EditorConfig (standard)
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] 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).[2][3] 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, how to manage indendation.[4]
Concept
The project web site states[5] "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."
Specification[6]
The configuration is typically stored in a UTF-8 encoded text file: .editorconfig. Some tools allow saving their style preferences as an EditorConfig file.[7] Each line:
- May be blank (only Whitespace characters
- A comment that begiings with ; or #
- A section header, which starts with a square bracket [, and ends with a square bracket ].
- A sectionheader may not have any non-whitespace characters outside of the brackets
- It may contain any characters between the backets including whitespace/tabs
- It uses forward slash characters / as path separators
- Backslashes \ are prohibited, even on Windows.
- Key-Value pair, with a = separating the key from the value
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
- Preamble: optional key=value pairs that precede the first section.
- Section Name: String between [ ]
- Section: the key value pairs that follow a section name until the start of the next section.
glob expressions
Section names are file path globs, using a format similar to .gitignore, and are based on Unix convetions.
characters | matched files |
---|---|
* | Any string (of any length) except path separators (/ |
** | Any string of characters |
? | Any single character |
[seq] | Any single character in the seq |
[!seq] | Any single character not in seq |
{s₁,s₂,..sₙ} | Any of the comma-separated list of strings. This can be nested. There must be more than one string in the list, as {somestring} will match the literal value '{somestring}' (which is probably not what was intended). |
{n₁..n₂} | Matches an integer number between n₁ and n₂ (i.e. matches i∈ℤ∣n₁≤i≤n₂) |
File location
EditorConfig 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 filepath (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 root=true.
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 Format
Editor config uses the common INI configuration file format.
Style options
key | settings to configure the option |
---|---|
indent_style | Set to use "tab" or "space" to use tab characters or spaces |
indent_size | Integer that defines how many spaces per tab, or how wide a tab stop is. |
tab_width | This usually isn't specified as it defaults to the indent_size |
end_of_line | set to "lf" , "cr", or "crlf" to control how breaks are represented. |
charset | Character encoding "latin1", "utf-8", "utf-8-bom", "utf-16be" or "utf-16le" to control the character set. |
trim_trailing_whitespace | if set to "true" will remove any whitespace characters preceding newline characters |
insert_final_newline | if "true" will end files with a newline, "false" will prevent it. |
root | special property (e.g. specified at the top of the file outside of any sections). Set to "true" to stop .editorconfig files search on current file. (I.e. don't keep looking for any more EditorConfig files in higher level directories. |
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)
Implementation
Many popular editors have adopted support of the specification.[8] The Github page for the project has libraries written in GO programing language,[9] C programing language,[10] and Python programming language,[11] and there is a Node.JS[12] library as well. There is a comprehensive listing of editors available on the project site.[13]
Editors reported to work without use of a plug-in
Gitea, Github, IntellijIdea,[14] PyCharm, and editors by JetBrains,[15] Kate, Komodo, Visual Studio, Vim/Neovim.
Editors which require a plug-in
Some editors require installation of a plug-in: Eclipse IDE, Atom, Emacs, Geany, JEdit, Notepad++, Netbeans, Visual Studio Code,[16] Sublime Text
Build environment which require a plug-in
Apache Ant, Gradle, Apache Maven
Editors which don't support EditorConfig
There is no list maintained of all the various text editors or IDEs which do not support EditorConfig (e.g. Spyder IDE[17] has had support mentioned in the past, but does not seem to yet include it.[18][19]
Other Software Development tools which implement EditorCOnfig
Prettier[20]
References
- ^ "Define consistent coding styles with EditorConfig". Microsoft Build. Microsoft. April 2024. Retrieved 04/01/2024.
{{cite web}}
: Check date values in:|access-date=
(help) - ^ "EditorConfig". X (Formerly known as Twitter). Retrieved 24 April 2024.
- ^ The Codeholic. "What is .editorconfig - EditorConfig full Guide". YouTube. Retrieved 24 April 2024.
- ^ "Configuration files for code analysis rules". Microsoft Build. 6 October 2023. Retrieved 24 April 2024.
- ^ ""EditorConfig"". EditorConfig. Retrieved 23 April 2024.
- ^ ""EditorConfig Specification"". Retrieved 24 April 2024.
- ^ "Code style options and code cleanup - Visual Studio (Windows)". 15 May 2023.
- ^ ""What is .editorconfig ?"". Geeks for Geeks. 7 Mar 2024. Retrieved 24 April 2024.
- ^ "Editorconfig/Editorconfig-core-go". GitHub. Retrieved 24 April 2024.
- ^ "Editorconfig/Editorconfig-core-c". GitHub. Retrieved 24 April 2024.
- ^ "Editorconfig/Editorconfig-core-py". GitHub.
- ^ "Editorconfig". 2 July 2023. Retrieved 24 April 2024.
- ^ "Projects Using EditorConfig". GitHub. Retrieved 2024-04-24.
- ^ "EditorConfig | IntelliJ IDEA".
- ^ "EditorConfig - IntelliJ IDEs Plugin | Marketplace". Retrieved 24 April 2024.
- ^ "EditorConfig for VS Code - Visual Studio Marketplace". Retrieved 24 April 2024.
- ^ "Add support for .editorconfig #2464". Syder-ide Github.
{{cite web}}
:|archive-date=
requires|archive-url=
(help) - ^ "'EDITORCONFIG' environmental variable for global config · Issue #465 · editorconfig/Editorconfig". GitHub. Retrieved 24 April 2024.
- ^ "Editor — Spyder 5 documentation". Retrieved 24 April 2024.
- ^ "How I Setup ESLint, Prettier, and EditorConfig for Static Sites". DEV Community. 2022-01-25. Retrieved 2024-04-24.
This article has not been added to any content categories. Please help out by adding categories to it so that it can be listed with similar articles. (April 2024) |