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

PR: Only autoformat on save if the file is a Python file (Editor) #19380

Merged
merged 2 commits into from
Sep 9, 2022
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
11 changes: 9 additions & 2 deletions spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,8 +1919,15 @@ def save(self, index=None, force=False, save_new_files=True):
self.set_os_eol_chars(osname=osname)

try:
if self.format_on_save and finfo.editor.formatting_enabled:
# Wait for document autoformat and then save
if (
self.format_on_save
and finfo.editor.formatting_enabled
and finfo.editor.is_python()
):
# Wait for document autoformat in case it is a Python file
# and then save.
# Just trigger the autoformat for Python files.
# See spyder-ide/spyder#19344

# Waiting for the autoformat to complete is needed
# when the file is going to be closed after saving.
Expand Down