Skip to content

Commit 95cf850

Browse files
authored
lsp-format-region: Fix error "no region" (#4827)
1 parent 8f42008 commit 95cf850

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lsp-mode.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6294,7 +6294,10 @@ one or more symbols, and STRUCTURE should be compatible with
62946294

62956295
(defun lsp-format-region (s e)
62966296
"Ask the server to format the region, or if none is selected, the current line."
6297-
(interactive "r")
6297+
(interactive
6298+
(if (use-region-p)
6299+
(list (region-beginning) (region-end))
6300+
(list (point) (point))))
62986301
(let ((edits (lsp-request
62996302
"textDocument/rangeFormatting"
63006303
(lsp--make-document-range-formatting-params s e))))

0 commit comments

Comments
 (0)