Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Jan 3, 2025
1 parent e67461c commit baa0d67
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lisp/init-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,18 @@
;; Python
(use-package lsp-pyright
:preface
;; Use yapf to format
(defun lsp-pyright-format-buffer ()
(interactive)
(when (and (executable-find "yapf") buffer-file-name)
(call-process "yapf" nil nil nil "-i" buffer-file-name)))
:hook (((python-mode python-ts-mode) . (lambda ()
(require 'lsp-pyright)
(add-hook 'after-save-hook #'lsp-pyright-format-buffer t t))))
:init (when (executable-find "python3")
(setq lsp-pyright-python-executable-cmd "python3")))
:init
(when (executable-find "python3")
(setq lsp-pyright-python-executable-cmd "python3"))

(defun lsp-pyright-format-buffer ()
"Use `yapf' to format the buffer."
(interactive)
(when (and (executable-find "yapf") buffer-file-name)
(call-process "yapf" nil nil nil "-i" buffer-file-name))))

;; C/C++/Objective-C
(use-package ccls
Expand Down

0 comments on commit baa0d67

Please sign in to comment.