[emacs] .dir-locals.el: activate pyright in python-mode

To get in use of pyright type cheker in Emacs, a pyright installation [1] is
needed and in Emacs the lsp-pyright package has to be installed::

    M-x package-install lsp-pyright

[1] https://github.com/Microsoft/pyright
[2] https://github.com/emacs-lsp/lsp-pyright

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-01-19 12:45:49 +01:00 committed by Martin Fischer
parent 8342773216
commit aaf616fbd6
1 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,10 @@
;; Jedi, flycheck & other python stuff should use the 'python-shell-interpreter' ;; Jedi, flycheck & other python stuff should use the 'python-shell-interpreter'
;; from the local py3 environment. ;; from the local py3 environment.
;; ;;
;; For pyright support you need to install::
;;
;; M-x package-install lsp-pyright
;;
;; Other useful jedi stuff you might add to your ~/.emacs:: ;; Other useful jedi stuff you might add to your ~/.emacs::
;; ;;
;; (global-set-key [f6] 'flycheck-mode) ;; (global-set-key [f6] 'flycheck-mode)
@ -104,7 +108,10 @@
(python-mode (python-mode
. ((eval . (progn . ((eval . (progn
;; use nodejs from the (local) NVM environment (see nvm-dir)
(nvm-use-for-buffer)
(if (featurep 'lsp-pyright)
(lsp))
(setq-local python-environment-virtualenv (setq-local python-environment-virtualenv
(list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root) (list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root)
;;"--system-site-packages" ;;"--system-site-packages"