-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support EditorConfig #13056
base: master
Are you sure you want to change the base?
Support EditorConfig #13056
Conversation
This adds support for EditorConfig to the core. This aims to be as minimal and direct of an integration as possible. This configures matching documents': * indent style (`indent_size` + `indent_style` + `tab_width`) * line ending (`end_of_line`) * encoding (`charset`) * whether a trailing line ending is added on save (`insert_final_newline`) The other core option `trim_trailing_whitespace` is parsed out but not yet used. `spelling_language` is left for future work.
There is also the key max_line_length. For some reason it doesn't appear in the spec. But it's somewhat widely used, e.g. webpack, elastic, django, react and rust. |
As the author of the original EditorConfig PR that will be closed by this implementation, I feel obligated to note that this implementation is technically non-conformant with the EditorConfig 0.17.2 spec listed. Note, for instance, differences between https://docs.rs/globset/latest/globset/#syntax and https://editorconfig.org/#wildcards - EditorConfig calls for a But at this point, it has been three years, and if maintaining a slightly-incorrect implementation of EditorConfig in-tree that adds no additional dependencies is preferable, then at least the users will finally have some form of EditorConfig support. |
Yeah that's the tradeoff - I'd rather have something as minimal as possible even if it isn't strictly spec conformant with the glob flavor. In the wild all projects I've seen (https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig) use just the basics of the glob syntax. |
To properly support |
That seems nice, but it could be supported right now with the same behavior as the |
continue; | ||
} | ||
}; | ||
let is_root = ini.pairs.get("root").map(AsRef::as_ref) == Some("true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let is_root = ini.pairs.get("root").map(AsRef::as_ref) == Some("true"); | |
let is_root = ini.pairs.get("root").as_ref() == Some("true"); |
Isn't this possible?
This adds support for EditorConfig to the core. This aims to be as minimal and direct of an integration as possible. This configures matching documents':
indent_size
+indent_style
+tab_width
)end_of_line
)charset
)insert_final_newline
)The other core option
trim_trailing_whitespace
is parsed out but not yet used (#8366).spelling_language
is left for future work.Closes #279
Closes #1777