Skip to content

Commit

Permalink
Merge pull request zsong#14 from smanolloff/newline_at_eof
Browse files Browse the repository at this point in the history
Honor user settings for newline at EOF
  • Loading branch information
zsong committed Jan 15, 2016
2 parents 3db56ef + 20d6277 commit 51d2da3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sqlbeautifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ def plugin_loaded():
class SqlBeautifierCommand(sublime_plugin.TextCommand):
def format_sql(self, raw_sql):
try:
return sqlparse.format(raw_sql,
formatted_sql = sqlparse.format(raw_sql,
keyword_case=settings.get("keyword_case"),
identifier_case=settings.get("identifier_case"),
strip_comments=settings.get("strip_comments"),
indent_tabs=settings.get("indent_tabs"),
indent_width=settings.get("indent_width"),
reindent=settings.get("reindent")
reindent=settings.get("reindent")
)

if self.view.settings().get('ensure_newline_at_eof_on_save'):
formatted_sql += "\n"

return formatted_sql
except Exception as e:
print(e)
return None
Expand Down

0 comments on commit 51d2da3

Please sign in to comment.