Skip to content

Commit

Permalink
Add support for new insert_final_newline property
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 22, 2012
1 parent 95affba commit 85bbb8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions EditorConfig.py
Expand Up @@ -28,6 +28,7 @@ def apply_config(self, view, config):
indent_size = config.get('indent_size')
end_of_line = config.get('end_of_line')
trim_trailing_whitespace = config.get('trim_trailing_whitespace')
insert_final_newline = config.get('insert_final_newline')
if indent_style == 'space':
settings.set('translate_tabs_to_spaces', True)
elif indent_style == 'tab':
Expand All @@ -41,3 +42,5 @@ def apply_config(self, view, config):
view.set_line_endings(LINE_ENDINGS[end_of_line])
if trim_trailing_whitespace == 'true':
settings.set('trim_trailing_white_space_on_save', True)
if insert_final_newline == 'true':

This comment has been minimized.

Copy link
@treyhunner

treyhunner Aug 22, 2012

Contributor

I suggest adding an elif insert_final_newline == 'false' which should disable automatic newline insertion.

I also think the same needs to be done for the trim_trailing_whitespace property which the user might have enabled by default (as you encourage in your README).

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus Aug 22, 2012

Author Owner

Ok, will do, was a little confused by the property description:

insert_final_newline: set to true ensure file ends with a newline when saving and false to disable this feature.

Saying to disable this feature sounds to me like it should just don't do anything on false.

Maybe something like:

insert_final_newline: set true to ensure file ends with a newline when saving and false to ensure it don't

Same with the trailing whitespace one.

This comment has been minimized.

Copy link
@treyhunner

treyhunner Aug 22, 2012

Contributor

Good point. We should probably reword these descriptions.

settings.set('ensure_newline_at_eof_on_save', True)

0 comments on commit 85bbb8b

Please sign in to comment.