.editorconfig for specifying indentation for various IDEs/editors #3313

Closed
wants to merge 0 commits into
from

Projects

None yet

4 participants

@nomaed
Contributor
nomaed commented Aug 19, 2016 edited

Added an .editorconfig to the project

http://editorconfig.org/

It help maintaining standard indentation in every project, per file-type.
Especially handy when working with multiple projects, each having its own style (which is pretty much always the case in the real world).

I based the settings on what I could figure by looking at the files, mainly:

  • by default, indents are 4 space character
  • *.fish and Makefile (*.in) use tab character for indentation

There are files that use mixed or non standard indentation, most commonly 2-spaces. For example, shell scripts such as install.sh.

@nomaed nomaed changed the title from Patch add editorconfig to .editorconfig for default indent styles Aug 19, 2016
@nomaed nomaed changed the title from .editorconfig for default indent styles to Added .editorconfig to specify indent styles for various IDEs/editors Aug 19, 2016
@nomaed nomaed changed the title from Added .editorconfig to specify indent styles for various IDEs/editors to .editorconfig for specifying indentation for various IDEs/editors Aug 19, 2016
@faho
Member
faho commented Aug 19, 2016 edited

.fish and Makefile (.in) use tab character for indentation

fish_indent uses 4 spaces for .fish files. We should follow that.

@floam
Member
floam commented Aug 19, 2016 edited

Don't change the Makefiles! They won't work if you stop using tabs. It's a requirement of the tools AFAIK.

And fish script, haven't we basically decided on tabs, for the sake of the simplicity when interactive editing? I'm surprised fish_indent is doing spaces. Don't we do tabs from functions? I probably got it wrong...

@floam
Member
floam commented Aug 19, 2016 edited

OK, it looks like functions assumes it will be tabs with a first tab it outputs being placed after the first newline in the function output, but then fish_indent does spaces.

@floam
Member
floam commented Aug 19, 2016 edited

These are random samples:

I think what that is is going to be functions not recently ran through the fish_indent tool in the tree, which must have changed behavior at some point. I'd lean towards saying it's wrong or a mistake but it's possible it was an intentional thing. If so, I guess that's what you'll want the config file to codify. @faho?

@floam
Member
floam commented Aug 19, 2016 edited

Can't find when it actually changed, but: #3055

I guess we don't like tabs, even for fish script. Shucks.

@nomaed
Contributor
nomaed commented Aug 19, 2016 edited

Ok, so 4 spaces it is!

Is there anything else that should be modified then?
I am not 100% sure about "insert_final_newline" although it's a common practice.

root = true

[*]
indent_size = 4
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{Makefile,*.in}]
indent_style = tab

[*.md]
trim_trailing_whitespace = false

[*.{sh,ac}]
indent_size = 2

[Dockerfile]
indent_size = 2
@nomaed
Contributor
nomaed commented Aug 19, 2016

I apologize for the commit noise, was trying to squash the several small commits to a single one and... well, I'm a git n00b :\

@faho
Member
faho commented Aug 19, 2016

@nomaed: No worries, we can squash it up later.

@nomaed nomaed referenced this pull request Aug 19, 2016
Closed

Completions for P4 #3311

@floam floam added the enhancement label Aug 24, 2016
@floam floam added this to the next-2.x milestone Aug 24, 2016
@floam floam assigned floam and unassigned floam Aug 24, 2016
@faho
Member
faho commented Aug 24, 2016

@nomaed: Are you done here? It would be nice if you could add a commit removing the unrelated brew.fish changes. Then I can just squash it together and merge it.

@nomaed nomaed closed this Aug 25, 2016
@nomaed
Contributor
nomaed commented Aug 25, 2016 edited

Created a new PR for this since I wasn't able to clean up the commit history...
#3332

@floam floam added a commit that referenced this pull request Aug 25, 2016
@nomaed @floam nomaed + floam Added .editorconfig file (#3332) (#3313)
.editorconfig: specifying preferred indentation per file-type for the project.

Closes #3332, #3313
0893134
@zanchey zanchey removed this from the next-2.x milestone Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment