Skip to content
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

fixed format not running for newlines at end of file #213

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion JsPrettier.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,14 @@ def run(self, edit, save_file=False, auto_format_prettier_config_path=None):
return self.show_status_bar_error()

source_modified = False
prettified_text_with_ws_and_lines = prettified_text
prettified_text = trim_trailing_ws_and_lines(prettified_text)

# Store viewport position to prevent screen jumping (#171):
previous_position = view.viewport_position()

if prettified_text:
if prettified_text == trim_trailing_ws_and_lines(source_text):
if prettified_text_with_ws_and_lines == source_text:
if self.ensure_newline_at_eof(view, edit) is True:
# no formatting changes applied, however, a line
# break was needed/inserted at the end of the file:
Expand Down