Skip to content

Commit

Permalink
fix: Avoid scroll being mess up
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jun 23, 2024
1 parent 25bc31d commit bce8ef5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vs-edit-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,20 @@
(defun vs-edit-format-document ()
"Format current document."
(interactive)
(or (and (featurep 'lsp-mode)
(message nil) ; avoid scroll mess up
(or (and (bound-and-true-p lsp-managed-mode)
(ignore-errors (lsp-format-buffer)))
(indent-region (point-min) (point-max))))

;;;###autoload
(defun vs-edit-format-region-or-document ()
"Format the document if there are no region apply."
(interactive)
(if (use-region-p)
(indent-region (region-beginning) (region-end))
(vs-edit-format-document)))
(cond ((use-region-p)
(message nil) ; avoid scroll mess up
(indent-region (region-beginning) (region-end)))
(t
(vs-edit-format-document))))

;;
;; (@* "Folding" )
Expand Down

0 comments on commit bce8ef5

Please sign in to comment.