lang/python: refactor lsp integration
This commit is contained in:
parent
6ebdbafbe4
commit
046dfb6475
2 changed files with 37 additions and 38 deletions
|
@ -13,7 +13,7 @@ called.")
|
|||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
;;; Packages
|
||||
|
||||
(use-package! python
|
||||
:mode ("[./]flake8\\'" . conf-mode)
|
||||
|
@ -198,7 +198,7 @@ called.")
|
|||
|
||||
|
||||
;;
|
||||
;; Environment management
|
||||
;;; Environment management
|
||||
|
||||
(use-package! pipenv
|
||||
:commands pipenv-project-p
|
||||
|
@ -291,31 +291,6 @@ called.")
|
|||
:after python)
|
||||
|
||||
|
||||
(use-package! lsp-python-ms
|
||||
:when (featurep! +lsp)
|
||||
:when (not (featurep! +pyright))
|
||||
:when (not (featurep! :tools lsp +eglot))
|
||||
:after lsp-clients
|
||||
:preface
|
||||
(after! python
|
||||
(setq lsp-python-ms-python-executable-cmd python-shell-interpreter))
|
||||
:init
|
||||
;; HACK If you don't have python installed, then opening python buffers with
|
||||
;; this on causes a "wrong number of arguments: nil 0" error, because of
|
||||
;; careless usage of `cl-destructuring-bind'. This silences that error,
|
||||
;; since we may still want to write some python on a system without
|
||||
;; python installed!
|
||||
(defadvice! +python--silence-errors-a (orig-fn &rest args)
|
||||
:around #'lsp-python-ms--extra-init-params
|
||||
(ignore-errors (apply orig-fn args))))
|
||||
|
||||
(use-package! lsp-pyright
|
||||
:when (featurep! +lsp)
|
||||
:when (featurep! +pyright)
|
||||
:when (not (featurep! :tools lsp +eglot))
|
||||
:after lsp-clients)
|
||||
|
||||
|
||||
(use-package! cython-mode
|
||||
:when (featurep! +cython)
|
||||
:mode "\\.p\\(yx\\|x[di]\\)\\'"
|
||||
|
@ -331,3 +306,30 @@ called.")
|
|||
:when (featurep! +cython)
|
||||
:when (featurep! :checkers syntax)
|
||||
:after cython-mode)
|
||||
|
||||
|
||||
;;
|
||||
;;; LSP
|
||||
|
||||
(when! (and (featurep! +lsp)
|
||||
(not (featurep! :tools lsp +eglot)))
|
||||
|
||||
(use-package! lsp-python-ms
|
||||
:unless (featurep! +pyright)
|
||||
:after lsp-clients
|
||||
:preface
|
||||
(after! python
|
||||
(setq lsp-python-ms-python-executable-cmd python-shell-interpreter))
|
||||
:init
|
||||
;; HACK If you don't have python installed, then opening python buffers with
|
||||
;; this on causes a "wrong number of arguments: nil 0" error, because of
|
||||
;; careless usage of `cl-destructuring-bind'. This silences that error,
|
||||
;; since we may still want to write some python on a system without
|
||||
;; python installed!
|
||||
(defadvice! +python--silence-errors-a (orig-fn &rest args)
|
||||
:around #'lsp-python-ms--extra-init-params
|
||||
(ignore-errors (apply orig-fn args))))
|
||||
|
||||
(use-package! lsp-pyright
|
||||
:when (featurep! +pyright)
|
||||
:after lsp-clients))
|
||||
|
|
|
@ -9,17 +9,14 @@
|
|||
(package! flycheck-cython :pin "ecc4454d35ab5317ab66a04406f36f0c1dbc0b76")))
|
||||
|
||||
;; LSP
|
||||
(when (and (featurep! +lsp)
|
||||
(not (featurep! :tools lsp +eglot)))
|
||||
(package! lsp-python-ms :pin "d42ffc2cc27ce36b5a7646ea922441f4c93b2678"))
|
||||
|
||||
(when (and (featurep! +lsp)
|
||||
(featurep! +pyright)
|
||||
(not (featurep! :tools lsp +eglot)))
|
||||
(when (featurep! +lsp)
|
||||
(unless (featurep! :tools lsp +eglot)
|
||||
(if (featurep! +pyright)
|
||||
(package! lsp-pyright
|
||||
;; REVIEW Remove this when added to melpa
|
||||
:recipe (:host github :repo "emacs-lsp/lsp-pyright")
|
||||
:pin "f85ad03477db5cd948a82fb7c6a75ac2bc5f0220"))
|
||||
:pin "f85ad03477db5cd948a82fb7c6a75ac2bc5f0220")
|
||||
(package! lsp-python-ms :pin "d42ffc2cc27ce36b5a7646ea922441f4c93b2678"))))
|
||||
|
||||
;; Programming environment
|
||||
(package! anaconda-mode :pin "6094dedf77810a47e213738f7e39a077de575ce1")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue