Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
- Getting an editor's/IDE's configuration right is cumbersome and the first barrier for contributing to Drupal.
Goal
- Automatically configure editors through
.editorconfig
.
Details
- http://editorconfig.org/ helps developers define and maintain consistent coding styles between different editors and IDEs.
- Many projects have adopted it already.
Comment | File | Size | Author |
---|---|---|---|
#25 | drupal-7.x-editorconfig-1713662-25.patch | 469 bytes | jweowu |
#13 | core-editorconfig-1713662-13.patch | 577 bytes | nod_ |
#6 | editorconfig.6.patch | 626 bytes | Eric_A |
#2 | editorconfig.1.patch | 626 bytes | treyhunner |
editorconfig.0.patch | 775 bytes | sun | |
Comments
Comment #1
wjaspers CreditAttribution: wjaspers commentedI don't know where you find these amazing gems, but thank you!
Very handy!
Comment #2
treyhunner CreditAttribution: treyhunner commentedI made a modified patch that removes some redundant/unecessary EditorConfig properties.
I removed the `byte_order_mark` property because it has been combine with the `charset` property (UTF-8 will always be assumed to have no byte order mark).
I removed the `indent_blank_lines` property because this property will probably not be implemented and its value is redundant (setting `trim_trailing_whitespace = true` will never indent blank lines).
I would also recommend removing the `curly_bracket_next_line`, `spaces_around_operators`, and `spaces_around_brackets` properties because they may never be implemented by any EditorConfig tools and their names may change if they are. I have removed these properties from the modified patch.
Comment #4
treyhunner CreditAttribution: treyhunner commented#2: editorconfig.1.patch queued for re-testing.
Comment #6
Eric_A CreditAttribution: Eric_A commentedThis is #2 "uncorrupted".
Comment #7
xuhdev CreditAttribution: xuhdev commented#6: editorconfig.6.patch queued for re-testing.
Comment #9
Eric_A CreditAttribution: Eric_A commented#1779638: Unexplained test failure in LocaleFileImportStatus->testBulkImportUpdateExisting()
Comment #10
Eric_A CreditAttribution: Eric_A commented#6: editorconfig.6.patch queued for re-testing.
Comment #11
nod_Marked #1807722: Add EditorConfig configuration for text editors and #1873314: Add a .editorconfig file to ease working on PHP projects with different conventions than Drupal as dup of this one.
Comment #12
sunWould be nice to move forward here.
As of now, actual support for .editorconfig in editors is rather sparse, but that should not hold us up from committing this.
In fact, committing this is rather a "statement" and support for the generic idea of the entire developer/programmer community to introduce a standard mechanism. The more projects will do it, the better are the chances that something sophisticated will emerge.
I'm fine with the changes in #2. Perhaps we just want to remove the @todo from the patch in #6 and call this done?
Comment #13
nod_Agreed.
Comment #14
jibran+1 for RTBC
Comment #15
Crell CreditAttribution: Crell commentedAmen and pass the sweet potatoes.
Comment #16
webchickSince this accelerates contribution to Drupal, re-classifying this as a task rather than a feature. Nice initiative; I hadn't heard of this before!
Committed and pushed to 8.x. Thanks!
Comment #17
quicksketchHm, just found this file after a git pull. I honestly thought someone had accidentally committed an IDE or text editor config file (since that is what this is, after all). Isn't it a bit early to commit something that no text editors or IDEs support natively (as in without a separately downloaded plugin)? Do we have any idea if this will ever actually do something? It seems like a good idea but there's little evidence this will become common. I suppose this is a chicken-egg problem, so lets be open to removing this in the future if broad support remains absent.
Comment #18
webchickSure, that sounds reasonable. Tagging "revisit before release" which is the standard "we might live to regret this" tag. :D
Comment #19
nod_Since I know at least chx and me uses PHPStorm: http://youtrack.jetbrains.com/issue/IDEA-87499
Comment #21
JohnAlbinAdded Drupal to the list of projects supporting .editorconfig. https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorC...
Comment #22
fuzzy76 CreditAttribution: fuzzy76 commentedWhat about a D7 backport?
Comment #23
catchComment #24
catchThis has been in for three years and a lot more people are using phpstorm than then (although not me!), so untagging.
Comment #25
jweowu CreditAttribution: jweowu commentedSeconding fuzzy76's comment #22: "What about a D7 backport?"
I see nothing in the D8 .editorconfig file that isn't also applicable to D7 coding standards (it covers only a very few basics, after all), so I see no reason why this couldn't be committed to D7 as-is, for the same benefits?
Comment #27
jweowu CreditAttribution: jweowu commentedThe testbot is obviously having a bad day.
Comment #28
jweowu CreditAttribution: jweowu commentedI triggered the tests again for good measure, just so it shows a pass (which it now does).
I feel like this should be a very easy RTBC by virtually anyone involved with this issue? It's the exact same file being added for the exact same reasons.
Comment #29
basvredelingTested in PHPstorm, works fine.
Comment #30
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedI am perfectly fine with that going into Drupal 7 as well.
Marked for commit.
Comment #31
stefan.r CreditAttribution: stefan.r commentedComment #33
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedCommitted and pushed to 7.x! Thanks!
Comment #34
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedAdding an issue credit for @jweowu on the Drupal 7 backport. (Possibly it went missing due to a drupal.org bug, not sure.)
Comment #35
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commented#34: Thanks, David!
Comment #36
FrittenKeeZ CreditAttribution: FrittenKeeZ commentedHonestly, I wonder why you haven't included settings for markdown files, since they are used basically by everyone...
Removing trailing whitespace in markdown files will ruin line breaks.
Comment #37
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commented#36: Thank you for the feedback, but please open a new issue against 8.1.x to fix it there. (and link it here)
For functionality present in both versions, we only can and do backport what has been committed to Drupal 8 per the backports policy.
Thank you!
Comment #38
FrittenKeeZ CreditAttribution: FrittenKeeZ commented#37: Roger that!
I have created a new issue here: #2764829: EditorConfig file lack settings for markdown files