Skip to content

Commit

Permalink
Merge from 5.x: PR #21654
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Dec 30, 2023
2 parents c5f032b + 87772f3 commit 37ddbc7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spyder/plugins/editor/widgets/codeeditor/lsp_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,17 +1029,23 @@ def format_document_range(self):
start, end = self.get_selection_start_end()
start_line, start_col = start
end_line, end_col = end

# Remove empty trailing newline from multiline selection
if end_line > start_line and end_col == 0:
end_line -= 1

fmt_range = {
"start": {"line": start_line, "character": start_col},
"end": {"line": end_line, "character": end_col},
}

using_spaces = self.indent_chars != "\t"
tab_size = (
len(self.indent_chars)
if using_spaces
else self.tab_stop_width_spaces
)

fmt_range = {
"start": {"line": start_line, "character": start_col},
"end": {"line": end_line, "character": end_col},
}
params = {
"file": self.filename,
"range": fmt_range,
Expand Down

0 comments on commit 37ddbc7

Please sign in to comment.